module Gobgems::WithColorOps
Public Instance Methods
count(color)
click to toggle source
# File lib/gobgems/board.rb, line 41 def count(color) head_cell[color] end
exist?(color)
click to toggle source
# File lib/gobgems/board.rb, line 45 def exist?(color) count(color) > 0 end
pop(color)
click to toggle source
# File lib/gobgems/board.rb, line 36 def pop(color) raise "#{color} Underflow" if head_cell[color] == 0 head_cell[color] -= 1 end
push(color, amount=1)
click to toggle source
# File lib/gobgems/board.rb, line 32 def push(color, amount=1) head_cell[color] += amount end