RosettaCodeData/Task/Nim-game/Mathematica/nim-game.math

9 lines
326 B
Plaintext

n = 12;
While[n > 0,
c = ChoiceDialog["Current amount = " <> ToString[n] <> "\nHow many do you want to pick?", {1 -> 1, 2 -> 2, 3 -> 3}];
n -= c;
ChoiceDialog["Current amount = " <> ToString[n] <> "\nComputer takes " <> ToString[4 - c]];
n -= (4 - c);
]
ChoiceDialog["Current amount = " <> ToString[n] <> "\n You lost!"]