Class: Tictactoe::Players::PerfectComputer

Inherits:
Object
  • Object
show all
Defined in:
lib/tictactoe/players/perfect_computer.rb

Instance Method Summary collapse

Constructor Details

#initialize(mark, random = Random.new) ⇒ PerfectComputer



8
9
10
11
12
# File 'lib/tictactoe/players/perfect_computer.rb', line 8

def initialize(mark, random = Random.new)
  intelligence = Tictactoe::Ai::PerfectIntelligence.new
  chooser = Tictactoe::Ai::RandomChooser.new(random)
  self.player = Tictactoe::Players::Computer.new(mark, intelligence, chooser)
end

Instance Method Details

#get_move(state) ⇒ Object



14
15
16
# File 'lib/tictactoe/players/perfect_computer.rb', line 14

def get_move(state)
  player.get_move(state)
end

#markObject



18
19
20
# File 'lib/tictactoe/players/perfect_computer.rb', line 18

def mark
  player.mark
end

#ready_to_move?Boolean



22
23
24
# File 'lib/tictactoe/players/perfect_computer.rb', line 22

def ready_to_move?
  player.ready_to_move?
end