def main():
    '''Game function. '''

    connection = inputs.prin()

    column = connection[0]
    row = connection[1]
    turn = connection[2]
    top = connection[3]
    win = connection[4]

    board = state.makeNewBoard(row, column)
    state.get_board(board, row, column, top)
    while True:
        if turn == 'black':
            symbol = 'B'
            print_board
            (board, row)
            scores = state.show_scores(board, row, column)
            print('Black: {}; White: {}'.format(scores[0], scores[1]))
            print("\nIt is {}'s turn, {} is '{}'.".format(
                'Black', 'Black', symbol))
            move = every_move(board, symbol, row, column)
            print('Your move is at {}.'.format(state.tell_move(move)))
            state.MakeMove(board, symbol, row,
                           column).make_move_for_board(move[0], move[1])
            if state.check_score(state.show_scores(board, row,
                                                   column)) != (row * column):
                if state.MakeMove(board, 'W', row, column).Flip_pieces() == []:
                    print("!!White has no where to move; it's black turn!!")
                    turn = 'black'
                else:
                    turn = 'white'
            else:
                break
        else:
            symbol = 'W'
            print_board(board, row)
            scores = state.show_scores(board, row, column)
            print('Black: {}; White: {}'.format(scores[0], scores[1]))
            print("\nIt is {}'s turn, {} is '{}'.".format(
                'White', 'White', symbol))
            move = every_move(board, symbol, row, column)
            print('Your move is at {}.'.format(state.tell_move(move)))
            state.MakeMove(board, symbol, row,
                           column).make_move_for_board(move[0], move[1])
            if state.check_score(state.show_scores(board, row,
                                                   column)) != (row * column):
                if state.MakeMove(board, 'B', row, column).Flip_pieces() == []:
                    print("!!Black has no where to move; it's white turn!!")
                    turn = 'white'
                else:
                    turn = 'black'
            else:
                break

    print_board(board, row)
    scores = state.show_scores(board, row, column)
    print('Black: {}; White: {}'.format(scores[0], scores[1]))
    who_won(scores, win)
def main(
    board,
    turn,
    row,
    column,
):
    while True:
        if turn == 'black':
            symbol = 'B'
            print(board)
            ##            scores = state.show_scores(board, row, column)
            ##            print('Black: {}; White: {}'.format(scores[0],scores[1]))
            ##            print("\nIt is {}'s turn, {} is '{}'.".format('Black','Black',symbol))
            ##            move = every_move(board, symbol, row, column)
            ##            print('Your move is at {}.'.format(state.tell_move(move)))
            ##            state.MakeMove(board,symbol, row, column).make_move_for_board(move[0],move[1])
            if state.check_score(state.show_scores(board, row,
                                                   column)) != (row * column):
                if state.MakeMove(board, 'W', row, column).Flip_pieces() == []:
                    print("!!White has no where to move; it's black turn!!")
                    turn = 'black'
                else:
                    turn = 'white'
            else:
                break
        else:
            symbol = 'W'
            print(board)
            ##            scores = state.show_scores(board, row, column)
            ##            print('Black: {}; White: {}'.format(scores[0],scores[1]))
            ##            print("\nIt is {}'s turn, {} is '{}'.".format('White','White',symbol))
            ##            move = every_move(board, symbol, row, column)
            ##            print('Your move is at {}.'.format(state.tell_move(move)))
            ##            state.MakeMove(board,symbol, row, column).make_move_for_board(move[0],move[1])
            if state.check_score(state.show_scores(board, row,
                                                   column)) != (row * column):
                if state.MakeMove(board, 'B', row, column).Flip_pieces() == []:
                    print("!!Black has no where to move; it's white turn!!")
                    turn = 'white'
                else:
                    turn = 'black'
            else:
                break

    print(board)
    scores = state.show_scores(board, row, column)
    who_won(scores, win)
예제 #3
0
def main():
    '''Game function. '''
    while True:
        connection = inputs.check_input()
        if connection == False:
            continue
        else:
            break

    print('\nColumn: {}'.format(connection[0]),
          '\nRow: {}'.format(connection[1]),
          '\nFirst Turn: {}'.format(connection[2]),
          '\nWB Setting: {}'.format(connection[3]),
          '\nWin by: {}\n'.format(connection[4]))

    column = connection[0]
    row = connection[1]
    turn = connection[2]
    top = connection[3]
    win = connection[4]

    board = state.makeNewBoard(row, column)
    state.get_board(board, row, column, top)

    while True:
        if turn == 'black':
            symbol = 'B'
            ##            print_board(board, row)
            ##            print(BoardCopy.BoardApplication(column,row, top)._on_mouse_click())

            ##            scores = state.show_scores(board, row, column)
            ##            print('Black: {}; White: {}'.format(scores[0],scores[1]))
            print("\nIt is {}'s turn, {} is '{}'.".format(
                'Black', 'Black', symbol))
            move = every_move(board, symbol, row, column, top)
            print('Your move is at {}.'.format(state.tell_move(move)))
            state.MakeMove(board, symbol, row,
                           column).make_move_for_board(move[0], move[1])
            if state.check_score(state.show_scores(board, row,
                                                   column)) != (row * column):
                if state.MakeMove(board, 'W', row, column).Flip_pieces() == []:
                    print("!!White has no where to move; it's black turn!!")
                    turn = 'black'
                else:
                    turn = 'white'
            else:
                break
        else:
            symbol = 'W'
            ##            print_board(board, row)
            ##            scores = state.show_scores(board, row, column)
            ##            print('Black: {}; White: {}'.format(scores[0],scores[1]))
            print("\nIt is {}'s turn, {} is '{}'.".format(
                'White', 'White', symbol))
            move = every_move(board, symbol, row, column, top)
            print('Your move is at {}.'.format(state.tell_move(move)))
            state.MakeMove(board, symbol, row,
                           column).make_move_for_board(move[0], move[1])
            if state.check_score(state.show_scores(board, row,
                                                   column)) != (row * column):
                if state.MakeMove(board, 'B', row, column).Flip_pieces() == []:
                    print("!!Black has no where to move; it's white turn!!")
                    turn = 'white'
                else:
                    turn = 'black'
            else:
                break

    print_board(board, row)
    scores = state.show_scores(board, row, column)
    print('Black: {}; White: {}'.format(scores[0], scores[1]))
    who_won(scores, win)