Giter VIP home page Giter VIP logo

zombie_apocalypse's Introduction

Zombie Apocalypse v4.1

To run this must install node version v8.11.1

From root directory run npm install this will install node modules, which needed to run this program

To start npm start src/input.txt

It will show the input from file and ask to hit any key to show results

Sample output:

Output Image

After the nuclear war, a strange and deadly virus has infected the planet. Living creatures are becoming zombies that spread their zombiness by an unfriendly bite. The world consists of an n x n grid on which zombies and creatures live. Both of these occupy a single square on the grid and can be addressed using zero-indexed x-y coordinates. Top left corner is (x: 0, y: 0) with x represent horizontal coordinate, y represent vertical coordinate. Any number of zombies and creatures may occupy the same grid square.

At the beginning of the program a single zombie awakes and begins to move around the grid. It is given an initial x-y coordinate and a list of movements, up, down, left and right ( U , D , L , R ). The ordered sequence of movements is represented as a string, for example: DLUURR (down, left, up, up, right, right) . Zombies can move through the edge of the grid, appearing on the directly opposite side. For a 10x10 grid, a zombie moving left for (0,4) will move to (9,4); a zombie moving down from (3,9) will move to (3,0).

The poor creatures in the area are the zombie’s victims. The also have an initial x-y coordinate. The creatures are aware of zombie presence, but are so frightened that they never move

If a zombie moves so that it end up on the same location as a creature, the creature is transformed into another zombie and zombies score one point . The zombie continues moving and infecting creatures until has performed all its moves. Once it has completed its movement, the first newly created zombie moves using the same sequence as the original zombie. Once it has completed its move, the second newly created zombie moves, and so in order of infection with each zombie performing the same sequence of moves. Once no new zombies have been created and all the zombies have completed moving the program ends.

Your task is to program to take an input txt file about the zombie game and output the result.

Given a file that contains:

  • dimensions of the area (N)
  • initial position of the zombie
  • a list of positions of poor creatures and
  • a list of moves zombies will make

The program output

  • the number of points scored by the zombies
  • the final position of the zombies

Example input: 4 (2,1) (0,1)(1,2)(3,1) DLUURR Example output: zombies score: 3 zombies positions: (3,0)(2,1)(1,0)(0,0)

zombie_apocalypse's People

Contributors

nauman avatar

Watchers

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