Coder Social home page Coder Social logo

extendedtr's Introduction

ToyRobot

The Toy Robot is based on a blog post by Jon Eaves. Read it here https://joneaves.wordpress.com/2014/07/21/toy-robot-coding-test/

It's a common test used by a few different Melbourne based companies, and for got reason. It's simple and can be completed in a reasonable time frame, but is also fairly flexible and open ended in the way a developer can approach it. Because of this, you can gain great insight into how the developer thinks about code. Do they consider the problem domain in their code? Do they correctly use design patterns? Are they a functional or object-oriented programmer? Do they over-engineer or practice YAGNI?

The Toy Robot also provides a great starting point for an in-interview pairing exercise. Candidates can work on code they are familiar with, which helps with creating a flowing pairing session in a limited time window.

Usage

Prerequisites

  • Create a virtual environment
python -m venv venv
  • Activate the virtual environment
venv\Scripts\activate
  • Install requirements
pip install -r requirements.txt

Running the application

python main.py <filename>

Extending the solution

Make the table size configurable

Command:

TABLE <columns>x<rows>

Caveats

  • This should be in either the first or second line of the file input
  • If not, this command will be ignored and the table size will be set to 5x5

Add 2 (or n) robots on the table

Command:

ROBOTS <num>

Caveats

  • This should be in either the first or second line of the file input
  • If not, this command will be ignored and the robot number is set to 1 by default
  • The commands "MOVE", "LEFT", "RIGHT", and "REPORT" will require and id
MOVE 1
LEFT 2
RIGHT 1
REPORT 1

Multiple places, multiple robots

Consider the commands below:

ROBOTS 2
PLACE 1,2,NORTH
PLACE 1,3,NORTH
PLACE 1,3,NORTH
PLACE 1,4,NORTH
PLACE 1,4,NORTH
REPORT 1
REPORT 2

The result is

1,4,NORTH
1,3,NORTH

Why?

  1. first place command is for robot 1 (PLACE 1,2,NORTH)
  2. second place command is for robot 2 (PLACE 1,3,NORTH)
  3. third place command is for robot 1 again, but this fails due to collision with robot 2 and is ignored. (PLACE 1,3,NORTH)
  4. fourth place command is still for robot 1 because the place command prior failed. (PLACE 1,4,NORTH)
  5. ce the fourth place command did not fail, the next one is for robot 2, but this one is ignored due to failing and robot 2 retains its position. (PLACE 1,4,NORTH)

So the place commands alternate between the multiple robots, but stays with a robot if it fails.

extendedtr's People

Contributors

katdom13 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.