Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: i need a roulette script in PHP  (Read 13172 times)

0 Members and 1 Guest are viewing this topic.

Useless

  • Guest
i need a roulette script in PHP
« on: July 07, 2006, 02:43:47 PM »
i need one with the odds of winning.

anyone know where to get one?

Rob Pomeroy



    Prodigy

  • Systems Architect
  • Thanked: 124
    • Me
  • Experience: Expert
  • OS: Other
Re: i need a roulette script in PHP
« Reply #1 on: July 09, 2006, 08:56:50 AM »
Are you able to program in PHP yourself?  If you make a start on the script, I can offer suggestions.  Do you simply want a function that returns the number and the colour?  Or one that handles lpacing bets, etc?
« Last Edit: July 09, 2006, 08:57:57 AM by robpomeroy »
Only able to visit the forums sporadically, sorry.

Geek & Dummy - honest news, reviews and howtos

Useless

  • Guest
Re: i need a roulette script in PHP
« Reply #2 on: July 11, 2006, 09:26:51 AM »
Quote
Are you able to program in PHP yourself?  If you make a start on the script, I can offer suggestions.  Do you simply want a function that returns the number and the colour?  Or one that handles lpacing bets, etc?

one that returns the number and colour like

red 36 or black35

Rob Pomeroy



    Prodigy

  • Systems Architect
  • Thanked: 124
    • Me
  • Experience: Expert
  • OS: Other
Re: i need a roulette script in PHP
« Reply #3 on: July 11, 2006, 10:18:22 AM »
Okay, well that's a pretty straightforward script.  Can you answer my first question?
Only able to visit the forums sporadically, sorry.

Geek & Dummy - honest news, reviews and howtos

Useless

  • Guest
Re: i need a roulette script in PHP
« Reply #4 on: July 12, 2006, 05:06:07 AM »
Quote
Okay, well that's a pretty straightforward script.  Can you answer my first question?

a little bit

Rob Pomeroy



    Prodigy

  • Systems Architect
  • Thanked: 124
    • Me
  • Experience: Expert
  • OS: Other
Re: i need a roulette script in PHP
« Reply #5 on: July 12, 2006, 06:02:53 AM »
To be honest, this is such a simple problem that I'll just write the whole script.  Here is a function, roulette() that will return an array(number, colour) that you can then use in your script.  I include an example of the use of the function.

Code: [Select]
<?php

function roulette($twozeroes=false)
{
  
// NB The parameter "twozeroes" is optional.  It defaults to
  // false, meaning we are using a single zero (European)
  // roulette wheel.  Calling the function, roulette(); is the 
  // same as calling, roulette(false);.  For a two zero game,
  // call, roulette(true);

  // For PHP versions prior to 4.2.0, uncomment the next line:
  // mt_srand(crc32(microtime()));

  
$number rand(($twozeroes ? -0), 36);
  if (
$number 0)
  {
    
$colour = (($number 2) == 'red' 'black');
  } else {
    
$colour 'green';
    if (
$number == -1)
    {
      
$number '00';
    }
  }
  return array(
'number' => $number,
               
'colour' => $colour);
// End of function roulette()


// Example of how you might use it:
$results roulette();
?>

<p>
  You spun the wheel, and here's what you get:
  <font style='font-size: 25px; font-weight: bold; color:<?php echo $results['colour'];?>;'>
    <?php echo $results['number'];?>
  </font>
</p>

Any questions?

For the time being, you can see this script working, >here<.  It will be replaced at some point with whatever other problem I'm working on at the time.  :)
« Last Edit: July 12, 2006, 06:07:32 AM by robpomeroy »
Only able to visit the forums sporadically, sorry.

Geek & Dummy - honest news, reviews and howtos

Useless

  • Guest
Re: i need a roulette script in PHP
« Reply #6 on: July 12, 2006, 09:02:12 AM »
Thanks mate  ;) ;) ;)