Random Word Generator?

Started by
11 comments, last by Ekim_Gram 20 years, 8 months ago
I''m thinking of making a simple Hangman Clone and can somebody how to make something that generates random words or a certain size? There''s no town drunk here, we all take turns. Velocity Gaming Force
Advertisement
I think a good idea would be to have a list in a text file or something like that then generate a random word from that list.
The monkeys are listening...
I thought you meant something like a program to generate random names for planets or something.

You need a word list of some kind. I''ve seen a gnu project with a huge wordlist, relating to anagrams. I can''t remember the name. . . ana something I think. I''ll see if I can''t find it.
Chess is played by three people. Two people play the game; the third provides moral support for the pawns. The object of the game is to kill your opponent by flinging captured pieces at his head. Since the only piece that can be killed is a pawn, the two armies agree to meet in a pawn-infested area (or even a pawn shop) and kill as many pawns as possible in the crossfire. If the game goes on for an hour, one player may legally attempt to gouge out the other player's eyes with his King.
Margana
Chess is played by three people. Two people play the game; the third provides moral support for the pawns. The object of the game is to kill your opponent by flinging captured pieces at his head. Since the only piece that can be killed is a pawn, the two armies agree to meet in a pawn-infested area (or even a pawn shop) and kill as many pawns as possible in the crossfire. If the game goes on for an hour, one player may legally attempt to gouge out the other player's eyes with his King.
If you have encarta you could locate the dictionary database, and then edit that.
Ok, so now I have the list. How do I include it in my C++ program?


There''s no town drunk here, we all take turns.
Velocity Gaming Force
<< Ok, so now I have the list. How do I include it in my C++ program? >>

Two ways I can think of, either inside your code as an array of strings or chars.....

Or...outside your code as a plain text file where you pick one string from the list before the game starts. This way the entire list does not have to saved in an array, you just read until you hit the string you want -- for example, let''s say you have 2000 strings in a text file a line per string, pick a random number like 1575, and read the list until you hit line 1575 and use that string that the person has to guess.

Phil P
Ok, would the Reading From A File tutorial be a good one for me to understand how to do this? Or better yet, can somebody demonstrate it for me?


There''s no town drunk here, we all take turns.
Velocity Gaming Force
<< Or better yet, can somebody demonstrate it for me? >>

Naw, to quote someone in the Adam Sandler movies, "you cahn doooo it!!!"

If I was writing a Hangman, I would type in Google "Hangman games" or "Hangman code" or "reading from a file C++" and see how other folks do their word list. You want to find the simplest way of (1) opening a text file for read, (2) reading a line at a time, (3) closing the text file.

Phil P
Jesus people writing Hangman in C++ on giahertz PC''s!!! I did that on a ZX81 when I was 6!!! Freaaky shit man. Is it like 3D Hangman with a cool violent animation!!


This topic is closed to new replies.

Advertisement