Virtual Chess tournament with Prolog

2020-12-07 | #programming #prolog

Below my #swi #prolog solution for “Virtual Chess tournament” proposed by dmcommunity.org challenge Dec 2020 Player 1 is Fischer, player 2 is Kasparov and player 3 is Karpov. I can find two solutions (Score1,Wins1,Draws1,Loses1 are Fischer’s score, number of wins, draws and loses,.

Continue reading 


Calculator with Two Buttons with Prolog

2020-11-14 | #programming #prolog

Below my #prolog solution for “Calculator with Two Buttons” proposed by dmcommunity.org challenge Nov 2020 swipl nov2020.pl ?- shortest_path(0,5034,Path), length(Path,Len), findall(Op,member([_,Op,_], Path), Ops). Path = [[0,+,1],[1,+,2],[2,+,3],[3,+,4],[4,+,5],[5,*,50],[50,*,500],[500,+,501],[501,+,502],[502,+,503],[503,*,5030],[5030,+,5031],[5031,+,5032],[5032,+,5033],[5033,+,5034]], Len = 15, Ops = [+,+,+,+,+,*,*,+,+,+,*,+,+,+,+].

Continue reading 