Giter VIP home page Giter VIP logo

gardenrover's Introduction

Garden Rover

Coding Task: Robotic Lawn Mower

A squad of robotic lawn mowers are to be used to cut the grass of homes in the local area. These gardens, which are curiously rectangular and all the same size, must be navigated by the lawn mowers so that every bit of grass is cut.

A mower's position is represented by a combination of x and y coordinates and a letter representing one of the four cardinal compass points. The garden is divided up into a grid to simplify navigation. An example position might be 0 0 N which means the mower is in the bottom left corner and facing North.

Each mower will explore sequentially, which means that the second mower won't start to move until the first one has finished moving.

In order to control a mower, the gardener sends a simple string of letters. The possible letters are 'L', 'R' and 'M'. 'L' and 'R' make the mower spin 90 degrees left or right respectively, without moving from its current spot. 'M' means move forward one grid point, and maintain the same heading.

Assume that the square directly North from (x, y) is (x, y+1).

Input:

  • The first line of input is the most North-East coordinates of the garden, the most South-West coordinates are assumed to be (0,0).
  • The rest of the input is information pertaining to the mowers that have been deployed. Each mower has two lines of input. The first line gives the mower's position, and the second line is a series of instructions telling the mower how to explore the garden.

Output:

  • The output for each mower should be its final position so it can be retrieved and put back in the shed.

Example:

Input:

5 5
1 2 N
LMLMLMLMM
3 3 E
MMRMMRMRRM

Expected Output:

1 3 N
5 1 E

gardenrover's People

Contributors

ptahume 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.