Class: Cell

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCell

Returns a new instance of Cell.



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

def initialize
  @piece = "."
end

Instance Attribute Details

#pieceObject (readonly)

Returns the value of attribute piece.



2
3
4
# File 'lib/cell.rb', line 2

def piece
  @piece
end

Instance Method Details

#add_pieceObject



7
8
9
# File 'lib/cell.rb', line 7

def add_piece
  @piece = "X"
end

#computer_add_pieceObject



11
12
13
# File 'lib/cell.rb', line 11

def computer_add_piece
  @piece = "O"
end

#empty?Boolean

Returns:

  • (Boolean)


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

def empty?
  @piece == "."
end