Git Product home page Git Product logo

hangman-game's Introduction

hangman-game

Theme: Vegan Friendly Foods

  1. User should see starting screen, with a message asking them to press anyway to get started.
  2. The screen contains
    1. Wins
    2. the current word,
    3. hyphens representing the length of the word
    4. number of guesses the user has remaining
    5. The letters that the user has already guessed
  3. When user strokes keyboard the game will
    1. Check to see if that letter has already been guessed
      1. If letter has been guessed don’t log letter and decrement number of guesses
    2. if letter hasn’t been selected
      1. check to see if letter is contained in selected word
        1. If letter is contained in word then show on screen where letter is shown (be careful of multiples)
        2. If letter isn’t contained in word then place letter on already guessed and decrement number of guesses by 1
    3. User wins when all hyphens are filled in with letter.

un-seen Logic: Create an array that contains all letter in alphabet assign to var alphabet

Create an array that contains possible words and assign to var veganWordBank

Create var wins to keep count of wins Create an empty array and assign var guessedLetters

Create a global var for guesses remaining named guessesRemain

On page load, have computer pick a random number that is assigned to a word in veganWordBank. Random number will need to correspond to an index number. Assign to currentWord[i]

Create function to contain onkeyup event, that holds the letter pressed by user

Pass in currentWord[i]

Uses indexOf to see if that letter is contained in varGuessedLetters

If letter is not contained, pass

seen logic-

Use document.getElementById for wins

Current word:

  • wrap each hyphen in a span

hangman-game's People

Contributors

siverson90 avatar

Watchers

James Cloos avatar

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.