module Stones::WithStones
Public Instance Methods
clear!()
click to toggle source
# File lib/stones/board/with_stones.rb, line 12 def clear! @cells = self.class.empty_cells(*size) end
count(color)
click to toggle source
# File lib/stones/board/with_stones.rb, line 16 def count(color) head_cell[color] end
exist?(color)
click to toggle source
# File lib/stones/board/with_stones.rb, line 20 def exist?(color) count(color) > 0 end
pop!(color)
click to toggle source
# File lib/stones/board/with_stones.rb, line 7 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/stones/board/with_stones.rb, line 3 def push!(color, amount=1) head_cell[color] += amount end