Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
roulette, ball number correlation.
Author Message
Paul

Posted: Fri Jan 30, 2004 1:45 pm   Post subject: roulette, ball number correlation.

I am going to be making a roulette game, I checked another roulette game on Compsci, but it didn't have any correlation between where the ball stops and the number picked. I would like to know if there is a way of doing so, and which would be easier, having the animation correspond to the random number picked? or having the number picked correspond to a random animation?
Sponsor
Sponsor

TheXploder

Posted: Fri Jan 30, 2004 2:01 pm   Post subject: (No subject)

I think the best way of doing this is having the time limit be random so it takes the spinnage to stop longer or shorter... this could be done as number incresing and the limit changes every time you run it.

 code: var limit : int := Rand.Int(50,200) var count : int := 0 loop      count := count + 1      if count = limit            % stop rotation      end if end loop

that's to start you up... Good Idea, why not make it Russian Roulette... hehe...
Paul

Posted: Fri Jan 30, 2004 2:05 pm   Post subject: (No subject)

interesting idea, using that, I'd have to figure out the spin per second and the range of time each slot on the wheel corresponds to.
shorthair

Posted: Fri Jan 30, 2004 2:08 pm   Post subject: (No subject)

I like that way , but making hte spin time static , wouldnt be that bad , id worry about getting hte app started first , teh spin time can be changesd easily
we64

Posted: Fri Jan 30, 2004 2:44 pm   Post subject: (No subject)

paul started to make so many gambling games... you better open a casino
TheXploder

Posted: Sat Jan 31, 2004 12:54 am   Post subject: (No subject)

here I got an example of acceleration and deceleration:

 code: var limit : int := Rand.Int (50, 200) var count : int := 0 var speed := 1 loop     if count >= 10 and count <= 19 then         speed := 2     elsif count >= 20 and count <= 29 then         speed := 3     elsif count >= limit - 20 and count <= limit - 11 then         speed := 2     elsif count >= limit - 10 then         speed := 1     end if         count := count + speed         put count         if count >= limit then         put "spin stoppend"         exit     end if     delay (10) end loop
we64

Posted: Sat Jan 31, 2004 8:38 am   Post subject: (No subject)

cool that is how you change the speed, but how to you make the wheel spin
shorthair

Posted: Sat Jan 31, 2004 9:02 am   Post subject: (No subject)

you just set the draw variables , to draw from whatever variables you are using for the accelerate and decelerate, when you hardcode drawing numbers , you cant do things like this , but you can make a drawing dependant on whats going on in the program
Sponsor
Sponsor

Paul

Posted: Sat Jan 31, 2004 12:42 pm   Post subject: (No subject)

This is going to take some pondering...
I'm probably going to work on this sometime on the weekends, its still only february, I have plently of time (I think).
we64

Posted: Sat Jan 31, 2004 8:02 pm   Post subject: (No subject)

here is spining
 code: drawoval (100, 100, 52, 52, black) for x : 1 .. 360     drawfillarc (100, 100, 50, 50, 0 + x - 1, 10 + x - 1, white)     drawfillarc (100, 100, 50, 50, 0 + x, 10 + x, red)     delay (10) end for
TheXploder

Posted: Sat Jan 31, 2004 8:17 pm   Post subject: (No subject)

good job, here I added my acceleration/deceleration code to your code:

 code: var limit : int := Rand.Int (360, 720) var count : int := 0 var speed := 1 loop     if count >= 10 and count <= 19 then         speed := 2     elsif count >= 20 and count <= 29 then         speed := 3     elsif count >= limit - 20 and count <= limit - 11 then         speed := 2     elsif count >= limit - 10 then         speed := 1     end if     count := count + speed     drawfillarc (100, 100, 50, 50, 0 + count - speed, 10 + count - speed, white)     drawfillarc (100, 100, 50, 50, 0 + count, 10 + count, red)     if count >= limit then         exit     end if     delay (10) end loop

by the way, how many numbers does the roulette wheel have?
Paul

Posted: Sat Jan 31, 2004 10:04 pm   Post subject: (No subject)

Ivan, you mind telling me how to use urs? it looks same as tony's
Paul

Posted: Sat Jan 31, 2004 10:07 pm   Post subject: (No subject)

I think mine works the best, effect wise...
in slowing down.

 code: drawoval (100, 100, 52, 52, black) var a, counter:int:=1 for x : 1 .. 360     drawfillarc (100, 100, 50, 50, 0 + x - 1, 10 + x - 1, white)     drawfillarc (100, 100, 50, 50, 0 + x, 10 + x, red)     delay (a)   counter:=counter+1   if counter = 5 then   counter:=1   a:=a+1 end if   end for
TheXploder

Posted: Sat Jan 31, 2004 10:20 pm   Post subject: (No subject)

Paul I said that I added my code to we64's code, and If you notice the rotation speeds up and slows down and spins further each time... duh

PS: Who is Ivan, lol... most people won't get who you are talking to...
refer to me as 'Xploder' or 'TheXploder'...
Paul

Posted: Sat Jan 31, 2004 10:22 pm   Post subject: (No subject)

I still think my way is easier to understand, cause for yours I didn't understand what all the numbers did. We're not all hardcore coders like you Xplo.
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 3  [ 32 Posts ]
Goto page 1, 2, 3  Next
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: