-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
117 lines (106 loc) · 3.3 KB
/
run.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# (c) ArtGames101 2017
import sys, os, subprocess, time, psutil, random
from data import new
from data import name
IS_WINDOWS = os.name == "nt"
IS_MAC = sys.platform == "darwin"
def clear_screen():
if IS_WINDOWS:
os.system("cls")
else:
os.system("clear")
def user_choice():
return input("\n>>> ").lower().strip()
def welcome():
if new.new == True:
welcomer()
else:
main()
def welcomer():
clear_screen()
print("Hello! I am your Virtual Friend :D")
input("\nEnter")
clear_screen()
print("Before We begin what is your name?")
name = open("data/name.py", "w")
choice = user_choice()
name.write("name = '{}'".format(choice))
clear_screen()
input("Welcome!\n"
"\n"
"Enter")
name.close()
clear_screen()
print("One more thing before we start!\n"
"i have to tell you my features!")
print("Features:\n"
"\n"
"* I can tell the time/date/year\n"
"* I can talk to you\n"
"* I can tell you a joke\n"
"* I can remember things for you")
newno = open("data/new.py", "w")
newno.write("new = False")
input("Have Fun with your new Virtual Friend!\n"
"\n"
"Enter")
newno.close()
subprocess.call((sys.executable, "run.py"))
def main():
clear_screen()
print("Hello {}! v1.1".format(name.name))
print("\n"
"Your Virtual Friend is waiting for a responce!")
print("\n"
"1. Tell a joke 2. What is the time\n\n"
" 3. Remember something for me\n"
" or\n"
" Type anything to talk to me!\n")
choice = user_choice()
if choice == "1":
clear_screen()
from VFdata import jokes
input("Here is a joke!\n"
"\n"
"{}".format(random.choice(jokes.jokes)))
main()
if choice == "2":
clear_screen()
input("The Time is currently:\n"
"{}".format(time.ctime()))
main()
if choice == "3":
from VFdata import remember
if remember.text == None:
clear_screen()
print("Type something for me to remember!")
choice = user_choice()
rem = open("VFdata/remember.py", "w")
rem.write("text = '{}'".format(choice))
input("Come Back here to see your message!")
rem.close()
subprocess.call((sys.executable, "run.py"))
else:
from VFdata import remember
clear_screen()
print("I remember what you said here you go!\n"
"\n"
"{}".format(remember.text))
print("\n"
"1. Delete the message 2. Save and Exit")
choice = user_choice()
if choice == "1":
clear_screen()
rem = open("VFdata/remember.py", "w")
rem.write("text = None")
input("Message Deleted!")
rem.close()
subprocess.call((sys.executable, "run.py"))
if choice == "2":
main()
else:
clear_screen()
from VFdata import speach
input(random.choice(speach.text))
main()
welcome()