Simulate a game where the goal is to kill the enemies by using a tower.
Program should simulate a game where the goal is to kill the enemies by using a tower. Need to kill enemies as fast as possible. At each turn first the tower fires one time then each enemy moves to the tower. If an enemy reaches the tower you lose.
The first line is the tower's firing range. Each next line represents an enemy:
- first column - is the enemy name.
- second column - is the initial distance to the tower.
- the last one - is the unit speed.
- At each turn program should inform if the tower killed the enemy unit.
- At the end program should inform if the tower WINS or LOSES and the count of played turns.
- In case of lost the program should calculate the minimal tower's firing distance to win the game against same set of enemies.
50m
BotA 100m 10m
BotB 50m 20m
BotC 30m 20m
Firing range is 50m
Turn 1: Kill BotC at 30m
Turn 2: Kill BotB at 30m
Turn 6: Kill BotA at 50m
Tower WIN in 6 turn(s)
- Create programmatic simulator for this game that has to be executed on [email protected]
- Feel free to write unit tests
- NPM available libs are: lodash, winston, chance, should, mocha
To install or update nvm, you can use the install script using cURL:
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
or Wget:
$ wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
$ nvm install 0.12.14
$ git clone https://github.com/tbaltrushaitis/tower-strike.git
$ cd tower-strike
$ npm i
$ nvm exec 0.12.14 npm start
$ nvm exec 0.12.14 gulp
$ nvm exec 0.12.14 npm run dev
$ make test
$ npm test
Reporter for tests could be changed in mocha options file by changing the value of --reporter
parameter.
Here is the list of possible values for the option:
json
JSON datajson-stream
JSON-stream datamarkdown
Markdown filebase
min
progress
html
xunit
- GitHub / Basic writing and formatting syntax
- BitBucket / Markdown Howto
- Docker / Creating an Automated Build
- Docker / Linking containers
- Docker / Cross-host linking containers
📆 Developed on June 2017
♏