Gossamer Forum
Home : General : Perl Programming :

Hangman Game

Quote Reply
Hangman Game
Alex,
I love the Hangman game which you show at http://www.gossamer-threads.com/...urces/Other_Scripts/ but despite trying to download the source from modperl.com, i'm buggered if I can get it to work Frown

Do you have a .zip copy of the files which run the game ? It would make a great addition to my site...

Cheers!

------------------
Craig Antill
10 Tenths Motorsport (1.1) - www.Ten-Tenths.com/links/
THE Directory (2.0b3) - www.gardenbuildings.com/
Quote Reply
Re: Hangman Game In reply to
Where'd you get stuck in the install? I'm using the DBI version with mysql, and there was a bug in it. They use: '<> null' in one of the SQL statements, when it should be 'not null' (just do a search and replace).

Other then that, I'm using pretty much what's in the source..

Cheers,

Alex
Quote Reply
Re: Hangman Game In reply to
I must say I like the game as well and also would like to use it however I was also unable to use it.

I kept getting the ISE when I tried to run it - I suppose because I was unable to figure out what exactly they wanted here in the following;

use constant WORDS => '/usr/games/lib/hangman-words';
use constant ICONS => '/icons/hangman';

Any suggustions?

Quote Reply
Re: Hangman Game In reply to
While the version of HangMan linked in this site is nice...I prefer the following Hang Man game (does not require mod_perl, MySQL, etc.)....

http://www.albedo.net/pub/cgi-games.html

I have this game installed at the following URL:

http://vlib.anthrotech.com/bin/hm/

Hope this helps.

Regards,

Quote Reply
Re: Hangman Game In reply to
Ah Yes! This one works like a charm!

Thanks Kindly!

Quote Reply
Re: Hangman Game In reply to
You're welcome!

Glad to help!

Regards,

Quote Reply
Re: Hangman Game In reply to
I installed the hangman game and made some minor modifications to the script to get my logo and advertising banner to appear etc..

I love this little script however I do have one problem and was wondering if anyone has made a modification to it to allow for "2 word" words for guessing? You can already have "2 word" clues but not for the word to be guessed.

for example:

boat,thing is allowed
boat,fishing device is allowed
Andrea Gale,boat is not allowed
Andrea Gail,fishing boat is not allowed

I realize that these forums are meant for Gossamer-Threads discussion, however perhaps someone has already made a modification to do this?

If not, would it be a hard mod to do? I would be willing to pay for someone to do it for a small fee?

Quote Reply
Re: Hangman Game In reply to
I am not sure what problem you have with the script I linked...but I have not had any problems guessing two words at a time.

Regards,

Eliot

Quote Reply
Re: Hangman Game In reply to
Sorry Eliot that is not quite what I meant.

The words in the hangman.words file itself can only be single words.

for example if I were doing a web hangman game of North American towns, I could use the cities of either Toronto, Vancouver, or Dallas, but cities like New York or Los Angeles could not because the city name is made up of two words.

Is that a little more clear?

Thanks!

Quote Reply
Re: Hangman Game In reply to
In Reply To:
The words in the hangman.words file itself can only be single words.
Not true...I have multiple words in my hangman...separated by a -, like the following:

Code:

adze-blade


Regards,

Eliot

Quote Reply
Re: Hangman Game In reply to
Hi Eliot

I tried that however what happens is like this;

the word I used was new-york (using the dash)

when the game started it looks like this;

_ _ _ _ _ _ _ _

So starting off there is nothing to signify the space or to tell them it is 2 words to start. As you guess the letters the dash prevents you from getting the clue.

ie: when you get to this point

new_york

you have solved the puzzle however the game does not think so cause you have one space left to fill, and a dash (-) is not a selectable option.

What I was kind of hoping or looking for was like this...


Start the game and it looks like this;

_ _ _ (space) _ _ _ _

And when you get to this:

new york

the game say : You won:-) (I had to type the space in as the forum wont let me put in a non breaking space:-)

Quote Reply
Re: Hangman Game In reply to
still looking to see if anyone has a mod or is willing do do one for a small fee:-)

On another note - I had to change servers and Hangman no longer works:-(

I kept the same directory structure however now my CGI-BIN directory is above my htdocs directory. I changed my configuration but the program don't work but it is not an ISE500 error.

here is what I have:


# The Directory where the .gif files are ie: /game/hangman/image/
$GIF_DIR = "/images/";

# The cgi-bin dir and the name of the cgi ie: /cgi-bin/hangman.pl
$CGI_BIN = "/cgi-bin/hangman/hangman.cgi";

# the URL to go back to leave the game ie: http://www.albedo.net/
$HOMEP = "http://www.newfiebullet.com";

# The location of the word file (FULL PATH!)
$DATAFILE = "/home/root057/cgi-bin/hangman/hangman.words";

# If the Clue stays on the screen
$CLUE=1;

$bgcolour="white";
$textcolour="#000010";
$linkcolour="blue";
$vlinkcolour="#FF00FF";
$alinkcolour="#FFFF00";

# use background
$BG=0;
$BGGIF="/game/image/bg.gif";
#####################################################################
# The following options require write permission for the html server
# You must use FULL PATH NAMES,
# Write anticheat file
# this writes the IP and guess number of the user to prevent cheating
$wac=1;
$wacfile="/home/root057/cgi-bin/hangman/hangwac";
$ctlfile="/home/root057/cgi-bin/hangman/hangctl";


my absolute pate for images is /home/root057/htdocs/images/
my absolute pate for my CGI-BIN is /home/root057/cgi-bin/

now the problem is like this - the program runs, I get the logo pop up at the top of the page, and nothing else. the logo comes from this line;

print "<A HREF=\"$HOMEP\"><IMG SRC=\"http://www.newfiebullet.com/images/nblogo2.jpg\" WIDTH=\"257\" HEIGHT=\"57\" BORDER=\"0\" ALT=\"NewfieBullet\"></a>";


which I used rather than that rainbow color thing that was default. this is at line #262

I don't see why it's doing this - perhaps a programmer may?

Quote Reply
Re: Hangman Game In reply to
I would double check the following:

1) The permission of the files (755 for .cgi and 666 for the .words file).

2) DOUBLE check the ABSOLUTE paths...they look too short to me.

Regards,

Eliot Lee

Quote Reply
Re: Hangman Game In reply to
Hi;

Actually the paths and permissions as all ok - I found the problem - now I need help.

I had the following added to give me a banner ad on each refresh.

$ADVNoPrint =1;
$ADVQuery = "";
require "/home/root057/cgi-bin/adfeed/ads.pl";

Now this worked fine on my first server however now it don't. This is Webadverts, and this pl is serving ads fine on HTML pages. the address is right.

Help?

Quote Reply
Re: Hangman Game In reply to
Well...I am also using WebAdverts in my hangman and other .cgi scripts with the following codes:

Code:

sub insertadvert {
#---------------------------------------------------------
# Insert Banner Ad

my $ad = `/absolute/path/to/ads.pl`;
$ad =~s,Content-type:\stext/html,,;
return $ad;
}


Then call the "Banner" in the Hangman script with the following codes:

Code:

print &insertadvert;


Regards,

Eliot

Quote Reply
Re: Hangman Game In reply to
That never worked either... most puzzling. This is what I entered along with the print call to the subroutine.

sub insertadvert {
#---------------------------------------------------------
# Insert Banner Ad
my $ad = `/home/root057/cgi-bin/adfeed/zone_b.pl`;
$ad =~s,Content-type:\stext/html,,;
return $ad;}


Actually this suggestion of yours is the exact same way, (word for word) that I show my ads in Links's CGI generated pages like add.cgi and modify.cgi (I got it from one of your earlier posts) - so I went and had a look at these pages as well, and these pages are not showing the adds either. Now this is rather strange. Again it worked fine on my old server however now it don't. The paths are correct etc. and on the static HTML pages with SSI calls the banners are working perfectly.

Thanks for your help Eliot, any more thoughts on this? Can the includes be “disabled” in Perl by the hosting company or something else strange?


Quote Reply
Re: Hangman Game In reply to
It most likely is a problem with your hosting company's configuration of your account. Do they allow SSI? If not, that is your problem.

Regards,

Eliot

Quote Reply
Re: Hangman Game In reply to
Yes they allow SSI and as I said the Static HTML pages are rotating ads using SSI perfectly.

Any other ideas before I go after my webhost like a ball of fire? :-)

Quote Reply
Re: Hangman Game In reply to
Nope...I have provided all the suggestions I have!

Best of luck finding a solution!

Regards,

Eliot Lee

Quote Reply
Re: Hangman Game In reply to
Stupid me:-)

now it works- a typo in ads.pl, it was:

$display_path = "/home/root057cgi-bin/adfeed/ads_display.pl";

(missing / before cgi-bin)