Module: Gobgems::Program

Includes:
Color, Direction
Defined in:
lib/gobgems/program.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Direction

all, east, north, south, west

Methods included from Color

all, black, blue, green, red

Instance Attribute Details

#boardObject

Returns the value of attribute board.



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

def board
  @board
end

Instance Method Details

#can_move?(direction) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/gobgems/program.rb', line 24

def can_move?(direction)
  board.can_move?(direction)
end

#count(color) ⇒ Object



28
29
30
# File 'lib/gobgems/program.rb', line 28

def count(color)
  board.count(color)
end

#exist?(color) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/gobgems/program.rb', line 20

def exist?(color)
  board.exists?(color)
end

#move(direction) ⇒ Object



8
9
10
# File 'lib/gobgems/program.rb', line 8

def move(direction)
  board.move(direction)
end

#pop(color) ⇒ Object



16
17
18
# File 'lib/gobgems/program.rb', line 16

def pop(color)
  board.pop(color)
end

#push(color) ⇒ Object



12
13
14
# File 'lib/gobgems/program.rb', line 12

def push(color)
  board.push(color)
end