File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 5
5
for the Hex board game.
6
6
"""
7
7
8
-
9
8
import asyncio
10
9
import sys
11
10
import hexgui
@@ -32,6 +31,8 @@ def game_client(loop, state):
32
31
print ("Connected to the game server" )
33
32
sys .stdout .flush ()
34
33
state [0 ] = INIT_STATE
34
+ player = 2
35
+ init = 0
35
36
while state [0 ] not in (END_STATE , CONNECTION_REFUSED ):
36
37
if state [0 ] == INIT_STATE :
37
38
data = yield from reader .readline ()
@@ -53,6 +54,9 @@ def game_client(loop, state):
53
54
hexboard = hexgame .Hex .create_from_str (message [5 :])
54
55
hexgui .redraw (hexboard )
55
56
hexgui .set_title ("hexgui.Hex game - your turn" )
57
+ if init == 0 and "1" not in message :
58
+ player = 1
59
+ init = 1
56
60
print (message )
57
61
if message .startswith ("End" ):
58
62
state [0 ] = END_STATE
@@ -86,6 +90,7 @@ def game_client(loop, state):
86
90
state [0 ] = PLAYING
87
91
sys .stdout .flush ()
88
92
if state [0 ] == END_STATE :
93
+ print ("Joueur :" + str (player ))
89
94
print ("{} wins the game" .format (hexgui .player_names [hexboard .winner ]))
90
95
writer .close ()
91
96
You can’t perform that action at this time.
0 commit comments