:- expects_dialect(lps). % From http://www.liquidity-lang.org/doc/tutorial/game.html, single player % Simple version, not on blockchain events play(_Player, _Number, _Bet), fund(_Amount). actions pay(_Player,_Prize), lost(_Player, _Number, _Bet). fluents played(_Player,_Number,_Bet), balance(_Amount). initially balance(0). fund(Amount) updates Old to New in balance(Old) if New is Old+Amount. false fund(Amount), Amount=<0. % redundant with blockchain's own constraints play(Player,N,Bet) initiates played(Player,N,Bet). false play(_,_,_), played(_,_,_). % one play at a time false play(_,N,_), not between(0,100,N). false play(_,_,Bet), balance(Balance), Bet>Balance. % not enough prior funds to allow play pay(_,Prize) updates Old to New in balance(Old) if New is Old-Prize. false pay(_,Prize), balance(Balance), Prize>Balance. % superflous wrt blockchain constraints , but nice to have finish(Random_number) from T1 to T2 if played(P,Number,Bet), Number>Random_number, lost(P,Number,Bet) from T1 to T2, terminate played(P,Number,Bet) from T1 to T2. finish(Random_number) from T1 to T2 if played(P,Number,Bet) at T1, Number= ?- go(Timeline). */