QB64.org Forum

Active Forums => Programs => Topic started by: 6DollarSuit on August 29, 2018, 10:58:35 am

Title: This program generates Bad Outfits
Post by: 6DollarSuit on August 29, 2018, 10:58:35 am
This is a type of program I've wanted to make for a year or two, and have failed several times at creating. The one thing all those failures had in common (other than me!) was that they were all text-based. In text, you can describe anything, so the number of possibilities for things like shirt color would quickly get out of hand. This one, being entirely graphics-based, was limited in color and complexity, which wound up being a good thing. It's quite short, but I think it works pretty well for a little over 1 hour of work:

Code: QB64: [Select]
  1. bottomcolor% = INT((RND * 16) + 1) 'generates from 0 to 15 then adds 1 to get results from 1 to 16, avoiding 0 (black)
  2. LINE (20, 440)-(200, 200), bottomcolor%, BF
  3. skirt! = RND
  4. IF skirt! > 0.5 THEN LINE (110, 440)-(110, 280), 0 'pant leg seperator if it isnt a skirt
  5. shorts! = RND
  6. IF shorts! > 0.5 THEN LINE (20, 440)-(200, 340), 0, BF 'coin flip for bottoms length
  7. topcolor% = INT((RND * 16) + 1) 'same method as bottomcolor
  8. LINE (600, 40)-(440, 200), topcolor%, BF
  9. sleeves! = RND 'single with decimal
  10. IF sleeves! < 0.5 THEN LINE (440, 80)-(280, 40), topcolor%, BF
  11. IF sleeves! > 0.5 THEN LINE (440, 80)-(360, 40), topcolor%, BF

(hopefully these attachments work)
  [ This attachment cannot be displayed inline in 'Print Page' view ]    [ This attachment cannot be displayed inline in 'Print Page' view ]  
The left side of each image shows the program's output, the right side is an example of how it could be interpreted into a real outfit. These outfits aren't terrible, but most of the ones it comes up with are pretty bad. An interesting thing is that I'm pretty sure there's a 1/1000 chance that the shirt will have no sleeves at all, since "sleeves!" could be exactly 0.5, instead of greater or less. This is my first post, so I hope I formatted it correctly.
Title: Re: This program generates Bad Outfits
Post by: bplus on August 29, 2018, 11:12:43 am
Welcome 6DollarSuit,

Yeah QB64 is pretty cool!

Do you know you might be able to match a color off an image (might need some mechanism to adjust for light and shadow though)?
Title: Re: This program generates Bad Outfits
Post by: _vince on August 29, 2018, 04:20:01 pm
Yeah, this is pretty amazing, welcome to the forum!
Title: Re: This program generates Bad Outfits
Post by: 6DollarSuit on August 29, 2018, 04:27:53 pm
Thank you! This grid has been a huge help:
  [ This attachment cannot be displayed inline in 'Print Page' view ]  
Without it, plotting the coordinates is like playing battleships against myself in the dark.
Title: Re: This program generates Bad Outfits
Post by: johnno56 on August 29, 2018, 05:14:32 pm
Welcome to the Forum. Enjoy your stay with us. If you need help, just ask...

J