Alice Community Random Number Generator(school project due friday)

 Random Number Generator(school project due friday)
 Samo Guest   Status: Posts: n/a Random Number Generator(school project due friday) - 05-31-2006, 06:41 AM ok, i'm very short on time(have till friday), so plz respond asap. how would i go about making a random number generator or if it can't be done, what could i use to replace it?
 lanceA Guest   Status: Posts: n/a 05-31-2006, 09:28 AM You may wish to recheck with your teacher and ask him/her if you can use Alice's built-in Random function. I'm surprised you were given an assignment to use this without it first being explained in class, or maybe part of your assignment was to investigate the functions included in Alice ? The World object has a Random function. Good luck. Last edited by lanceA; 05-31-2006 at 09:37 AM.
 Samo Guest   Status: Posts: n/a 05-31-2006, 02:15 PM well, the thing is, we weren't taught it. this is our teacher's first time using alice so originally, our assignment was to just mess around with alice for the rest of the year since we aleady took the ap exam. after doing that for a week, she decicded to make us make a 10 min. long animation since we were all basically doing that. she pretty much just taught us the basics nd told us to experiment which was fine with all of us about the random function, totally missed that. does it work like the random generator method in java? also, how do i get the time function to work?
 lanceA Guest   Status: Posts: n/a 05-31-2006, 06:34 PM Alice's Random function returns a 6 digit double. You give it a range of numbers, i.e., minimum to maximum. All of the numbers it returns will be >= to min but < max. i.e., 2.45712, 0.39718, etc. depending upon your max and min values. For Alice's timer function you need to do several things: create a class-level variable (used to track number of seconds left) and then create a method in your timer object which accepts the variable as a parameter and then decrements it. If, as you indicated, your teacher has sort of 'turned you loose' to explore Alice with minimal instruction you might want to 'explore' with a friend or as part of a group of your classmates - there's power in numbers
 Samo Guest   Status: Posts: n/a 05-31-2006, 10:44 PM i'm better than the rest of my class(but not by much, either way, we all try to help eachother) for the random thing, would i be able to make it pick anumber from 1-10 or something like that and for the time thing, is there a tut on that? cause i don't really know how to do anything other more advanced than to allow u to steer something and haave the camera and other things follow edit: also, how can i use a variable in more than one method? Last edited by Samo; 06-01-2006 at 06:59 AM.
 Samo Guest   Status: Posts: n/a 06-01-2006, 03:48 PM thx, i appreciate it, i'll test tommorrow, didn't have time today also, where would find the alice text book, and is there an online version
 lanceA Guest   Status: Posts: n/a 06-02-2006, 05:20 AM You can purchase the book from either the publisher, Prentice Hall, or Amazon (\$45.00). Sometime in June Prentice Hall will be releasing a "Brief-Edition" of the textbook (approximately \$26.00). The book is not supposed to be accessable for free on the internet, however you can subscribe to www.safarix.com and have access to the content online. I've never used them so I can not comment on the service. Last edited by lanceA; 06-02-2006 at 05:24 AM.
Samo
Guest

Status:
Posts: n/a
06-02-2006, 07:00 AM

ok, thx, i think i figured out the probability thing, but whenever i run the program it crashes

i'm not sure if u do this, but i've uploaded the file so u can help me figure it out
Attached Files
 Space Colony Attack.zip (3.80 MB, 450 views)

 lanceA Guest   Status: Posts: n/a 06-02-2006, 11:38 AM I don't debug other people's programs but what you might want to do when you have an error in your program is begin by eliminating some of your code and see if you can isolate where the problem might be. For example: If you disable all "play sound" calls in your program and then run it you will find that your program does not crash. If you then add the calls for sound back into your program one at a time and test each time you can possibly determine that the sounds in your 3 functions are not causing the program to crash. That only leaves the sound effect being called in your world.myfirstmethod, SpaceDock play sound. Good luck

 Thread Tools Display Modes Linear Mode

 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 Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Announcements     Community News and Announcements Alice 3     How Do I?     Works In Progress     Share Your World     Share Custom Classes     Bugs and Trouble Shooting     Suggestion Box Alice 2     How do I...?     Works-In-Progress     Share Worlds     Share Objects     Bugs and Troubleshooting     Suggestion Box Educators     Teaching with Alice     Teaching Using Alice 3     Teaching Using Alice 2     CS Principles and Alice     AP CSA and Intro to Java and Alice     Workshops General Discussion     Questions and Comments     The Lounge