Hangman Script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Hangman Script
# 1  
Old 11-26-2007
Hangman Script

Hello everyone, im just having some problem forming a script for a hangman script. The question states:

The object this excercise is for u to write a script that emulate the classic game hangman. The object of this game is for a user to try and guess a word which has been generated by the program. The user will generally have a certain amount of lives and is then requested to try and guess a letter in the owrd. on successful guesses the letter is shown within the word in its relevant position. An unsuccessful guess leads to a loss of a life. A reord of guessed letters must be kept and displayed.


Specification

1) The program will allow for a 1 player game. The word to be guessed is randomly generated from a list of stored words.
2)The guessed letters must be visible to the player.

3)The current lives must be visible

4)The number of guesses must be visisble

5)When the number of lives has run out or the word is guessed a mesage should be displayed to the user stating how they ahve done.

Example..

Sorry the word was "THE_SECRET_WORD"

OR
Well done the word was "THE_SECRET_WORD" you guessed it in 15 attempts with the loss of 2 lives

6) you must prompt te er to ask if they wish to play again.

7)your application should prevent the user entering characters other than letters. the user should only be able to enter one letter at a time.

If anyone could post how i could overcome this problem it would be great, if some one could have a crack at this and maybe post syntax i would be really please. Many Thanks in advance.
# 2  
Old 11-26-2007
The reason that no one answered you the first time you posted this problem is that we all feel you will learn programming much more efficiently by doing the homework yourself.

You should first attempt to write it, and if have some questions I'm sure many here will jump in to help you learn. But if you expect someone to post a completed program for you to turn in, then you've not only come to the wrong place, but also are attempting to cheat against your teachers, your schoolmates and yourself.

If you don't want to learn this stuff, why are you taking the class? Drop it and pick up something you'll enjoy more. I enjoy puzzles, which is why I can happily spend hours getting a RegEx just right. If you can't be bothered to write a simple Q&A game then programming is not for you.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to block first bash script until second bash script script launches web server/site?

I'm new to utilities like socat and netcat and I'm not clear if they will do what I need. I have a "compileDeployStartWebServer.sh" script and a "StartBrowser.sh" script that are started by emacs/elisp at the same time in two different processes. I'm using Cygwin bash on Windows 10. My... (3 Replies)
Discussion started by: siegfried
3 Replies

2. Shell Programming and Scripting

Shell script works fine as a standalone script but not as part of a bigger script

Hello all, I am facing a weird issue while executing a code below - #!/bin/bash cd /wload/baot/home/baotasa0/sandboxes_finance/ext_ukba_bde/pset sh UKBA_publish.sh UKBA 28082015 3 if then echo "Param file conversion for all the areas are completed, please check in your home directory"... (2 Replies)
Discussion started by: ektubbe
2 Replies

3. UNIX for Dummies Questions & Answers

Calling a script from master script to get value from called script

I am trying to call a script(callingscript.sh) from a master script(masterscript.sh) to get string type value from calling script to master script. I have used scripts mentioned below. #masterscript.sh ./callingscript.sh echo $fileExist #callingscript.sh echo "The script is called"... (2 Replies)
Discussion started by: Raj Roy
2 Replies

4. Shell Programming and Scripting

Script will keep checking running status of another script and also restart called script at night

I am using blow script :-- #!/bin/bash FIND=$(ps -elf | grep "snmp_trap.sh" | grep -v grep) #check snmp_trap.sh is running or not if then # echo "process found" exit 0; else echo "process not found" exec /home/Ketan_r /snmp_trap.sh 2>&1 & disown -h ... (1 Reply)
Discussion started by: ketanraut
1 Replies

5. UNIX for Dummies Questions & Answers

help with hangman

i want to create the known game hangman wordlist=./hangmanword //hangman word is my text file which include words i use this code to generate a random number corresponding to a word in our file and works fine calculate and generate a right number wordline=$( wc -l ${wordlist} | awk '{print... (9 Replies)
Discussion started by: sainis
9 Replies

6. Shell Programming and Scripting

create a shell script that calls another script and and an awk script

Hi guys I have a shell script that executes sql statemets and sends the output to a file.the script takes in parameters executes sql and sends the result to an output file. #!/bin/sh echo " $2 $3 $4 $5 $6 $7 isql -w400 -U$2 -S$5 -P$3 << xxx use $4 go print"**Changes to the table... (0 Replies)
Discussion started by: magikminox
0 Replies

7. Shell Programming and Scripting

Script for Hangman Game

Any ideas on whats the best way to form a hangman game via bash shell. (0 Replies)
Discussion started by: immyakram
0 Replies

8. Shell Programming and Scripting

Hangman written in Bash. Suggestions please...

qwertyuiop (1 Reply)
Discussion started by: rorey_breaker
1 Replies
Login or Register to Ask a Question