Class: TakaTicTacToe::Computer
- Inherits:
-
Object
- Object
- TakaTicTacToe::Computer
- Defined in:
- lib/taka_tic_tac_toe/computer.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#difficulty ⇒ Object
Returns the value of attribute difficulty.
-
#mark ⇒ Object
Returns the value of attribute mark.
-
#opponent_mark ⇒ Object
readonly
Returns the value of attribute opponent_mark.
Instance Method Summary collapse
-
#initialize(mark, opponent_mark) ⇒ Computer
constructor
A new instance of Computer.
- #make_move(board) ⇒ Object
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
#difficulty ⇒ Object
Returns the value of attribute difficulty.
4 5 6 |
# File 'lib/taka_tic_tac_toe/computer.rb', line 4 def difficulty @difficulty end |
#mark ⇒ Object
Returns the value of attribute mark.
3 4 5 |
# File 'lib/taka_tic_tac_toe/computer.rb', line 3 def mark @mark end |
#opponent_mark ⇒ Object (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 |