-
Notifications
You must be signed in to change notification settings - Fork 20
/
run.py
55 lines (46 loc) · 1.41 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
from AlphaGomoku import *
import warnings
import os
import multiprocessing as mp
def select_mode():
print('> Please enter the mode:')
print('> 1: Training (not available)')
print('> 2: AI vs Human')
print('> 3: Human vs Human')
print('> 4: AI vs AI')
print('> 5: Collect human play data')
print('> 6: Collect self play data')
print('> 7: Train on external data')
print('> 8: Collect human vs AI play data')
print('> 9: AI(NaiveAgent) vs Human mode')
print('> 10: AI vs AI(NaiveAgent) mode)')
print('> 11: Train on generated data')
print('> 12: Collect self play data(Fast AI)')
print('> 13: Self play and train')
_mode = int(input('> mode = '))
if _mode == 2:
print('> Please select your color: (1: Black, 0: White)')
is_black = int(input('> color = '))
if is_black == 1:
_mode = 2.5
return _mode
def start(_mode):
conf = Config()
conf.set_mode(_mode)
_env = Env(conf)
_env.start_mode()
if __name__ == '__main__':
# ignore warnings
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
warnings.filterwarnings("ignore")
mode = select_mode()
mp.freeze_support()
if mode == 13:
cores_num = mp.cpu_count()
cores_num = 2
pool = mp.Pool(processes=cores_num)
while True:
pool.map(func=start, iterable=[6] * cores_num)
start(7)
else:
start(mode)