0.1.16 • Published 2 years ago

@tive-labs/hangedman-game v0.1.16

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

hangedman-game

How to install hangedman-game library

  • To install hangedman-game library in your project just run the following command:
npm i @tive-labs/hangedman-game;

How to use hangedman-game library

  1. Parameters

  • This game support two categories: 1 - animals, 2 - numbers
  • This game support three levels: 1 - easy, 2 - medium, 3 - hard
  1. Import the library

import {initHangedMan} from "@tive-labs/hangedman-game";
  1. Create an instance of hangedman-game

  • Use the method initHangedMan(category, level) for create an instance of hangedman-game.
const hangedman = initHangedMan('1', '1');
  1. Play

  • To play use the method play(letter) an re asign the instance with the result.
hangedman = hangedman.play('A');
  1. Verify all status value

  • To verify all status value, run this method, will return this value: { GAME_STARTED: 1, WON_GAME: 2, LOST_GAME: 3 }
const status = hangedman.getAllStatus();
  1. Verify the status game

  • To verify the status game, run this method.
const status = hangedman.getStatus();
  1. Verify quantity of attempts fails

  • To verify if the play was lost use the method isLost(), return true if you lost, you lost when you quantity of attempts fails are three or more.
const fails = hangedman.getAttemptsFailed();

Class Diagram

classes

HANGEDMAN CONSOLE GAME

Installation

npm install

Run

npm start

Test

npm test

How to play

  1. Select a category option
  2. Select a level option
  3. Write letter until fill al underscore spaces
  4. You can fail only three times.
0.1.16

2 years ago

0.1.15

2 years ago

0.1.14

3 years ago

0.1.13

3 years ago

0.1.12

3 years ago

0.1.11

3 years ago

0.1.10

3 years ago

0.1.9

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago