Random Word Generator?
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
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.
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.
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.
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
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
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
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
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
Popular Topics
Advertisement