Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Ekim_Gram

Random Word Generator?

This topic is 5521 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
<< 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

Share this post


Link to post
Share on other sites
<< 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

Share this post


Link to post
Share on other sites
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!!


Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!