Module: Robot
- Defined in:
- lib/robot/point.rb,
lib/robot.rb,
lib/robot/game.rb,
lib/robot/table.rb,
lib/robot/version.rb,
lib/robot/position.rb,
lib/robot/directions.rb,
lib/robot/command_proxy.rb,
lib/robot/commands/base.rb,
lib/robot/commands/left.rb,
lib/robot/commands/move.rb,
lib/robot/commands/no_op.rb,
lib/robot/commands/place.rb,
lib/robot/commands/right.rb,
lib/robot/commands/report.rb,
lib/robot/commands/factory.rb,
lib/robot/commands/place_command_parser.rb
Overview
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.
Defined Under Namespace
Modules: Commands, Directions Classes: CommandProxy, Game, Point, Position, Table
Constant Summary collapse
- VERSION =
'0.1.9'
Class Method Summary collapse
Class Method Details
.instructions ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# 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 ⇒ Object
13 14 15 16 |
# File 'lib/robot.rb', line 13 def self.run instructions Game.() end |