-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
37 lines (32 loc) · 925 Bytes
/
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
from src.qlearning import QLearning1DGame
import os
visualize_mode = None
slow_mode = None
while True:
print("Use visualize mode? (y/n) ")
mode = input()
if mode.lower() != "y" and mode.lower() != "n":
print("Invalid input")
else:
if mode.lower() == "y":
visualize_mode = True
elif mode.lower() == "n":
visualize_mode = False
break
while True:
print("Use slow mode (for better observation)? (y/n)")
mode_slow = input()
if mode_slow.lower() == "y":
slow_mode = True
break
elif mode_slow.lower() == "n":
slow_mode = False
break
else:
print("Invalid input")
break
os.system("cls")
agent = QLearning1DGame()
agent.train(visualize_mode, slow_mode)
print("Q-table result")
print(agent.q_table)