salesman-minigames
v0.0.5
Published
A minigame library made with NodeJS.
Maintainers
Readme
salesman-minigames
A minigame library made with NodeJS.
Features
- Russian Roulette game simulation
- Rock-Paper-Scissors Minus One game
- Dice Roll Challenge
- Coin Flip Duel
Installation
Install the package via npm:
npm install salesman-minigamesChangelog - Patch Update
- Fixed the mistakes: Fixed the mistakes that was in the package.json and code.
- Fixed type problems: No description for this yet.
Usage
Import the classes you want to use:
// CommonJS
const { RussianRoulette, RPSMinusOne, DiceRollChallenge, CoinFlipDuel } = require('salesman-minigames');
// ES Module
import { RussianRoulette, RPSMinusOne, DiceRollChallenge, CoinFlipDuel } from 'salesman-minigames';Russian Roulette
Create a new game instance:
const game = new RussianRoulette();Get the result:
console.log(game.getStat()); // "Un-Exploded" or "Exploded"Rock-Paper-Scissors Minus One
Each player picks two choices from "rock", "paper", or "scissors". Then they remove one choice and play with the remaining one:
const game = new RPSMinusOne(['rock', 'scissors'], 1, ['paper', 'rock'], 0);Check the winner and status:
console.log(game.getWinner()); // "player1", "player2", or "draw"
console.log(game.getStatus());Dice Roll Challenge
Each player rolls a dice (number 1 to 6):
const game = new DiceRollChallenge(4, 5);Check the winner and status:
console.log(game.getWinner()); // "player1", "player2", or "draw"
console.log(game.getStatus());Coin Flip Duel
Each player chooses "heads" or "tails":
const game = new CoinFlipDuel('heads', 'tails');Check the winner and status:
console.log(game.getWinner()); // "player1", "player2", or "draw"
console.log(game.getStatus());