Esempio n. 1
0
def main():
    game = Chess()
    player1 = Player(COLOR.white)
    player2 = Player(COLOR.black)
    game.add_player(player1)
    game.add_player(player2)
    game.start()

    test_check(game)
Esempio n. 2
0
def main():
    game = Chess()
    player1 = Player(COLOR.white)
    player2 = Player(COLOR.black)
    game.add_player(player1)
    game.add_player(player2)
    game.start()

    test_pawn(game)
    test_rook(game)
    test_bishop(game)
    test_queen(game)
    test_king(game)
    test_knight(game)
    test_promoted_queen(game)
    test_players(player1, player2)
Esempio n. 3
0
def main():
    game = Chess()
    player1 = Player(COLOR.white)
    player2 = Player(COLOR.black)
    game.add_player(player1)
    game.add_player(player2)
    game.start()

    player1.game.turn = player1.color
    players = [player1, player2]

    turn = 0
    while True:
        try:
            os.system('clear')
            player = players[turn]
            print(player.game)
            player.move(*input(f'{player.color.name} move: ').split())
            turn = not turn
        except Exception as e:
            os.system('clear')
            print(f'{e.__class__.__name__}: {e}')
            input('Press return to continue...')
            continue