473,385 Members | 1,546 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

hangman hang-up for java

I’m trying to make a hangman program that starts with dashes, maybe some letters already showing, and you type in guess’. After each guess the “dashes” refresh and the missed letters refresh until you exceed 7 guesses or complete the word.

My logic so far is:
Print “You will have 7 chances to guess” //head, body, two legs, two arms, face
Print _ _ _ _ _ _! //for now there will only be one option
Print “Choose a Letter” input from the keyboard
If correct print _ _ _E _ _! For each option and save
If incorrect add letter to Missed: A F G
If word is filled out, print “Congrats”
If # of guess exceeds 7 print “Try again” and quit.

I think this would be the right logic for a super simple hangman game…I think I can work everything out but I’m having trouble with step 4 where the program knows you picked a letter, places it and saves it for the next guess. Any advice or guidance would be greatly appreciated, thanks
Dec 22 '09 #1
1 1963
chaarmann
785 Expert 512MB
Step 4:
Use a StringBuffer object to store the incomplete string from the user. You can access it like an array and set single characters inside directly (on opposition to the non-modifiable String object)

or do you mean Step 5?

Step 5:
use Vector or ArrayList to store all the letters which were already guessed.
Dec 23 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: tigrfire | last post by:
So I'm trying to write a hangman game and the output is coming out a little strange. Here's my code thus far: #include <stdio.h> #include <string.h> #include <stdlib.h> #include <time.h> ...
18
ilikepython
by: ilikepython | last post by:
Hi I'm new to Python(3 to 4 days) and I'm working on a hangman game and have been having some problems that really annoy me. Here is part of my script: c = input('Would you like to play hangman?...
24
by: St33med | last post by:
Making a hangman code (I'm a n00b, still in the tutorial stage) Anyway, here's my (top-secret) code: def guess(): choice=raw_input("Guess!(lowercase only please!)") if len(choice)>1: ...
57
by: Need help54321 | last post by:
Ok hes the thing u no public class thats how i gotta make it in JCreator and i dont even no where to start if anyone could give me some pointer or make the code and i use bits and piece That would...
4
by: princessfrost | last post by:
Hi! I was wondering if someone could please help me with a hangman program that I have to do. I have some ideas, but really don't know what to do or where to start. My program needs to be:...
3
by: kaka_hunter | last post by:
#include <iostream> #include <fstream> using namespace std; const int max_tries=7; int earnings=0; int wordnum; void getword () { ifstream fin;
2
by: tesa | last post by:
I am not able to figure out how to make this work. I am trying to create a hangman game. I am in a basic javascripting class. I am to only use very basic code as you can see. I am able to use any...
0
by: Madmartigan | last post by:
Hi I'm a newbie to C# and have been instructed to create a Hangman game in SharpDevelop. I don't want the answer to the full code, just some help along the way. I have included my code thus...
5
by: av3rage | last post by:
I have never done any programming in my life but I have decided to go into engineering and in doing so we have to take this intro to programming course and I am pretty clueless. I am starting to get...
8
by: tidiz | last post by:
Hi, I'm trying to make a hangman game that should look like this: Welcome to Hangman ______ Your guess: c Success! __cc__ Your guess: b
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.