Пример #1
0
 def __init__(self, board, cols, rows, firstmove, topleft):      
     self._board = board
     self._cols = cols
     self._rows = rows
     self._turn = firstmove
     self._topleft = topleft
     self._logicboard = gamecode._get_new_board(self._turn, self._cols, self._rows, self._topleft)
Пример #2
0
    def play_game():
        onemoretime = 'suppose_yes'
        while onemoretime:
            print(greeting)

            cols = _get_cols()
            rows = _get_rows()
            turn = _who_move_first()
            top_left_color = _which_color_on_top_left()
            board = gamecode._get_new_board(turn, cols, rows, top_left_color)
            game = Othello(turn, cols, rows, board)
            rule = _get_winning_rule()
            print('\nGame Starts!\n')

            Othello.take_turns(game)

            print('\nGame Ends!\n')

            winner = gamecode.choose_the_winner(game._turn, game._cols,
                                                game._rows, game._board, rule)
            print('The winner is(are): ' + winner + '\nCongratulations!')
            print('\nThanks for playing the game. Do you want to play again?')
            onemoretime = (input(
                'Press <ENTER> if you want to quit.\nOtherwise, press any key(s) on the keyboard.'
            ))
        print(ending)
Пример #3
0
 def __init__(self, board, cols, rows, firstmove, topleft):
     self._board = board
     self._cols = cols
     self._rows = rows
     self._turn = firstmove
     self._topleft = topleft
     self._logicboard = gamecode._get_new_board(self._turn, self._cols,
                                                self._rows, self._topleft)
Пример #4
0
    def play_game():
        onemoretime = 'suppose_yes'
        while onemoretime:
            print (greeting)
            
            cols = _get_cols()
            rows = _get_rows()
            turn = _who_move_first()
            top_left_color =  _which_color_on_top_left()
            board = gamecode._get_new_board(turn, cols, rows, top_left_color)
            game = Othello(turn, cols, rows, board)
            rule = _get_winning_rule()
            print ('\nGame Starts!\n')
            
            Othello.take_turns(game)

            print ('\nGame Ends!\n')
            
            winner = gamecode.choose_the_winner(game._turn, game._cols, game._rows, game._board, rule)
            print ('The winner is(are): '+ winner + '\nCongratulations!')
            print ('\nThanks for playing the game. Do you want to play again?')
            onemoretime = (input('Press <ENTER> if you want to quit.\nOtherwise, press any key(s) on the keyboard.'))
        print (ending)