/* Pocket money puzzle in Picat. From Adrian Groza "Modelling Puzzles in First Order Logic" """ Puzzle 6. Pocket money "When I got to the station this morning," said Harold Tompkins, at his club, "I found I was short of cash. I spent just one-half of what I had on my railway ticket, and then bought a nickel’s worth of candy. When I got to the terminus I spent half of what I had left and ten cents for a newspaper. Then I spent half of the remainder on a bus ticket and gave fifteen cents to that old beggar outside the club. Consequently, I arrive here with this single nickel. How much did I start out with?" (puzzle 17 from Dudeney 2016) """ (A nickel is 5 cent.) This program was created by Hakan Kjellerstrand, hakank@gmail.com See also my Picat page: http://www.hakank.org/picat/ */ import cp. main => go. go => T3 #= 5, T2 #= 2*(T3 + 15), T1 #= 2*(T2 + 10), X #= 2*(T1 + 5), Vars = [x=X,t1=T1,t2=T2,t3=T3], % solve/1 is not needed here % solve(Vars), println(Vars), fail, nl.