1.0.1 • Published 4 years ago

simple-rps v1.0.1

Weekly downloads
3
License
ISC
Repository
-
Last release
4 years ago

simple-rps

A package that takes two moves for rock paper scissors and determines the winner.

Documentation

/**
 * Generates the winner.
 * @param {String} move_player1 - The move of the first player.
 * @param {String} move_player2 - The move of the second player.
 * @returns {Object} An object containing data on the game round.
 */
module.exports = function(move_player1, move_player2) {
  // ...
}

Examples

const rps = require("simple-rps");
console.log(rps("rock", "scissors"));
/*
{
  result: { success: true, message: 'player1 won' },
  player1: { move: 'rock', result: 'won' },
  player2: { move: 'scissors', result: 'lost' }
}
*/