Class: TakaTicTacToe::Computer

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

Direct Known Subclasses

EasyAi, ImpossibleAi, MediumAi

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mark, opponent_mark) ⇒ Computer

Returns a new instance of Computer.



6
7
8
9
# File 'lib/taka_tic_tac_toe/computer.rb', line 6

def initialize(mark, opponent_mark)
  @mark = mark
  @opponent_mark = opponent_mark
end

Instance Attribute Details

#difficultyObject

Returns the value of attribute difficulty.



4
5
6
# File 'lib/taka_tic_tac_toe/computer.rb', line 4

def difficulty
  @difficulty
end

#markObject

Returns the value of attribute mark.



3
4
5
# File 'lib/taka_tic_tac_toe/computer.rb', line 3

def mark
  @mark
end

#opponent_markObject (readonly)

Returns the value of attribute opponent_mark.



4
5
6
# File 'lib/taka_tic_tac_toe/computer.rb', line 4

def opponent_mark
  @opponent_mark
end

Instance Method Details

#make_move(board) ⇒ Object



15
16
17
# File 'lib/taka_tic_tac_toe/computer.rb', line 15

def make_move(board)
  @difficulty.make_move(board)
end