-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMAIN.py
More file actions
32 lines (23 loc) · 760 Bytes
/
Copy pathMAIN.py
File metadata and controls
32 lines (23 loc) · 760 Bytes
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
import random
def game():
print("Welcome to Snake, Water, Gun Game!")
print("Choose one: Snake (s), Water (w), or Gun (g)")
user_choice = input("Your choice (s/w/g): ").lower()
choices = ['s', 'w', 'g']
computer_choice = random.choice(choices)
print(f"Computer chose: {computer_choice}")
# Check for draw
if user_choice == computer_choice:
return "It's a Draw!"
# Game logic
if (user_choice == 's' and computer_choice == 'w') or \
(user_choice == 'w' and computer_choice == 'g') or \
(user_choice == 'g' and computer_choice == 's'):
return "You Win!"
else:
return "You Lose!"
# Run the game this is from chat gpt
print(game())
'''1 for snake
-1 for water
0 for gun'''