RosettaCodeData/Task/Amb/Smalltalk/amb-6.st

13 lines
422 B
Smalltalk
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
result :=
Amb
until:[:solution |
(Dialog confirm: e'Found solution: {solution}\nSee more?') not
] in:[
Amb try:(1 to:100) in:[:x |
Amb try:(1 to:100) in:[:y |
y <= x ifTrue:[
Amb try:(1 to:100) in:[:z |
(x squared + y squared = z squared) ifTrue:[
{x . y . z} ]]]]]].
Transcript showCR: result.