Author Topic: This program generates Bad Outfits  (Read 4827 times)

0 Members and 1 Guest are viewing this topic.

Offline 6DollarSuit

  • Newbie
  • Posts: 2
    • View Profile
This program generates Bad Outfits
« 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)
 
outfit 1.png
 
Outfit 2.png

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.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: This program generates Bad Outfits
« Reply #1 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)?

Offline _vince

  • Seasoned Forum Regular
  • Posts: 422
    • View Profile
Re: This program generates Bad Outfits
« Reply #2 on: August 29, 2018, 04:20:01 pm »
Yeah, this is pretty amazing, welcome to the forum!

Offline 6DollarSuit

  • Newbie
  • Posts: 2
    • View Profile
Re: This program generates Bad Outfits
« Reply #3 on: August 29, 2018, 04:27:53 pm »
Thank you! This grid has been a huge help:
 
grid12.gif

Without it, plotting the coordinates is like playing battleships against myself in the dark.

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: This program generates Bad Outfits
« Reply #4 on: August 29, 2018, 05:14:32 pm »
Welcome to the Forum. Enjoy your stay with us. If you need help, just ask...

J
Logic is the beginning of wisdom.