Exemplo n.º 1
0
def runUserInterface() -> None:
	'''
	Runs user interface
	'''
	print('FULL')
	rows = int(input())
	columns = int(input())
	startingPlayer = input()
	startingOrientation = input()
	wayToWin = input()
	othello = Othello_logic.GameState(rows, columns, 
		startingPlayer, startingOrientation, wayToWin)
	othello.createBoard()
	while True:
		playerTiles = othello.checkNumTiles()
		print('B: {}  W: {}'.format(othello.blackPieces, othello.whitePieces))
		othello.printBoard()
		if othello.turn == 1:
			turn = 'B'
			print('TURN: {}'.format(turn))
		else:
			turn = 'W'
			print('TURN: {}'.format(turn))
		playerMove(othello)
		if othello.isGameOver() == True:
			break
	determineWinner(othello)
Exemplo n.º 2
0
    def _on_start_press(self) -> None:
        dialog = GameSpecDialog()
        dialog.run()
        if dialog._was_ok_clicked() == True:
            self._canvas.delete(tkinter.ALL)
            rows = int(dialog._get_num_rows())
            columns = int(dialog._get_num_columns())
            starting_player = dialog._get_starting_player()
            starting_orientation = dialog._get_starting_position()
            win_type = dialog._get_way_to_win()

            self._othello_state = Othello_logic.GameState(
                rows, columns, starting_player, starting_orientation, win_type)
            self._othello_state.createBoard()
            self._draw_board()
            self._show_turn()
            self._show_pieces()
            self._draw_circles()