-
Notifications
You must be signed in to change notification settings - Fork 0
/
stickgame.py
56 lines (48 loc) · 1.58 KB
/
stickgame.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
'''AUTHOR:GANESH
3/12/24
STICK GAME
'''
def stick_game(n):
print("Welcome to Stick game!")
print()
print("There are a total of 16 sticks.Each player may take 1,2 or 3 sticks at a time strategically.The Player who picks the last stick loses!!")
print()
print("LET THE GAME START,GOOD LUCK!!")
print()
player1=input("Enter name of player one: ")
print()
player2=input("Enter name of player two: ")
print()
while n>0:
sticks1=int(input(f"{player1},You may pick 1,2 or 3 sticks: "))
print()
print(player1, "took", sticks1, "sticks")
n = n - sticks1
print(n, "Sticks remain")
if sticks1>3 or sticks1==0:
print("CHEATER BOII")
print(player1,"HAS BEEN DISQUALIFIED,GAME IS BEING TERMINATED....")
print(player2, "WINS!!")
break
if n<=0:
print(player1,"Picks the last and loses the game! :(")
print()
print(player2,"WINS!!")
break
sticks2=int(input(f"{player2},You may pick 1,2 or 3 sticks: "))
print()
print(player2, "took", sticks2, "sticks")
print()
n = n - sticks2
print(n, "Sticks remain")
if sticks2>3 or sticks2==0:
print("YOU CHEATT")
print(player2,"HAS BEEN DISQUALIFIED.GAME IS BEING TERMINATED...")
print(player1, "WINS!!")
break
if n<=0:
print(player2,"Picks the last and loses the game! :(")
print()
print(player1,"WINS!!")
break
stick_game(16)