Jump to content

Recommended Posts

Attached below is the code for the game ghost, a classic game for bored people and car rides, ill put the instructions below as well. Thanks to Nakuribon and Erifash for all the help.

Here's how you play:

"The game of Ghost involves spelling a word, with each player in turn adding a letter to a growing word. The object is to avoid being the player who says the last letter of the word.

To start, one player says a letter. The next player then thinks of (but doesn't reveal) a word which starts with the given letter, and says the first two letters of that word. The next player thinks of a word which starts with those two letters, and says the first three letters of that word. Play continues in this fashion until someone spells an entire word more than three letters long; the player who completes a word loses the round. If on your turn you don't believe the previous player was thinking of a real word, you can challenge that player; the loser of a challenge loses the round.

Here's a sample round with three players:

Adrian [thinking of "toast," though it hardly matters what he's thinking of for the first letter]: T

Beulah [thinking of "tadpole"]: TA

Charlemagne [thinking of "tatting"]: TAT [which is a word, but only three letters long, so Charley is safe.]

Adrian [now thinking of "tattoo," since "tadpole" no longer fits the current string of letters]: TATT

Beulah [also thinking of "tattoo"; since that has six letters, the final letter will fall to Charlemagne, so Beulah is safe in continuing the word]: TATTO

Charlemagne [can do one of three things: finish the word "tattoo" and lose this round; challenge Beulah in case she was bluffing (which seems unlikely); or bluff. In desperation, he tries the third tactic]: TATTON

Adrian [after thinking for a minute]: I challenge you. There's no word that starts out like that.

Charlemagne [shrugs]: Oh, well, it was worth a try.

Note that you have to be careful not to complete a word which is part of some other word. If the current string of letters is "DIFFE," and you're thinking of "difference" so you add an R, you've spelled the word DIFFER and you lose the round even though you didn't spell the word you were thinking of.

If you lose a round, you're assigned a letter: first G, then H, then O, and so on; when you've lost five rounds (spelling GHOST), you're out of the game."

OKAY, so this program takes words from dictionary.txt (attached below) when put in the same directory as the program.

It will be a smart computer/computers that you battle against, and you can add multiplayer as well.

The problems are:

You cannot exit the game when it is not your turn/you are eliminated.

Score keeping issues, instead of spelling ghost, when eliminated, it stays at GHOS and carries a G over to the second player...

Also, sometimes it can be fairly slow and Computer 4 will not accept letters for faults.

Occasionaly the computer will enter a weird loop and not move at all.

Hope someone can understand what I'm trying to say, help would be greatly appreciated, other than that, enjoy.

EDIT: Never mind, i figured it out, thanks anyways though.


Edited by Jon
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...