-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart.py
55 lines (51 loc) · 1.44 KB
/
start.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
import time
import sys
import random
from pygame import mixer
def PrintText(text):
"""
Print text in animated style in terminal.
:param text: str
:return: None
"""
for char in text:
sys.stdout.write(char)
sys.stdout.flush()
time.sleep(0.1)
def Greetings():
"""
Greets player.
:return: name of the player, does he want to play with O or X
"""
mixer.init()
mixer.music.load("audio/intro.mp3")
mixer.music.set_volume(0.7)
mixer.music.play(-1)
print('\n\n')
PrintText('Hello, little human....\n')
time.sleep(0.5)
PrintText('I have not seen humans for a long time...\n')
time.sleep(0.5)
PrintText('What is your name?\n')
time.sleep(0.5)
name = input('- My name is ')
time.sleep(1)
PrintText(f'Greetings, {name}\n')
PrintText('Shall we play the game of TicTacToe?\n')
time.sleep(0.5)
ans = input('- (yes/No): ')
if ans == 'yes':
PrintText('Good...\n')
time.sleep(0.5)
PrintText('Do you want to play as X or O?\n')
time.sleep(0.5)
char = input('- (X/O/random): ')
if char=='random':
char = random.choice(['X', 'O'])
PrintText(f'The God of Random gave you {char}')
else:
PrintText('That is not an option...\n')
PrintText('SIKE')
char = 'X'
mixer.music.stop()
return name, char