Giter VIP home page Giter VIP logo

invasion's Introduction

Invasion CircleCI

Aliens are popping up, will the cities of world X survive?

Prerequisites

There are two ways of running the project:

  • nvm
  • node (system)
  • n

nvm

To switch to the right version of node use:

nvm use

node

  • Required node version 10.11.*
  • Required npm version 6.4.*

Install

To install the project it's sufficient to run:

npm i

Run

To run a simulation you should run, with the proper parameters, the command:

npm start

  • --path=./relative/path/to/world.txt
  • --aliens=1000 (optional) number of aliens in the simulation

It's possible to specify both a path with a valid city map and the number of aliens:

  • npm run start -- --path=./my/map/file.txt aliens=10

Or only the path to the city file and a random number of aliens

  • npm run start -- --path=./my/map/file.txt

A ready to launch example npm start -- --path=./src/components/World/fixtures/world

Test

In order to run all the tests you may run:

npm test

Build

To have a version running in pure JS, along with the definitions file, to build an exportable package, you can run:

npm build

Description

We receive a file with the format defined in ./src/components/World/fixtures/world and a number of aliens to generate.

Those aliens, once they met, destroy the city of the meeting and themselves. Movements and initial deployment are totally random, but must follow the world structure.

At each meeting we should print the destroyed city along with the aliens that met.

We can iterate until we have aliens or cities, at maximum 10000 iterations can occur.

Once the iterations are over the final status of the world have to be printed.

Assumptions

  • File size:
    • Max file size 1GB for 64bit systems, 512MB for 32 bit systems (max hadled size by fs)
    • Max length of the city file: (2^53) -1 characters (max string legth)
    • Max number of aliens: (2^53) -1 characters (max safe integer)
  • World structure:
    • Routes are bidirectional, but must be defined at both ends
    • The cities never have roads that goes to non-existing cities
    • Rigid world routes: A road coming from north must have been started from south, so on for the other directions
    • Each city can have up to 4 routes: north, west, south and east
  • Aliens structure:
    • Aliens are grouped together per city, if a group have more than 1 alien, it disappear along with its city
    • They move synchronously, we check the meetings only at the end of the round, not intermediate results
    • The initial distribution must be checked, to eventually destroy cities with multiple aliens
    • There is no correlation between number of cities and number of aliens
    • Once an alien find itself in an isolated city, he can be dropped as he won't interfere with others anymore

invasion's People

Contributors

sabau avatar

Watchers

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