class RubyGo::Stone

Constants

LETTERS

Attributes

color[R]
x_coord[R]
y_coord[R]

Public Class Methods

new(x_coord, y_coord, color) click to toggle source
# File lib/ruby-go/stone.rb, line 7
def initialize(x_coord, y_coord, color)
  @x_coord = x_coord
  @y_coord = y_coord
  @color = color
end

Public Instance Methods

==(other) click to toggle source
# File lib/ruby-go/stone.rb, line 27
def ==(other)
  other.is_a?(Stone) &&
    (color == other.color) &&
    (to_coord == other.to_coord)
end
empty?() click to toggle source
# File lib/ruby-go/stone.rb, line 19
def empty?
  false
end
to_coord() click to toggle source
# File lib/ruby-go/stone.rb, line 23
def to_coord
  [x_coord, y_coord]
end
to_sgf() click to toggle source
# File lib/ruby-go/stone.rb, line 13
def to_sgf
  x = LETTERS[x_coord]
  y = LETTERS[y_coord]
  ";#{color.to_s[0].upcase}[#{x}#{y}]"
end