@@ -50,10 +50,10 @@ def _transfer_stake(hex_message, multiplier=1):
50
50
51
51
def check_end_of_game (hex_message ):
52
52
if strategy .check_win (hex_message ):
53
- hex_message = coder .update_game_position (hex_message , 3 )
53
+ hex_message = coder .update_game_position (hex_message , 2 )
54
54
return transfer_double_stake (hex_message )
55
55
if strategy .check_draw (hex_message ):
56
- hex_message = coder .update_game_position (hex_message , 4 )
56
+ hex_message = coder .update_game_position (hex_message , 3 )
57
57
return transfer_stake (hex_message )
58
58
return transfer_double_stake (hex_message )
59
59
@@ -78,10 +78,6 @@ def play_cross_move(hex_message):
78
78
return coder .update_crosses (hex_message , crosses )
79
79
80
80
81
- def from_resting (_hex_message ):
82
- return [coder .update_noughts , transfer_stake , play_cross_move , coder .change_game_position ]
83
-
84
-
85
81
def from_oplay (_hex_message ):
86
82
return [play_cross_move ,
87
83
lambda h_message : coder .change_game_position (h_message , - 1 ), check_end_of_game ]
@@ -95,19 +91,29 @@ def from_victory(hex_message):
95
91
if not coder .get_state_balance (hex_message , 0 ) or not coder .get_state_balance (hex_message , 1 ):
96
92
wallet .clear_wallet_channel (hex_message , g .bot_addr )
97
93
return [coder .conclude ]
98
- return [coder .new_game ]
94
+ return [coder .play_again_me_first ]
99
95
100
96
101
97
def from_draw (_hex_message ):
102
- return [coder .new_game ]
98
+ return [coder .play_again_me_first ]
99
+
100
+
101
+ def from_play_again_me_first (_hex_message ):
102
+ return [coder .change_game_position ]
103
+
104
+
105
+ def from_play_again_me_second (_hex_message ):
106
+ return [coder .update_noughts , transfer_stake , play_cross_move ,
107
+ lambda h_message : coder .update_game_position (h_message , 0 )]
103
108
104
109
105
110
GAME_STATES = (
106
- from_resting ,
107
111
from_xplay ,
108
112
from_oplay ,
109
113
from_victory ,
110
114
from_draw ,
115
+ from_play_again_me_first ,
116
+ from_play_again_me_second ,
111
117
)
112
118
113
119
0 commit comments