Random Word Generator

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
XxSolidJelloxX
Prole
Posts: 25
Joined: Sun Jul 14, 2013 2:46 am
Location: The Stars

Random Word Generator

Post by XxSolidJelloxX »

Hey guys, I am fairly new to Love2D, and I decided to make a simple random word generator.

There are 30 different word possibilities that you can generate. Anyways, you guys can take a look at the code if you want and tell me if this system is horrible or not, lol...

Peace. :D
Attachments
RandomWordGenerator.love
(1.2 KiB) Downloaded 293 times
User avatar
Eamonn
Party member
Posts: 550
Joined: Sat May 04, 2013 1:29 pm
Location: Ireland

Re: Random Word Generator

Post by Eamonn »

Quite cool. I like it :D
"In those quiet moments, you come into my mind" - Liam Reilly
jjmafiae
Party member
Posts: 1331
Joined: Tue Jul 24, 2012 8:22 am

Re: Random Word Generator

Post by jjmafiae »

seems interesting.
User avatar
XxSolidJelloxX
Prole
Posts: 25
Joined: Sun Jul 14, 2013 2:46 am
Location: The Stars

Re: Random Word Generator

Post by XxSolidJelloxX »

Eamonn wrote:Quite cool. I like it :D
Thanks, glad you liked it :)
jjmafiae wrote:seems interesting.
Yes, it runs on a simple tick system that I just thought of the other day.
User avatar
MPQC
Citizen
Posts: 65
Joined: Fri Jun 28, 2013 2:45 pm

Re: Random Word Generator

Post by MPQC »

Hardcoding it is a pretty bad idea, since you're going to end up with absolutely massive if statements if you ever needed a significant amount of words (ie >1000). You could try reading all the words from a file into a index'd table, and simply generate a random number between 1 - sizeoftable, then print out that. :awesome:
User avatar
XxSolidJelloxX
Prole
Posts: 25
Joined: Sun Jul 14, 2013 2:46 am
Location: The Stars

Re: Random Word Generator

Post by XxSolidJelloxX »

MPQC wrote:Hardcoding it is a pretty bad idea, since you're going to end up with absolutely massive if statements if you ever needed a significant amount of words (ie >1000). You could try reading all the words from a file into a index'd table, and simply generate a random number between 1 - sizeoftable, then print out that. :awesome:
Yeah, I was thinking the same thing, but I guess this could still be useful if there isn't a significant amount of possibilities.
Last edited by XxSolidJelloxX on Fri Aug 09, 2013 8:03 pm, edited 1 time in total.
jjmafiae
Party member
Posts: 1331
Joined: Tue Jul 24, 2012 8:22 am

Re: Random Word Generator

Post by jjmafiae »

it would not be hard to add tables that store every word.
User avatar
XxSolidJelloxX
Prole
Posts: 25
Joined: Sun Jul 14, 2013 2:46 am
Location: The Stars

Re: Random Word Generator

Post by XxSolidJelloxX »

jjmafiae wrote:it would not be hard to add tables that store every word.
Just got done doing that, lol. Check it out, this way of doing it is waaaaaaaaay more efficient in every aspect.
Attachments
RandomWordGenerator.love
(1.1 KiB) Downloaded 179 times
jjmafiae
Party member
Posts: 1331
Joined: Tue Jul 24, 2012 8:22 am

Re: Random Word Generator

Post by jjmafiae »

good job :D

this will work much better.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 3 guests