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():
    '''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 _on_start(self):
        while True:
            dialog = inputs.APP()
            dialog.show()

            if dialog.ok_clicked():
                self._column = dialog.column_width()
                self._row = dialog.row_height()
                self._first_move = dialog.First_Move()
                self._top_setting = dialog.TopSetting()
                self._how_to_win = dialog.HowToWIN()

                connection = inputs.check_input([
                    self._column, self._row, self._first_move,
                    self._top_setting, self._how_to_win
                ])
                if connection == False:
                    self._message.set('Invalid Inputs')
                    continue
                else:
                    self._column = connection[0]
                    self._row = connection[1]
                    self._first_move = connection[2]
                    self._top_setting = connection[3]
                    self._how_to_win = connection[4]
                    self._message.set('Good Inputs')
                    break
            elif dialog.cancel_clicked():
                self._message.set('Invalid Inputs')
                return None
                break

##            else:
##                pass
##            connection = inputs.check_input([self._column, self._row, self._first_move, self._top_setting, self._how_to_win])
##            if connection == False:
##                continue
##            else:
##                self._column = connection[0]
##                self._row = connection[1]
##                self._first_move = connection[2]
##                self._top_setting = connection[3]
##                self._how_to_win = connection[4]
##                break

        print(self._column, self._row, self._first_move, self._top_setting,
              self._how_to_win)

        self._board = state.makeNewBoard(self._row, self._column)
        state.get_board(self._board, self._row, self._column,
                        self._top_setting)
        print(self._board)
        self._redraw()
    def _on_start(self):
        while True:
            dialog = inputs.APP()
            dialog.show()
            
            if dialog.ok_clicked():
                self._column = dialog.column_width()
                self._row = dialog.row_height()
                self._first_move = dialog.First_Move()
                self._top_setting = dialog.TopSetting()
                self._how_to_win = dialog.HowToWIN()

                connection = inputs.check_input([self._column, self._row, self._first_move, self._top_setting, self._how_to_win])
                if connection == False:
                    self._message.set('Invalid Inputs')
                    continue
                else:
                    self._column = connection[0]
                    self._row = connection[1]
                    self._first_move = connection[2]
                    self._top_setting = connection[3]
                    self._how_to_win = connection[4]
                    self._message.set('Good Inputs')
                    break
            elif dialog.cancel_clicked():
                self._message.set('Invalid Inputs')
                return None
                break
            
##            else:
##                pass
##            connection = inputs.check_input([self._column, self._row, self._first_move, self._top_setting, self._how_to_win])
##            if connection == False:
##                continue
##            else:
##                self._column = connection[0]
##                self._row = connection[1]
##                self._first_move = connection[2]
##                self._top_setting = connection[3]
##                self._how_to_win = connection[4]
##                break
        
        print(self._column, self._row, self._first_move, self._top_setting, self._how_to_win)

    
        self._board = state.makeNewBoard(self._row, self._column)
        state.get_board(self._board, self._row, self._column, self._top_setting)
        print(self._board)
        self._redraw()
Пример #5
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)
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)