Skip to content

🗼 Simulator of a game where the goal is to kill the enemies by using a tower

Notifications You must be signed in to change notification settings

tbaltrushaitis/tower-strike

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tower Strike Logo

Simulate a game where the goal is to kill the enemies by using a tower.


Task definition

Problem Statement

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.

Input

The first line is the tower's firing range. Each next line represents an enemy:

  1. first column - is the enemy name.
  2. second column - is the initial distance to the tower.
  3. the last one - is the unit speed.

Output

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

Samples

Sample Input

50m
BotA 100m 10m
BotB 50m 20m
BotC 30m 20m

Sample Output

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)

Tasks checklist


Prerequisites

Install NVM

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

Install node.js v0.12.14

$ nvm install 0.12.14

Setup

Get sources

$ git clone https://github.com/tbaltrushaitis/tower-strike.git

Install dependencies and build

$ cd tower-strike
$ npm i

Usage

Standard execution

$ nvm exec 0.12.14 npm start

Start a game

Development stage

$ nvm exec 0.12.14 gulp
$ nvm exec 0.12.14 npm run dev

Testing

$ make test
$ npm test
Spec Reporter

List of available reporters

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:

doc Example of HTML code generated
dot
landing
list
nyan
tap
json JSON data
json-stream JSON-stream data
markdown Markdown file
base
min
progress
html
xunit

Useful Info


📆 Developed on June 2017

About

🗼 Simulator of a game where the goal is to kill the enemies by using a tower

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published