-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
43 lines (38 loc) · 1.41 KB
/
main.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
import numpy as np
import sys
from generation import Generation
def main():
generation = Generation(
100,
[11, 11, 4, 4],
0.5,
10
)
print("Starting the program at generation 0")
while True:
try:
command = input("Enter a command (sbs, asap, alap): ")
if command == "sbs":
generation.do_generation(render=True)
print("That was generation {}.".format(str(generation.age - 1)))
elif command == "asap":
generation.do_generation()
print("Just did generation {} as fast as possible.".format(str(generation.age - 1)))
elif command == "alap":
print("Doing generations for as long as possible starting at generation {}.".format(str(generation.age)))
print("Type Ctrl-C to exit the alaping")
while True:
try:
generation.do_generation()
print("Just did generation {}".format(str(generation.age - 1)))
except KeyboardInterrupt:
print("Exiting alap")
break;
else:
print("Not a valid command")
except KeyboardInterrupt:
print("Thanks for playing")
print("Exiting now")
sys.exit()
if __name__ == "__main__":
main()