risk-dice-simulator
Computes wins/loses of a risk dice match
Last updated a year ago by brunoscopelliti .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install risk-dice-simulator 
SYNC missed versions from official npm registry.

risk-dice

Computes wins/loses of a risk dice match.

Install

npm install risk-dice-simulator

Rules

Each dice is compared in order of magnitude, that is the greatest attacker's value against the greatest defender's value, and so on.

In case of draw, defender wins.

Usage

const battle = require("risk-dice-simulator");

const { result, attack, defense } = battle(/* attackerUnits */ 3, /* defenterUnits */ 2);

// `attack` contains attacker's dice result, eg. [6, 5, 2].
// `defense` contains defender's dice result, eg. [6, 4].
// `result` contains how many tanks each parties loses, eg. [1, 1].

Current Tags

  • 0.1.0                                ...           latest (a year ago)

1 Versions

  • 0.1.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (1)
Dev Dependencies (7)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |