Crypto Exhaustive Problem Solver Advanced Demo

Welcome to SWI-Prolog (threaded, 64 bits, version 8.0.3) SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software. Please run ?- license. for legal details. For online help and background, visit http://www.swi-prolog.org For built-in help, use ?- help(Topic). or ?- apropos(Word). ?- consult(crypto). true. ?- display_bindings. lo -> 0 hi -> 9 true. ?- solve_one. numbers = {1,4,0,9,1} and goal = 6 Solution: ( ( 0 * 9 ) + ( 1 + ( 1 + 4 ) ) ) true . ?- display_bindings. lo -> 0 hi -> 9 crypto_problem -> problem(numbers(1,4,0,9,1),goal(6)) solution -> solution(ex(ex(0,*,9),+,ex(1,+,ex(1,+,4)))) true. ?- demo(10). numbers = {5,3,6,9,5} and goal = 7 Solution: ( ( 5 * ( 9 - 6 ) ) - ( 5 + 3 ) ) numbers = {5,2,3,8,8} and goal = 8 Solution: ( 8 * ( ( 3 + 8 ) - ( 5 * 2 ) ) ) numbers = {8,5,1,0,6} and goal = 4 Solution: ( ( 1 + 0 ) + ( 6 - ( 8 - 5 ) ) ) numbers = {6,5,1,5,5} and goal = 2 Solution: ( ( 1 - 5 ) - ( 5 - ( 6 + 5 ) ) ) numbers = {0,7,5,3,2} and goal = 3 Solution: ( ( 5 + 3 ) + ( 2 - ( 0 + 7 ) ) ) numbers = {7,6,5,9,0} and goal = 6 Solution: ( ( 5 + ( 7 - 6 ) ) + ( 9 * 0 ) ) numbers = {2,2,0,2,6} and goal = 6 Solution: ( 6 + ( ( 2 + 2 ) * ( 0 * 2 ) ) ) numbers = {2,2,2,3,8} and goal = 2 Solution: ( ( 8 + ( 2 + 2 ) ) / ( 2 * 3 ) ) numbers = {8,5,6,4,0} and goal = 4 Solution: ( 4 + ( ( 8 + 5 ) * ( 6 * 0 ) ) ) numbers = {4,3,3,8,4} and goal = 8 Solution: ( ( 3 + 8 ) + ( 4 - ( 4 + 3 ) ) ) true . ?- display_bindings. lo -> 0 hi -> 9 crypto_problem -> problem(numbers(4,3,3,8,4),goal(8)) solution -> solution(ex(ex(3,+,8),+,ex(4,-,ex(4,+,3)))) true. ?- solve(problem(numbers(1,2,3,4,5),goal(6))). numbers = {1,2,3,4,5} and goal = 6 Solution: ( ( 1 + 2 ) * ( ( 3 + 4 ) - 5 ) ) true . ?- display_bindings. lo -> 0 hi -> 9 crypto_problem -> problem(numbers(1,2,3,4,5),goal(6)) solution -> solution(ex(ex(1,+,2),*,ex(ex(3,+,4),-,5))) true. ?- solve(problem(numbers(0,0,0,0,7),goal(8))). numbers = {0,0,0,0,7} and goal = 8 No solution to this problem. true . ?- display_bindings. lo -> 0 hi -> 9 crypto_problem -> problem(numbers(0,0,0,0,7),goal(8)) solution -> solution(none) true. ?- exit.