Get unlimited public & private packages + team-based management with npm Teams.Learn more »

risk-dice-simulator

0.1.0 • Public • Published

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

Install

npm i risk-dice-simulator

DownloadsWeekly Downloads

1

Version

0.1.0

License

MIT

Unpacked Size

19.4 kB

Total Files

8

Last publish

Collaborators

  • avatar