示例#1
0
def game_setup():
    chess_board = ChessBoard()
    chess_board.create_board()
    # print(chess_board.get_board())
    move = PawnMovementLogic(chess_board.get_board(), 1, 2, 3, 2,
                             ChessBoard.PLAYER_ONE_INDICATOR, True)
    move.move_pawn()
    move = PawnMovementLogic(chess_board.get_board(), 6, 3, 5, 3,
                             ChessBoard.PLAYER_TWO_INDICATOR, True)
    move.move_pawn()
    move = PawnMovementLogic(chess_board.get_board(), 3, 2, 4, 2,
                             ChessBoard.PLAYER_ONE_INDICATOR, False)
    move.move_pawn()
    print("here_1")
    move = PawnMovementLogic(chess_board.get_board(), 5, 3, 4, 2,
                             ChessBoard.PLAYER_TWO_INDICATOR, False)
    move.capture_piece()
示例#2
0
文件: test.py 项目: we3x/chess-rec
          [0, 0, 0, 2, 6, 0, 0, 0], [0, 0, 2, 0, 0, 0, 0, 0],
          [6, 6, 6, 0, 3, 6, 6, 6], [1, 0, 3, 5, 4, 0, 0, 1]]

board4 = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1],
          [0, 0, 0, 0, 0, -5, 0, -4], [0, 0, 0, 5, 0, 0, 2, 0],
          [0, 0, 0, -6, 0, 0, 0, 0], [6, 6, 0, 0, 0, -6, 6, 6],
          [0, 0, 0, 0, 0, -2, 0, 4], [0, 0, 0, 0, -1, 0, 0, 0]]

board5 = [[0, 0, 0, -5, -2, -1, -4, 0], [0, 0, 0, -1, -3, -6, -6, -6],
          [-6, -6, -2, -6, -6, 0, 0, 0], [0, 0, 0, 0, 0, 0, 2, 0],
          [0, 0, 6, 0, 2, 5, 0, 0], [0, 6, 0, 0, 0, 0, 6, 0],
          [6, 3, 0, 0, 6, 6, 4, 6], [0, 0, 1, 1, 0, 0, 0, 0]]

print('test1')
board = ChessBoard('./images/tests/1.png')
npt.assert_equal(board1, board.get_board())

print('test2')
board = ChessBoard('./images/tests/2.png')
npt.assert_equal(board2, board.get_board())

print('test3')
board = ChessBoard('./images/tests/3.png')
npt.assert_equal(board3, board.get_board())

print('test4')
board = ChessBoard('./images/tests/4.png')
npt.assert_equal(board4, board.get_board())

print('test5')
board = ChessBoard('./images/tests/5.png')
示例#3
0
def main():
    board = ChessBoard('./images/tests/2.png')
    for column in board.get_board():
        print(column)