Computer Science Canada

roulette, ball number correlation.

Author:  Paul [ 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?

Author:  TheXploder [ Fri Jan 30, 2004 2:01 pm ]
Post 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...

Author:  Paul [ Fri Jan 30, 2004 2:05 pm ]
Post 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.

Author:  shorthair [ Fri Jan 30, 2004 2:08 pm ]
Post 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

Author:  we64 [ Fri Jan 30, 2004 2:44 pm ]
Post subject: 

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

Author:  TheXploder [ Sat Jan 31, 2004 12:54 am ]
Post 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

Author:  we64 [ Sat Jan 31, 2004 8:38 am ]
Post subject: 

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

Author:  shorthair [ Sat Jan 31, 2004 9:02 am ]
Post 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

Author:  Paul [ Sat Jan 31, 2004 12:42 pm ]
Post 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).

Author:  we64 [ Sat Jan 31, 2004 8:02 pm ]
Post 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

Author:  TheXploder [ Sat Jan 31, 2004 8:17 pm ]
Post 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?

Author:  Paul [ Sat Jan 31, 2004 10:04 pm ]
Post subject: 

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

Author:  Paul [ Sat Jan 31, 2004 10:07 pm ]
Post 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

Author:  TheXploder [ Sat Jan 31, 2004 10:20 pm ]
Post 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'...

Author:  Paul [ Sat Jan 31, 2004 10:22 pm ]
Post 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.

Author:  TheXploder [ Sat Jan 31, 2004 10:30 pm ]
Post subject: 

fine, yours is better I admit it, just one update.. just I think it slows too abruptly..

Author:  Paul [ Sat Jan 31, 2004 10:31 pm ]
Post subject: 

you can change it with the counter

Author:  we64 [ Sat Jan 31, 2004 10:38 pm ]
Post subject: 

he... I got the basic codes, you just added or changed it Wink

Author:  Boarder16 [ Sat Jan 31, 2004 10:39 pm ]
Post subject: 

i agree with him

Author:  Paul [ Sat Jan 31, 2004 10:42 pm ]
Post subject: 

yes, because we all know how hard it was to make the animation, it might have taken me several hours Laughing

Author:  TheXploder [ Sat Jan 31, 2004 11:03 pm ]
Post subject: 

But the problem with your's paul is it stops at the same spot every time, look at this code, I improved the old code...

code:

var limit : int := Rand.Int (360, 720)
var count : int := 0
var speed : int := 1
var speedInc : int := 1

drawoval (100, 100, 52, 52, black)

loop
    speedInc := speedInc + 1
   
    if count >= 0 and count < round (limit / 2) then
        if speedInc >= 20 then
            speed := speed + 1
            speedInc := 1
        end if
    end if

    if count >= round (limit / 2) then
        if speedInc >= 20 then
            speed := speed - 1
            speedInc := 1
        end if
    end if

    if speed >= 5 then
        speed := 5
    end if

    count := count + speed
   
    if speed <= 0 then
        speed := 1
    end if

    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 (15)
end loop


I like when we learn from eachother, isn't that what we are here for...
not to say, oh look at my code, oh see you took my code, waz up with that, your the one asking for help and we r just trying to improve on it..

Author:  Paul [ Sat Jan 31, 2004 11:07 pm ]
Post subject: 

we're joking dude, nice code.

Author:  we64 [ Sat Jan 31, 2004 11:16 pm ]
Post subject: 

TheX, pretty nice...

Author:  shorthair [ Sat Jan 31, 2004 11:36 pm ]
Post subject: 

Play nice boys , no need for the spam posts paul , or else you get in trouble for posting to mcu h Laughing Laughing , Wow ive become addicted to teh spam section , i have 92 popts that dont count in my post count , im like a junkie for it now

Author:  Paul [ Sun Feb 01, 2004 12:07 am ]
Post subject: 

I might not have time to work on this, you guys feel free to make your own roulette programs.

Author:  shorthair [ Sun Feb 01, 2004 12:12 am ]
Post subject: 

ohhhhh , thakns , i already tried and ended up making poker , i wish i could find it, my blackjack was my greatest game so far

Author:  Paul [ Sun Feb 01, 2004 12:16 am ]
Post subject: 

cool, I might ponder a bit on making black jack.

Author:  shorthair [ Sun Feb 01, 2004 12:19 am ]
Post subject: 

it was my midterm project in compsci this year ( have you seen it , its way back somewher ein the files , posted it when i first joined , thought i was hott stuff ( i was wrong ) )

Author:  Paul [ Sun Feb 01, 2004 2:49 pm ]
Post subject: 

Heh, if I were told to make blackjack right now, I would have little idea on how to go about it. I'll try to find yours using search.

Author:  Cervantes [ Sun Feb 01, 2004 2:58 pm ]
Post subject: 

the best kinds of projects are the ones that you have little idea how to go about doing. You learn best doing those kinds of projects. DO IT!!

*ahem*

if you want to Eh

Author:  Paul [ Sun Feb 01, 2004 2:59 pm ]
Post subject: 

Shorhair, which picture did you use for the card cover? isn't she that singer?

Author:  shorthair [ Sun Feb 01, 2004 3:25 pm ]
Post subject: 

on blackjack , if so that denise richards , actress


: