Exemplo n.º 1
0
 def test_moves(self):
     board = mv.create_board(4)
     board[1][1] = 2
     board[1][3] = 2
     board[2][2] = 2
     board[3][1] = 2
     newboard = mv.next_board(board, False, False)["newboard"]
     self.assertEqual(newboard[1][0], 4)
     self.assertEqual(newboard[2][0], 2)
     self.assertEqual(newboard[3][0], 2)
 def test_moves(self):
     board = mv.create_board(4)
     board[1][1] = 2
     board[1][3] = 2
     board[2][2] = 2
     board[3][1] = 2
     newboard = mv.next_board(board, False, False)["newboard"]
     self.assertEqual(newboard[1][0], 4)
     self.assertEqual(newboard[2][0], 2)
     self.assertEqual(newboard[3][0], 2)
def newGame(user):
    board = move_logic.create_board(move_logic.size)
    board[1][1] = 1
    move = Move(
            belongs_to = None,
            moveNumber = 1,
            board = move_logic.serialize_board(board),
            serverSecret = "0",
            serverSecretHashed = "0",
            clientSecret = "0",
            clientSecretHashed = "0"
            )
    move.save()
    game = Game(
            gameid = rand256hex(),
            belongs_to = user,
            gameover = False,
            lastMove = move
            )
    game.save()
    move.belongs_to = game
    move.save()
    return game