A friend bet you the money (in escudos) that was in nine boxes if
guess the contents of those boxes. The boxes are arranged in a square of 3
rows and 3 columns as shown below.
C1 C2 C3
C4 C5 C6
C7 C8 C9
To help you guess, your friend has given you the following clues:
All boxes have one and only one note;
There is a 1000 bill on each line
In the four corner boxes are three 500 bills.
There are two 2000 bills on the second line;
In the boxes of the third column there are two 1000 bills;
A single 5000 bill is not on the third line.
Since, in order to win the bet, you have to discover the contents of each box;
Write a Prolog program that allows you to win the bet and, by the way, calculate
how much will you earn. The program must be invoked through the predicate bet/0 that
will show on the screen a list with the values ​​of the notes existing in boxes C1 to C9 (for
this order).
it’s a college activity, i didn’t have any class os contact with it
i don’t have any knowledgement about prolog, only the basics that i lerned at youtube, also, don’t have idea how to start or which tools i have to use to resolve it :v
you’re welcome. I responded as I did because it’s obviously a textbook problem, intended for people with a certain level of knowledge but not a greater level. There’s a dozen ways to write this program and for learning it’s (maybe) best to start from where you’re at. Certainly for evaluation it’s easier if you don’t suddenly write code you weren’t supposed to understand yet. Glad you figured it out!