aboutsummaryrefslogtreecommitdiff
path: root/console/voerbak_connector.py
diff options
context:
space:
mode:
authorlonkaars <l.leblansch@gmail.com>2021-02-16 18:25:26 +0100
committerlonkaars <l.leblansch@gmail.com>2021-02-16 18:25:26 +0100
commit01fa26325d9532ac9d8eaec27eb582b37f039552 (patch)
treea29d2be5dbe8071f8e0555450106ad7d6912f4d5 /console/voerbak_connector.py
parent7986d9560602528ea3034553eb1f0d82267dabbc (diff)
updated readme + current move
Diffstat (limited to 'console/voerbak_connector.py')
-rw-r--r--console/voerbak_connector.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/console/voerbak_connector.py b/console/voerbak_connector.py
index 742ddc0..6274ada 100644
--- a/console/voerbak_connector.py
+++ b/console/voerbak_connector.py
@@ -18,6 +18,7 @@ class bord:
def __init__(self, w, h):
self.width = w
self.height = h
+ self.player_1 = True
self.board = "0" * (w * h)
self.win_positions = []
self.process = subprocess.Popen(["./voerbak"],
@@ -38,6 +39,9 @@ class bord:
log.info(f"won: {buffer[2:].split('-')}")
elif buffer.startswith("e:"):
log.warning(buffer[2:])
+ elif buffer.startswith("m:"):
+ substr = buffer[2:]
+ self.player_1 = True if substr == "true" else False
buffer = self.get_output()
self.board = buffer
@@ -60,6 +64,7 @@ class bord:
def main():
gert = bord(7, 6)
while True:
+ print(gert.player_1)
if len(gert.win_positions) > 0:
print(f"won: {gert.win_positions}")
exit(0)