Пример #1
0
def test_White_Queen_Castle():
    """Tests if White pieces can do Queen side castle
    """
    myGame = Game()

    def move(x, moveOne, moveTwo):
        x.board[x.possibleRow[int(
            moveOne[0])]][x.possibleCol[moveOne[1]]].move(
                int(moveTwo[0]), moveTwo[1])

    king = myGame.board[7][4]
    rook = myGame.board[7][0]
    move(myGame, "7D", "5D")
    move(myGame, "8D", "6D")
    move(myGame, "8C", "7D")
    move(myGame, "8B", "6A")
    myGame.attemptQueenCastle(not myGame.playerOneTurn)
    assert king == myGame.board[7][2]
    assert rook == myGame.board[7][3]
Пример #2
0
def test_Queen_Castle():
    """Tests Queen Side Castle
    """
    myGame = Game()

    def move(x, moveOne, moveTwo):
        x.board[x.possibleRow[int(
            moveOne[0])]][x.possibleCol[moveOne[1]]].move(
                int(moveTwo[0]), moveTwo[1])

    king = myGame.board[0][4]
    rook = myGame.board[0][0]
    move(myGame, "2D", "4D")
    move(myGame, "1D", "3D")
    move(myGame, "1C", "3E")
    move(myGame, "1B", "3A")
    myGame.attemptQueenCastle(myGame.playerOneTurn)
    assert king == myGame.board[0][2]
    assert rook == myGame.board[0][3]