Skip to content

Commit 1f652be

Browse files
committed
ready to use egaroucid for console 6.2.0
1 parent 827a746 commit 1f652be

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Egaroucid_for_Console/*
2+
__pycache__/*

main_auto_check.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
from othello_py import *
44
from random import choice
55

6+
serial_port = 'COM3'
7+
executable = '"./Egaroucid_for_Console/Egaroucid_for_Console.exe" -level 10 -quiet'
68

7-
robot = serial.Serial('COM3',115200, timeout=1000000)
8-
egaroucid = subprocess.Popen('egaroucid5.exe 10'.split(), stdin=subprocess.PIPE, stdout=subprocess.PIPE)
9+
robot = serial.Serial(serial_port, 115200, timeout=1000000)
10+
egaroucid = subprocess.Popen(executable.split(), stdin=subprocess.PIPE, stdout=subprocess.PIPE)
911

1012
def send_cmds(cmds):
1113
for cmd in cmds:
@@ -21,21 +23,22 @@ def send_cmds(cmds):
2123
record = ''
2224

2325
while True:
24-
grid_str = str(o.player) + '\n'
26+
grid_str = 'setboard '
2527
for yy in range(hw):
2628
for xx in range(hw):
2729
if o.grid[yy][xx] == black:
28-
grid_str += '0'
30+
grid_str += 'X'
2931
elif o.grid[yy][xx] == white:
30-
grid_str += '1'
32+
grid_str += 'O'
3133
else:
32-
grid_str += '.'
33-
grid_str += '\n'
34-
#print(grid_str)
34+
grid_str += '-'
35+
grid_str += ' '
36+
grid_str += 'X' if o.player == black else 'O'
37+
grid_str += '\n'
3538
egaroucid.stdin.write(grid_str.encode('utf-8'))
3639
egaroucid.stdin.flush()
37-
value, coord = egaroucid.stdout.readline().decode().split()
38-
print(value, coord)
40+
coord = egaroucid.stdout.readline().decode().split()
41+
print(coord)
3942
record += coord
4043
print(record)
4144
policy = [int(coord[1]) - 1, ord(coord[0]) - ord('a')]

0 commit comments

Comments
 (0)