Sha256: 60603e589b7ba4367676858367f1f6058359f41f4cc69ee272e8563d9dbab995

Contents?: true

Size: 445 Bytes

Versions: 4

Compression:

Stored size: 445 Bytes

Contents

# frozen_string_literal: true

module Robot
  class Game
    attr_reader :input

    def initialize(input: $stdin)
      @input = input
    end

    def simulate
      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)
      game.simulate
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
robot_rea-0.1.9 lib/robot/game.rb
robot_rea-0.1.8 lib/robot/game.rb
robot_rea-0.1.7 lib/robot/game.rb
robot_rea-0.1.6 lib/robot/game.rb