# Someone can help me with this question?

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:

1. All boxes have one and only one note;
2. There is a 1000 bill on each line
3. In the four corner boxes are three 500 bills.
4. There are two 2000 bills on the second line;
5. In the boxes of the third column there are two 1000 bills;
6. 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).

First tell what you know already about solving this. What tools might you use, and where are you stuck?

2 Likes

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

1 Like

Forget it, I already did it
Thank you very much for your answer, man

I had a quick go, and come up with 2 answers:

``````?- bet(L).
Sum: 13500
L = [500, 1000, 500, 2000, 2000, 1000, 500, 5000, 1000] ;
Sum: 13500
L = [500, 5000, 1000, 2000, 2000, 1000, 500, 1000, 500] ;
false.
``````

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!