|
12 | 12 | """ |
13 | 13 |
|
14 | 14 | import logging |
15 | | -import socketIO_client as io |
| 15 | +import socketIO_client_nexus as io |
16 | 16 |
|
17 | 17 | class Namespace(io.BaseNamespace): |
18 | 18 | """ |
@@ -47,8 +47,12 @@ def on_reconnect(self): |
47 | 47 | """ Handle reconnection event. """ |
48 | 48 | self.log.info('reconnected') |
49 | 49 |
|
| 50 | + def on_update(self, *args): |
| 51 | + """ Handle server 'update' event. """ |
| 52 | + self.on_sync(*args) |
| 53 | + |
50 | 54 | def on_sync(self, *args): |
51 | | - """ Handle serve 'sync' event. """ |
| 55 | + """ Handle server 'sync' event. """ |
52 | 56 | game_id = args[0] |
53 | 57 | state = args[1] |
54 | 58 | state_id = state['_stateID'] |
@@ -77,7 +81,7 @@ def on_sync(self, *args): |
77 | 81 | # pop next action |
78 | 82 | action = self.actions.pop(0) |
79 | 83 | self.log.info('sent action: %s', action['payload']) |
80 | | - self.emit('action', action, state_id, game_id, |
| 84 | + self.emit('update', action, state_id, game_id, |
81 | 85 | self.bot.player_id) |
82 | 86 |
|
83 | 87 |
|
@@ -144,11 +148,11 @@ def think(self, _G, _ctx): |
144 | 148 | To be overridden by the user. |
145 | 149 | Shall return a list of actions, instantiated with make_move(). |
146 | 150 | """ |
147 | | - assert False |
| 151 | + raise NotImplementedError |
148 | 152 |
|
149 | 153 | def gameover(self, _G, _ctx): |
150 | 154 | """ |
151 | 155 | To be overridden by the user. |
152 | 156 | Shall handle game over. |
153 | 157 | """ |
154 | | - assert False |
| 158 | + raise NotImplementedError |
0 commit comments