-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
72 lines (55 loc) · 1.54 KB
/
main.py
File metadata and controls
72 lines (55 loc) · 1.54 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import random
import os
import time
from sys import platform
def clear_screen() -> None:
if platform == 'win32':
os.system("cls")
os.system("clear")
def header(title:str,delay:float) -> None:
print("=" * 40)
print(title)
print("=" * 40)
time.sleep(delay)
clear_screen()
def pop(title:str) -> None:
print("=" * 40)
print(title)
print("=" * 40)
def get_pop(title:str) -> str:
print("=" * 40)
temp = input(title)
print("=" * 40)
time.sleep(1.5)
clear_screen()
return temp
answer = 'y'
while answer != 'n':
colors = "RGBY"
simon = ""
header(
title = "Game Rule: Guess a colors sequence",
delay = 3.0
)
for count in range(1,4):
header(title = f"Get Ready! in {count}",delay = 1.5)
header(title = "Let's Go!",delay = 1.5)
for score in range(0,5):
simon += random.choice(colors)
for color in colors:
header(title = f'Color: {color}',delay = 1.5)
guess = get_pop("Enter a Guess: ")
guess = guess.upper()
time.sleep(1)
clear_screen()
if guess != simon:
break
header(title = "Next Round")
time.sleep(1)
clear_screen("clear")
header(
title = f'Game Over! Your Final Score Is {score}',
delay = 1.5
)
answer = get_pop("Play Again? Yes[y] or No[n]: ")
pop("Thank you for playing the game :) \nAuthor: John Jayson B De Leon\nGithub: savjaylade84\nEmail: savjaylade84@gmail.com")