lib/robot/game.rb in robot_rea-0.1.5 vs lib/robot/game.rb in robot_rea-0.1.6

- old
+ new

@@ -1,40 +1,23 @@ +# frozen_string_literal: true + module Robot class Game attr_reader :input def initialize(input: $stdin) @input = input end def simulate - while command = input.gets + while (command = input.gets) command = command.chomp @position = Robot::CommandProxy.new(command_string: command, position: @position).call end end def self.call(input: $stdin) game = new(input: input) - instruction game.simulate end - - def self.instruction - 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 end end - - -