Giter VIP home page Giter VIP logo

minefield's Introduction

Minefield

This is a C# command-line based game that will allow you to create and traverse a minefield.

This is a solution to the /r/dailyprogrammer task that is detailed here and below:

Description

You must remotely send a sequence of orders to a robot to get it out of a minefield.

You win the game when the order sequence allows the robot to get out of the minefield without touching any mine. Otherwise it returns the position of the mine that destroyed it.

A mine field is a grid, consisting of ASCII characters like the following:

+++++++++++++
+000000000000
+0000000*000+
+00000000000+
+00000000*00+
+00000000000+
M00000000000+
+++++++++++++

The mines are represented by * and the robot by M.

The orders understandable by the robot are as follows:

  • N moves the robot one square to the north
  • S moves the robot one square to the south
  • E moves the robot one square to the east
  • O moves the robot one square to the west
  • I start the the engine of the robot
  • - cuts the engine of the robot

If one tries to move it to a square occupied by a wall +, then the robot stays in place.

If the robot is not started (I) then the commands are inoperative. It is possible to stop it or to start it as many times as desired (but once enough)

When the robot has reached the exit, it is necessary to stop it to win the game.

The challenge

Write a program asking the user to enter a minefield and then asks to enter a sequence of commands to guide the robot through the field.

It displays after won or lost depending on the input command string.

Input

The mine field in the form of a string of characters, newline separated.

Output

Displays the mine field on the screen

+++++++++++
+0000000000
+000000*00+
+000000000+
+000*00*00+
+000000000+
M000*00000+
+++++++++++

Input

Commands like:

IENENNNNEEEEEEEE-

Output

Display the path the robot took and indicate if it was successful or not. Your program needs to evaluate if the route successfully avoided mines and both started and stopped at the right positions.

minefield's People

Watchers

James Cloos avatar  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.