Class: Move
- Inherits:
-
Object
- Object
- Move
- Defined in:
- lib/software_challenge_client/move.rb
Overview
A move, that can be performed in twixt
Instance Attribute Summary collapse
-
#hints ⇒ Array<DebugHint>
readonly
The move’s hints.
-
#x ⇒ Integer
readonly
X-coordinate.
-
#y ⇒ Integer
readonly
Y-coordinate.
Instance Method Summary collapse
- #==(another_move) ⇒ Object
-
#addHint(string) ⇒ Object
adds a hint to the move.
-
#initialize(x, y) ⇒ Move
constructor
Initializer.
- #to_s ⇒ Object
Constructor Details
#initialize(x, y) ⇒ Move
Initializer
21 22 23 24 25 |
# File 'lib/software_challenge_client/move.rb', line 21 def initialize(x, y) @x = x @y = y @hints = Array.new end |
Instance Attribute Details
#hints ⇒ Array<DebugHint> (readonly)
Returns the move’s hints.
15 16 17 |
# File 'lib/software_challenge_client/move.rb', line 15 def hints @hints end |
#x ⇒ Integer (readonly)
Returns x-coordinate.
9 10 11 |
# File 'lib/software_challenge_client/move.rb', line 9 def x @x end |
#y ⇒ Integer (readonly)
Returns y-coordinate.
12 13 14 |
# File 'lib/software_challenge_client/move.rb', line 12 def y @y end |
Instance Method Details
#==(another_move) ⇒ Object
51 52 53 |
# File 'lib/software_challenge_client/move.rb', line 51 def ==(another_move) return self.x == another_move.x && self.y == another_move.y end |
#addHint(string) ⇒ Object
adds a hint to the move
37 38 39 |
# File 'lib/software_challenge_client/move.rb', line 37 def addHint(hint) @hints.push(hint); end |
#to_s ⇒ Object
55 56 57 |
# File 'lib/software_challenge_client/move.rb', line 55 def to_s return "Move:(#{self.x},#{self.y})" end |