Ejemplo n.º 1
0
 def do_action(player, players):
     state = pickle.loads(room.game_state)
     if state["current_player"] != player["current_player"]:
         return HttpResponseForbidden()
     try:
         MainLogic.do_move(state, int(request.POST['piece_number']))
     except MoveNotValidException:
         print("%s: Invalid move" % player["who"])
         return HttpResponseForbidden()
     else:
         gp.invalidate_players(players, player)
         print(state)
         print(change_to_drawable(state, None, None))
         return gp.set_new_state(room, state, change_to_drawable)
Ejemplo n.º 2
0
 def do_action(player, players):
     gp.invalidate_players(players)
     print(new_state)
     return gp.set_new_state(room, new_state, change_to_drawable, player, players)