Class: RubyGo::Stone
- Inherits:
-
Object
- Object
- RubyGo::Stone
- Defined in:
- lib/ruby-go/stone.rb
Direct Known Subclasses
Constant Summary collapse
- LETTERS =
('a'..'z').to_a
Instance Attribute Summary collapse
-
#color ⇒ Object
readonly
Returns the value of attribute color.
-
#x_coord ⇒ Object
readonly
Returns the value of attribute x_coord.
-
#y_coord ⇒ Object
readonly
Returns the value of attribute y_coord.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(x_coord, y_coord, color) ⇒ Stone
constructor
A new instance of Stone.
- #to_coord ⇒ Object
- #to_sgf ⇒ Object
Constructor Details
#initialize(x_coord, y_coord, color) ⇒ Stone
Returns a new instance of Stone.
7 8 9 10 11 |
# 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 |
Instance Attribute Details
#color ⇒ Object (readonly)
Returns the value of attribute color.
5 6 7 |
# File 'lib/ruby-go/stone.rb', line 5 def color @color end |
#x_coord ⇒ Object (readonly)
Returns the value of attribute x_coord.
5 6 7 |
# File 'lib/ruby-go/stone.rb', line 5 def x_coord @x_coord end |
#y_coord ⇒ Object (readonly)
Returns the value of attribute y_coord.
5 6 7 |
# File 'lib/ruby-go/stone.rb', line 5 def y_coord @y_coord end |
Instance Method Details
#==(other) ⇒ Object
27 28 29 30 31 |
# File 'lib/ruby-go/stone.rb', line 27 def ==(other) other.is_a?(Stone) && (color == other.color) && (to_coord == other.to_coord) end |
#empty? ⇒ Boolean
19 20 21 |
# File 'lib/ruby-go/stone.rb', line 19 def empty? false end |
#to_coord ⇒ Object
23 24 25 |
# File 'lib/ruby-go/stone.rb', line 23 def to_coord [x_coord, y_coord] end |