Code Monkey home page Code Monkey logo

code-test-robot-php's Introduction

Toy Robot Simulator - PHP version

Code test in PHP this time.

Problem description can be found in docs/CodeTest-Robot.pdf

Environment Details

PHP 5.3.16

Instructions

To see the code run:

  1. cd to code-test-robot-php folder.
  2. php runRobotApp.php testdata/file-1 {testdata/file-2 ... testdata/file-n} Minimum of 1 file, up to n number of files.

To run the tests:

  1. cd to the code-test-robot-php folder.
  2. php codecept.phar run tests/unit/

Please see the below list for details about the various test data files

  1. test-1 Starts the robot at 0,0 then runs it fully around the perimeter including various turns and attempts to run off the edges.
  2. test-2 Starts the robot at 0,0 then runs many places. At the end, a move off an edge is attempted followed by another place.
  3. test-3 Demonstrates the robot ignoring instructions and a bad place until a valid place is processed. After that, a bad place results in no changes to the robot.

Other data files are there to support the tests.

Notes and Assumptions

  1. I have assumed that if there is an invalid command in the commands file, the whole lot will be rejected.
  2. Specifically with regards to PLACE, PLACE -1, 0, NORTH would cause a rejection as negative numbers are deemed invalid. PLACE 100, 100, SOUTH would be accepted as valid syntax, but will be skipped by the robot as a bad place().

code-test-robot-php's People

Watchers

Allen Ling avatar

Forkers

oliverj20

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.