Code Monkey home page Code Monkey logo

constructor-word-guess's Introduction

Word Guess Game via Node.js and Constructors

Overview

Command-line Word Guess game using constructor functions.

Constructor Word Guess

Playing the Constructor Word Guess

  • The game is launched by running "node index" on the command line.
  • Dashes appear on the screen in place of each letter of the word to be guessed.
  • As the user types a letter on the keyboard, correct letters are revealed in place of the dashes.
  • If the guess is incorrect, the number of guesses is reduced by 1 and a message appears indicating that the letter chosen was incorrect as well as how many available guesses remain.
  • The game ends when the user guesses all letters in the word or the user runs out of guesses.
  • A new game begins whenever the current game is won or lost.

Technologies

  • Node JS v12.13.0
  • Inquirer Node Package Manager (NPM) v7.0.4"

Features

The Word Guess game contains the following files and features:

  1. letter.js
  • Contains a constructor, Letter, with a string (letter) and a boolean (guessed) value.
  • Letter contains a function that returns either an underlying letter or an underscore, based on whether the game letter has been guessed.
  • Letter contains a function that takes the user's guess as an argument and checks it against the underlying letter, setting the letter's guessed value to true if the letter was guessed correctly.
  1. word.js
  • Contains a constructor, Word that depends on the Letter constructor, that creates an array containing each letter of the game word the user is attempting to guess.
  • Word contains a function that calls displayWord() function, which concatenates a string representing the game word, calling the display() function defined in letter.js on each letter object and displaying guessed letters or an underscore for unguessed letters.
  • Word contains a function that takes a user guess as an argument and calls the guessWord function on each letter object, calling the check() function defined in letter.js and setting the letter's guessed value to true when the letter is guessed correctly.
  1. index.js
  • Containing the logic for the game and depends on word.js.
  • Randomly selects a game word from an array of words.
  • Uses the Word constructor to store the game word.
  • Prompts the user their guess on the game word letters.
  • Tracks the user's remaining guesses, subtracting a guess each time the user guesses incorrectly.
  • The game ends if the user runs out of guesses (10) or the user guesses all of the game letters before they run out of guesses.
  • A new game starts automatically after a win or loss.

Development Details

Developer

Pam Kelly at [email protected]

GitHub

Github at https://github.com/PLKGIT/constructor-word-guess

Deployed Application (Example)

README Link at https://plkgit.github.io/constructor-word-guess/

Portfolio

Professional Porfolio at https://www.pamkelly.com/portdev.html

Copyright © 2019-2020 Pamela L. Kelly

constructor-word-guess's People

Contributors

dependabot[bot] avatar plkgit avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

amit-ranjan22

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.