24 game/Solve: Difference between revisions

m
m (→‎{{header|Perl}}: show output)
Line 2,542:
 
=={{header|Perl}}==
{{output?|Perl}}
Will generate all possible solutions of any given four numbers according to the rules of the [[24 game]].
 
Line 2,600 ⟶ 2,599:
}
}</lang>
Example output:
<pre>E:\Temp>24solve.pl
Enter four integers or 'q' to exit: 1 3 3 8
((1 + 8) * 3) - 3
((1 + 8) * 3) - 3
((8 + 1) * 3) - 3
((8 - 1) * 3) + 3
((8 + 1) * 3) - 3
((8 - 1) * 3) + 3
(3 * (1 + 8)) - 3
(3 * (8 + 1)) - 3
(3 * (8 - 1)) + 3
(3 * (1 + 8)) - 3
(3 * (8 + 1)) - 3
(3 * (8 - 1)) + 3
3 - ((1 - 8) * 3)
3 + ((8 - 1) * 3)
3 - ((1 - 8) * 3)
3 + ((8 - 1) * 3)
3 - (3 * (1 - 8))
3 + (3 * (8 - 1))
3 - (3 * (1 - 8))
3 + (3 * (8 - 1))
Enter four integers or 'q' to exit: q
 
E:\Temp></pre>
 
=={{header|PicoLisp}}==
Anonymous user