Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 roulette, ball number correlation.
Index -> Programming, Turing -> Turing Help
Goto page 1, 2, 3  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Paul




PostPosted: 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
Sponsor
sponsor
TheXploder




PostPosted: 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




PostPosted: 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




PostPosted: 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




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

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




PostPosted: 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




PostPosted: 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 Question
shorthair




PostPosted: 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
Paul




PostPosted: 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




PostPosted: 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




PostPosted: 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




PostPosted: 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




PostPosted: 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




PostPosted: 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




PostPosted: 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:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 3  [ 32 Posts ]
Goto page 1, 2, 3  Next
Jump to:   


Style:  
Search: