@tiki720/

Unbeatable game of Nim V.2.1

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
score = 0
playerloop = True

print("\nWelcome to my beatable game of Nim V.2")
print("The rules are simple you choose a number between 1 and 3 and then I do, first person to land on you choose wins\n")


while True:
	Nim = int(input("Input a multiple of 4 to be the Nim number: "))
	if Nim % 4 == 0:
		print(Nim,'is a multiple of 4, we can begin')
		break
	else:
		print(Nim,'is not a multiple of 4')

print('/n')

while True:
	userInput = int(input("Choose a number between 1 and 3: "))

	if userInput >= 0 and userInput <= 3:
		score += userInput
		print('You chose ', userInput)
	if score == Nim:
		print('You have won')
		break
	score += 4 - userInput;
	print('I chose ',4 - userInput)

	print('The number is at',score,'out of',Nim)
	if score == Nim:
		print('I have won')
		break
	if score > Nim:
		print('No-one has won')
		break
	print('\n')