Class: MinimaxComputer

Inherits:
Object
  • Object
show all
Defined in:
lib/minimax_computer.rb

Instance Method Summary collapse

Constructor Details

#initialize(board, observer) ⇒ MinimaxComputer

Returns a new instance of MinimaxComputer.



3
4
5
6
# File 'lib/minimax_computer.rb', line 3

def initialize(board, observer)
  @game_board, @observer = board, observer
  @my_player_value = @game_board.player_value
end

Instance Method Details

#move(iteration = 0) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/minimax_computer.rb', line 8

def move(iteration = 0)
  if first_move?
    make_first_move
  else
    perform_mini_max(iteration)
  end
end