Class: Cell
- Inherits:
-
Object
- Object
- Cell
- Defined in:
- lib/cell.rb
Instance Attribute Summary collapse
-
#piece ⇒ Object
readonly
Returns the value of attribute piece.
Instance Method Summary collapse
- #add_piece ⇒ Object
- #computer_add_piece ⇒ Object
- #empty? ⇒ Boolean
-
#initialize ⇒ Cell
constructor
A new instance of Cell.
Constructor Details
#initialize ⇒ Cell
Returns a new instance of Cell.
3 4 5 |
# File 'lib/cell.rb', line 3 def initialize @piece = "." end |
Instance Attribute Details
#piece ⇒ Object (readonly)
Returns the value of attribute piece.
2 3 4 |
# File 'lib/cell.rb', line 2 def piece @piece end |
Instance Method Details
#add_piece ⇒ Object
7 8 9 |
# File 'lib/cell.rb', line 7 def add_piece @piece = "X" end |
#computer_add_piece ⇒ Object
11 12 13 |
# File 'lib/cell.rb', line 11 def computer_add_piece @piece = "O" end |
#empty? ⇒ Boolean
15 16 17 |
# File 'lib/cell.rb', line 15 def empty? @piece == "." end |