dmcommunity.org challenge Nov 2020 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 = [+,+,+,+,+,*,*,+,+,+,*,+,+,+,+].