Skip to content

Solution to the Robot Simulator challenge on CodeSubmit

License

Notifications You must be signed in to change notification settings

johnpitchko/robot-simulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Robot Simulator

This is my solution for the Robot Simulator challenge from CodeSubmit. The challenge was part of the interview process for a Senior Developer role at Thinking Capital.

Use this code as inspiration (as there are many potential solutions), but please do not plagiarise!

Copyright John Pitchko 2021

Brief

Write a robot simulator.

A robot factory's test facility needs a program to verify robot movements.

The robots have three possible movements:

  • turn right
  • turn left
  • advance

Robots are placed on a hypothetical infinite grid, facing a particular direction (north, east, south, or west) at a set of {x,y} coordinates, e.g., {3,8}, with coordinates increasing to the north and east.

The robot then receives a number of instructions, at which point the testing facility verifies the robot's new position, and in which direction it is pointing.

  • The letter-string "RAALAL" means:
    • Turn right
    • Advance twice
    • Turn left
    • Advance once
    • Turn left yet again
  • Say a robot starts at {7, 3} facing north. Then running this stream of instructions should leave it at {9, 4} facing west.

Running Tests

For running the tests provided, you will need the Minitest gem. Open a terminal window and run the following command to install minitest:

gem install minitest

If you would like color output, you can require 'minitest/pride' in the test file, or note the alternative instruction, below, for running the test file.

Run the tests from the root directory using the following command:

ruby robot_simulator_test.rb

To include color from the command line:

ruby -r minitest/pride robot_simulator_test.rb

Evaluation Criteria

  • Ruby best practices
  • Show us your work through your commit history
  • Completeness: did you complete the features? Are all the tests running?
  • Correctness: does the functionality act in sensible, thought-out ways?
  • Maintainability: is it written in a clean, maintainable way?

CodeSubmit

Please organize, design, and document your code as if it were going into production - then push your changes to the master branch. After you have pushed your code, you may submit the assignment on the assignment page.

All the best and happy coding,

The Thinking Capital Team

About

Solution to the Robot Simulator challenge on CodeSubmit

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages