GithubHelp home page GithubHelp logo

nodehangman's Introduction

nodeHangMan

A command line version of a Hang Man game.

I stuck with the same theme I used for the HTML version which was words from the movie, "The Fifth Element." Now that I have more knowledge of JavaScript I was able to create a better workflow and user experience. I may go back and attempt to enhance the HTML version in the future.

Index Gif

Gameplay:

  • Run command to start game.

  • Display the spaces available in the current word(showString method) console log the current score and incorrect guesses remaining.

  • Prompt the user for their guess.

  • Check the letter and the word to see if has been guessed correctly.

  • If the word has not been fully guessed, re-display the spaces available and correct letters(showString method) console log the current score and incorrect guesses and prompt the user for their guess.

  • If the word has been guessed correctly add one to the players score. Prompt the user to determine if they would like to continue playing or exit the game. If they with to continue, reset the guesses remaining and valid guesses if used, display the spaces available for the next word, console log the current score and incorrect guesses and prompt the user for their guess.

  • If all of the words have been guessed, congratulate the user on a perfect round and end the game.

Instructions

  1. Navigate to the root of your project and run npm init -y โ€” this will initialize a package.json file for your project. The package.json file is required for installing third party npm packages and saving their version numbers. If you fail to initialize a package.json file, it will be troublesome, and at times almost impossible for anyone else to run your code after cloning your project.
  1. Make a .gitignore file and add the following lines to it. This will tell git not to track these files, and thus they won't be committed to Github.
node_modules
.DS_Store
.env

Advanced JavaScript Assignment: Constructor Word Guess

Overview

This homework assignment is optional.

In this unit's assignment, you will create a Word Guess command-line game using constructor functions.

Word Guess Cli

Submission on BCS

  • Please submit the link to the Github Repository!

Instructions

The completed game should meet the following criteria:

  1. The completed game should be able to receive user input using the inquirer or prompt npm packages.

  2. Your solution should have, at minimum, three files:

  • Letter.js: Contains a constructor, Letter. This constructor should be able to either display an underlying character or a blank placeholder (such as an underscore), depending on whether or not the user has guessed the letter. That means the constructor should define:

    • A string value to store the underlying character for the letter

    • A boolean value that stores whether that letter has been guessed yet

    • A function that returns the underlying character if the letter has been guessed, or a placeholder (like an underscore) if the letter has not been guessed

    • A function that takes a character as an argument and checks it against the underlying character, updating the stored boolean value to true if it was guessed correctly

  • Word.js: Contains a constructor, Word that depends on the Letter constructor. This is used to create an object representing the current word the user is attempting to guess. That means the constructor should define:

    • An array of new Letter objects representing the letters of the underlying word

    • A function that returns a string representing the word. This should call the function on each letter object (the first function defined in Letter.js) that displays the character or an underscore and concatenate those together.

    • A function that takes a character as an argument and calls the guess function on each letter object (the second function defined in Letter.js)

  • index.js: The file containing the logic for the course of the game, which depends on Word.js and:

    • Randomly selects a word and uses the Word constructor to store it

    • Prompts the user for each guess and keeps track of the user's remaining guesses

  1. Letter.js should not require any other files.

  2. Word.js should only require Letter.js

  3. HINT: Write Letter.js first and test it on its own before moving on, then do the same thing with Word.js

  4. HINT: If you name your letter's display function toString, JavaScript will call that function automatically whenever casting that object to a string (check out this example: https://jsbin.com/facawetume/edit?js,console)


Notes

  • Since this assignment is a command-line application, you don't need to deploy it anywhere. You will, however, be required to upload it to Github.

  • Remember to include a package.json file containing your project dependencies in your Github repo!

Reminder: Submission on BCS

  • Please submit the link to the Github Repository!

Minimum Requirements

Attempt to complete homework assignment as described in instructions. If unable to complete certain portions, please pseudocode these portions to describe what remains to be completed. Adding a README.md as well as adding this homework to your portfolio are required as well and more information can be found below.


Create a README.md

Add a README.md to your repository describing the project. Here are some resources for creating your README.md. Here are some resources to help you along the way:


Add To Your Portfolio

After completing the homework please add the piece to your portfolio. Make sure to add a link to your updated portfolio in the comments section of your homework so the TAs can easily ensure you completed this step when they are grading the assignment. To receive an 'A' on any assignment, you must link to it from your portfolio.


One More Thing

If you have any questions about this project or the material we have covered, please post them in the community channels in slack so that your fellow developers can help you! If you're still having trouble, you can come to office hours for assistance from your instructor and TAs.

Good Luck!


nodehangman's People

Contributors

braydenc303 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.