24 game/Solve: Difference between revisions

Content added Content deleted
Line 4,611:
set patterns {
{((A x B) y C) z D}
{(A x (B y C)) z D}
{(A x B) y (C z D)}
{A x ((B y C) z D)}
{A x (B y (C z D))}
}
# Encoding the various permutations of digits
Line 4,622:
set operations {+ - * /}
 
# Given a list of four integers (precondition not checked!) return a list of
# return a list of solutions to the 24 game using those four integers.
proc find24GameSolutions {values} {
global operations patterns permutations
Line 4,669:
}
print24GameSolutionFor $argv</lang>
{{out}}
Demonstrating it in use:
<span style="color:silver">''bash$''</span> <span style="color:brown">tclsh8.4 24player.tcl 3 2 8 9</span>