-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
55 lines (51 loc) · 1.31 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
44
45
46
47
48
49
50
51
52
53
54
55
import curses
from game import Game
from nnTrainer import Trainer
from program import Program
from badCursesDebugger import output
def better_wrapper(func):
"""wraps curses"""
try:
stdscr = curses.initscr()
curses.filter()
curses.noecho()
curses.cbreak()
#curses.curs_set(False)
stdscr.keypad(True)
stdscr.clear()
return func(stdscr)
finally:
curses.nocbreak()
stdscr.keypad(False)
curses.echo()
curses.curs_set(True)
curses.endwin()
output()
def main(stdscr):
'main'
Program(stdscr, "tic tac toe", {
"game": {
"options": {
"board length": 3,
"ai": True,
"ai file": "fileOne",
"start first": True
},
"program_class": Game
},
"AI training": {
"options": {
"board_length": 3,
"select file1": "fileOne",
"select file2": "fileTwo",
"show training": True,
"slowAmt": 0,
"new": True,
"rounds": 10,
"start first": True
},
"program_class": Trainer
}
}).run()
if __name__ == "__main__":
better_wrapper(main)