Class: Cell

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Cell

Returns a new instance of Cell.



8
9
10
11
12
13
# File 'lib/connect_four.rb', line 8

def initialize(args)
	@state = " " #available to have a move made in it.
	@row = args[:row] #set at initialization
	@column = args[:column] #set at initialization
	@search_paths = [] #will become set based on position on the board.
end

Instance Attribute Details

#columnObject (readonly)

Returns the value of attribute column.



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

def column
  @column
end

#rowObject (readonly)

Returns the value of attribute row.



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

def row
  @row
end

#search_pathsObject (readonly)

Returns the value of attribute search_paths.



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

def search_paths
  @search_paths
end

#stateObject

(e.g. empty, player1, player2)



6
7
8
# File 'lib/connect_four.rb', line 6

def state
  @state
end

Instance Method Details

#add_search_path(path) ⇒ Object



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

def add_search_path(path)
	@search_paths << path
end