CS152, Fall 2020

Computer Programming Fundamentals
Home
Schedule
Syllabus
Style Guidelines

Assignment 7: Java, Word Guessing Game
Due: Monday October 26 by 9:30am

Description
We will use an assignment developed by Brooke Chenoweth for her CS152 class. You'll write a program to play a simple word guessing game. This assignment will focus on arrays, Strings, and chars and will be your first purely Java-based assignment. You may find the following references useful: Scanner class, Math methods (like Random), String methods (like charAt()).

Game Rules
Players: 2, the knower and the guesser (in our version, the computer is the knower) Object: The guesser attempts to determine the knower's word in a limited number of guesses.

Play: The knower secretly chooses a word and writes down that many blanks. On each of the guesser's turns, she guesses a letter. The knower indicates all locations where that letter appears in the word; if there are none, the knower instead draws another part on a diagram of a person: head, torso, left arm, right arm, left leg, right leg. (Our version will keep count of how many guesses are left and draw a ASCII art stick figure.)

Victory: The guesser wins if all letters in the word are guessed. The knower wins if the person is fully drawn (that is, if the guesser runs out of guesses).

Your Program
Brooke has written some starter code in a file named WordGuessing.java. There are three methods you must complete to be able to play the game.

In addition, Brooke has provided testing code in WordGuessingTester.java. Place this file in the same project as WordGuessing.java and you will be able to test your methods without playing the game. This is particularly useful when you haven't fully implemented them yet.

What to Hand in:

  1. Your WordGuessing.java file. You don't need to submit any additional files.

  2. A paragraph about your project. In Learn, also submit a paragraph about your experience working on this assignment. What was it like transitioning from Processing to Java? What challenges did you encounter? How did you address them? What did you learn?