module Robot

Factory class that takes a command input and returns the command object that can handle it, this is used instead of if/else or case/when for each command. If the command entered does not match any known command, the NoOp Command will be returned.

Point value object

Position value object

Constants

VERSION

Public Class Methods

instructions() click to toggle source
# File lib/robot.rb, line 18
  def self.instructions
    puts <<~HEREDOC
      Welcome to the Robot game
      Please enter one of the following commands:
      PLACE 0,0,NORTH (PLACE X,Y,DIRECTION)
      MOVE
      LEFT
      RIGHT
      REPORT

      invalid commands are ignored.
      You must start with a place command.
    HEREDOC
  end
run() click to toggle source
# File lib/robot.rb, line 13
def self.run
  instructions
  Game.()
end