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
20 21 22 23 24 |
# File 'lib/software_challenge_client/move.rb', line 20 def initialize(x, y) @x = x @y = y @hints = Array.new end |
Instance Attribute Details
#hints ⇒ Array<DebugHint> (readonly)
Returns the move’s hints.
14 15 16 |
# File 'lib/software_challenge_client/move.rb', line 14 def hints @hints end |
#x ⇒ Integer (readonly)
Returns x-coordinate.
8 9 10 |
# File 'lib/software_challenge_client/move.rb', line 8 def x @x end |
#y ⇒ Integer (readonly)
Returns y-coordinate.
11 12 13 |
# File 'lib/software_challenge_client/move.rb', line 11 def y @y end |
Instance Method Details
#==(another_move) ⇒ Object
50 51 52 |
# File 'lib/software_challenge_client/move.rb', line 50 def ==(another_move) return self.x == another_move.x && self.y == another_move.y end |
#addHint(string) ⇒ Object
adds a hint to the move
36 37 38 |
# File 'lib/software_challenge_client/move.rb', line 36 def addHint(hint) @hints.push(hint); end |
#to_s ⇒ Object
54 55 56 |
# File 'lib/software_challenge_client/move.rb', line 54 def to_s return "Move:(#{self.x},#{self.y})" end |