Sha256: dfa5be3467b37c03905ebcde4a3b000f9c0fac7177caf9b45d44c42a99810d6d

Contents?: true

Size: 1.26 KB

Versions: 1

Compression:

Stored size: 1.26 KB

Contents

require_relative 'debug_hint'

# @author Ralf-Tobias Diekert
# A move, that can be performed in twixt
class Move
  # @!attribute [r] x
  # @return [Integer] x-coordinate
  attr_reader :x
  # @!attribute [r] y
  # @return [Integer] y-coordinate
  attr_reader :y
  # @!attribute [r] hints
  # @return [Array<DebugHint>] the move's hints
  attr_reader :hints
  
  # Initializer
  # 
  # @param x [Integer] x-coordinate
  # @param y [Integer] y-coordinate
  def initialize(x, y)
    @x = x
    @y = y
    @hints = Array.new
  end
  
  # @overload addHint(hint)
  # adds a hint to the move
  # @param hint [DebugHint] the added hint
  # @overload addHint(key, value)
  # adds a hint to the move
  # @param key the added hint's key
  # @param value the added hint's value
  # @overload addHint(string)
  # adds a hint to the move
  # @param hint [String] the added hint's content
  def addHint(hint)
    @hints.push(hint);
  end
  
  # adds a hint to the move
  def addHint(key, value)
    self.addHint(DebugHint.new(key, value))
  end
  
  # adds a hint to the move
  def addHint(string)
    self.addHint(DebugHint.new(string))
  end
  
  def ==(another_move)
    return self.x == another_move.x && self.y == another_move.y
  end

  def to_s
    return "Move:(#{self.x},#{self.y})"
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
software_challenge_client-0.1.0 lib/software_challenge_client/move.rb