logo

The Disappearing Player Assignment

6 Pages1055 Words336 Views
   

Added on  2019-10-18

The Disappearing Player Assignment

   Added on 2019-10-18

ShareRelated Documents
Write an interactive game called The Disappearing Player. The Disappearing Player is a more magical version of Hangman. In this game, the computer will make up a word, and the user will try to guess that word before he or she disappears (the player has 8 body parts). The user can guess either a letter or the full word. Ex. of a game:Welcome to The Disappearing Player. What is your name?JoannaO/ | \/ \-The secret word is: _ _ _ _ _ _ _ _Guess a letter: AA is not in the word. Joanna, you have only 7 body parts remaining.O/ | \/ \The secret word is: _ _ _ _ _ _ _ _ Incorrect guesses: AGuess a letter or word: ZZ is not in the word. Joanna, you have only 6 body parts remaining.O/ | \/ \The secret word is: _ _ _ _ _ _ _ _ Incorrect guesses: AZGuess a letter or word: EE is in the word! Joanna, you still have only 6 body parts remaining.
The Disappearing Player Assignment_1
O/ | \/ \The secret word is: _ _ _ _ _ _ E _ Incorrect guesses: AZGuess a letter or word: RR is in the word! Joanna, you still have only 6 body parts remaining.O/ | \/ \The secret word is: _ _ _ _ _ _ E R Incorrect guesses: AZGuess a letter or word: SPITTERYour word guess is wrong. Joanna, you have only 5 body parts remaining.O/ | \/ The secret word is: _ _ _ _ _ _ E R Incorrect guesses: AZGuess a letter or word: COMPUTERYour word guess is right! Joanna, you won!Would you like to play again, Joanna? (y or n)NYour record was 1-0. Thank you for playing!If the player loses all the body parts, they lose the game, and should be told the secret word. The player can win by choosing the last letter correctly or by guessing the full word.NOTE: If you want to print a backwards slash, write two of them in a string (and just one will be printed).System.out.println("/ \\"); // this prints: / \NOTE: This is how you create an ArrayList of characters
The Disappearing Player Assignment_2
ArrayList<Character> guesses = new ArrayList<Character> (); // ArrayList must hold an object, not a built in type like chara Character object get be automatically converted to a char, like with:char letter = guesses.get(i); // a Character gets assigned as a charFor this program, you are expected to call and write a number of methods. You will find the methods that you need to write in the shell attached on PowerSchool. Please do not change anything from the main or from playGame without checking with me first. I want you to use what I’ve given you in the way that I gave it to you. When you turn in your code add your name to the shell’s file name.Extra credit, don't repeat words unless all the words were usedShell that must be usedimport java.util.ArrayList;import java.util.Scanner;public class CPQ6Shell {static Scanner sc = new Scanner(System.in);public static void main(String[] args) {String user = introAndGetUserName();int wins = 0;int losses = 0;String repeatGame="";do {boolean userWins = playGame(user); // returns true if user wins, false otherwise
The Disappearing Player Assignment_3

End of preview

Want to access all the pages? Upload your documents or become a member.