20 lines
511 B
Text
20 lines
511 B
Text
print("There are twelve tokens.")
|
|
print("You can take 1, 2, or 3 on your turn.")
|
|
print("Whoever takes the last token wins.\n")
|
|
|
|
var tokens = 12
|
|
while tokens > 0 {
|
|
print("There are \(tokens) remaining.")
|
|
print("How many do you take?")
|
|
var playertake = Integer(readLine())
|
|
|
|
if playertake < 1 || playertake > 3 {
|
|
print("1, 2, or 3 only.")
|
|
} else {
|
|
tokens -= playertake
|
|
print("I take \(4 - playertake).")
|
|
tokens -= (4 - playertake)
|
|
}
|
|
}
|
|
|
|
print("I win again.")
|