コード例 #1
0
def _score_board(game: Othello) -> None:
    """
    This function prints out the score board with the current player.
    :rtype : None
    :param game: Othello
    """
    blackscore = 'Black:  ' + str(game.black_score())
    whitescore = "White:  " + str(game.white_score())
    print()
    print(''.center(50, '-'))
    print('|' + blackscore.center(24, ' ') + whitescore.center(24, ' ') + '|')
    if game.current_player() == Othello.BLACK:
        print('|' + "Black's turn".center(48, ' ') + '|')
    else:
        print('|' + "White's turn".center(48, ' ') + '|')
    print(''.center(50, '-'))
コード例 #2
0
def _win_board(game: Othello) -> None:
    """
    This function prints out the winner (or Tie) and the scores.
    :rtype : None
    :param game: Othello
    """
    blackscore = 'Black:  ' + str(game.black_score())
    whitescore = "White:  " + str(game.white_score())
    winner = game.win_result()
    print()
    print(''.center(50, '-'))
    print('|' + blackscore.center(24, ' ') + whitescore.center(24, ' ') + '|')
    if winner == Othello.BLACK:
        print('|' + "Black Won!".center(48, ' ') + '|')
    elif winner == Othello.WHITE:
        print('|' + "White Won!".center(48, ' ') + '|')
    elif winner == 'Tie':
        print('|' + "Tie!".center(48, ' ') + '|')
    print(''.center(50, '-'))