Skip to content

daniel-lanciana/robot-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Brief

A simulation of a toy robot moving on a square tabletop. Programming exercise for REA job application.

Running demo at: floating-cove-6107.herokuapp.com

Requirements

  • 5x5 table

  • No obstructions

  • Any movement resulting in the robot falling off the table are to be ignored. Further input accepted.

  • Commands: PLACE, MOVE, LEFT, RIGHT, REPORT

    • PLACE(X, Y, FACING) places the robot on the table facing the direction input

    • MOVE the robot 1 space forward

    • LEFT rotate the robot 90 degrees

    • RIGHT rototate the robot 90 degrees

    • REPORT announces the X, Y and direction the robot is facing

  • Origin position 0,0 the Southwest corner

  • Robot must be placed on the table

  • Ignore all commands until a valid PLACE command

  • Robot can be re-placed on the table

  • Input source developer’s choice (standard input, file etc.)

  • Graphical representation not required

Features

  • Web application!

    • Thread-safe (i.e. each session has it’s own state)

    • Actions call friendly URLs via AJAX

    • Deployed to the cloud (Heroku)

    • REA visuals

    • Chaos Robot! (similar to Chaos Monkey, randomly performs 10 actions)

  • Supports variable table dimensions

  • Full code comments, rdoc, static methods, removed unused autogenerated code

  • Skeleton for ability to add many robots to a table

    • Table aware of Robot(s)

    • Actions have placeholders for Robot IDs to diferentiate

  • For demonstration purposes only, monkey patched Array core class to demonstrate novel approach for rotation (LinkedList-type functionality instead of an easy switch statement)

    • Also patched the JavaScript Array object!

Development

  • Read up on Minitest v RSpec, decided to choose Minitest DSL with standard matchers/mocks for simplicity

    • Easy enough to leverage Mocha, Shoulda etc.

    • TDD unit & integration tests

    • One assertion per test

    • No parenthesis for cleaner readability

  • Input ignores case

Possible Improvements

  • Multiple robots on the table at once (although basic foundations of ID are in place)

  • Functional tests on the ad-hoc web components (view, thin controller)

  • Proper Javascript (module pattern, tests)

Resources

About

Homework task for a job application.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published