Alice Community  

Go Back   Alice Community > Alice 2 > Share Worlds

Reply
 
Thread Tools Display Modes
Random number 1-6
Old
Powerhouse64
Senior Member
 
Powerhouse64's Avatar
 
Status: Offline
Posts: 54
Join Date: Nov 2011
Location: In ur base, movin ur stuffs
Default Random number 1-6 - 11-06-2011, 06:30 PM

So, for a programming class, we had an assignment to make a dice simulator. Everyone in the class but me tried using the random number generator, and testing which numbers were closest to 1-6. Rather than be a sheep, I decided to try it in a different way, and this is the result! I am pretty proud of the program, and it works reliably (though the numbers aren't perfectly spaced, they are close enough for each number to have essentially equal chances of being selected). Feel free to try it out, and let me know if you have any improvements. The assignment is long gone, but I'm too much of a perfectionist to leave this program alone, I'd love some suggestions on how to improve its accuracy, or any other aspect!

EDIT: You do have to restart every time you want the program to come up with a new value.
Attached Files
File Type: a2w dice count.a2w (145.9 KB, 35 views)


Hogwarts: Where everything is made up, and the points don't matter
   
Reply With Quote
Old
Mr Kidnapper
Senior Member
 
Status: Offline
Posts: 442
Join Date: Feb 2011
Default 11-06-2011, 06:37 PM

Mr. Kidnapper doesn't understand how this is a different way.
   
Reply With Quote
Old
Powerhouse64
Senior Member
 
Powerhouse64's Avatar
 
Status: Offline
Posts: 54
Join Date: Nov 2011
Location: In ur base, movin ur stuffs
Default 11-06-2011, 06:45 PM

Other kids used random number generators to select a value, then had Alice print out the closest whole number, mine randomly spins an object, then decides which number it is nearest to. Mine has a visual aspect to it that works without having to deal with the silly an infuriating decimal point. It has the same purpose, but it's done in a different (and I would hope, more creative) way.


Hogwarts: Where everything is made up, and the points don't matter
   
Reply With Quote
Old
Mr Kidnapper
Senior Member
 
Status: Offline
Posts: 442
Join Date: Feb 2011
Default 11-06-2011, 06:52 PM

By the way, people in this forum have a tendency to place objects by hand, and it always looks very messy. To avoid this, you have to place objects mechanically. Use the alice click menus and move objects with numbers instead. If you get good at this, it's usually faster than doing it by hand.
   
Reply With Quote
Old
Powerhouse64
Senior Member
 
Powerhouse64's Avatar
 
Status: Offline
Posts: 54
Join Date: Nov 2011
Location: In ur base, movin ur stuffs
Default 11-06-2011, 07:28 PM

Well, I used a 12-sided object and placed the center of the number's axis on every other corner. It got the spacing pretty accurate, I think. But since I made this program, I figured out how to place objects by using their coordinates, and I could tidy this program up with that now that you mention it! Thanks!


Hogwarts: Where everything is made up, and the points don't matter
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.