Changeset 15
- Timestamp:
- 02/03/08 20:47:55 (4 years ago)
- Files:
-
- 1 modified
-
holdemtable.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
holdemtable.py
r14 r15 256 256 self.deferred = [] 257 257 self.blinds = blinds 258 self.__cached_response = None 258 259 259 260 … … 279 280 280 281 def genStatus(self, p_id): 281 root = {} 282 root["stat"] = "ok" 283 root["type"] = "game_state" 282 if self.__cached_response == None: 283 root = {} 284 root["stat"] = "ok" 285 root["type"] = "game_state" 286 287 table_info = {} 288 table_info["game_in_progress"] = self.game_started 289 table_info["name"] = self.name 290 table_info["blinds"] = self.blinds 291 292 players = {} 293 for (n,d) in self.players.items(): 294 players[n] = d.publicData() 295 table_info["players"] = players 296 root["table_info"] = table_info 297 298 if self.game_started: 299 root["game_state"] = self.game_state.getState() 300 self.__cached_response = root 301 302 copy = self.__cached_response.copy() 284 303 you = self.players[p_id].privateData() 285 304 … … 291 310 if req_action: you["possible_actions"] = self.game_state.possibleActions() 292 311 293 root["you"] = you 294 295 table_info = {} 296 table_info["game_in_progress"] = self.game_started 297 table_info["name"] = self.name 298 table_info["blinds"] = self.blinds 299 300 players = {} 301 for (n,d) in self.players.items(): 302 players[n] = d.publicData() 303 table_info["players"] = players 304 root["table_info"] = table_info 305 306 if self.game_started: 307 root["game_state"] = self.game_state.getState() 308 return root 312 copy["you"] = you 313 return copy 309 314 310 315 def action(self, p_id, action, value): … … 319 324 dl = self.deferred[:] 320 325 self.deferred = [] 326 self.__cached_response = None 321 327 for (p,d) in dl: 322 328 stat = self.genStatus(p)
