1.

Solve : i need a roulette script in PHP?

Answer»

i need ONE with the ODDS of winning.

anyone KNOW where to get one?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?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
Okay, well that's a pretty straightforward script. Can you answer my first question?Quote
Okay, well that's a pretty straightforward script. Can you answer my first question?

a little bitTo 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

functionroulette($twozeroes=false)
{
//NBTheparameter"twozeroes"isoptional.Itdefaultsto
//false,meaningweareusingasinglezero(European)
//roulettewheel.Callingthefunction,roulette();isthe
//sameascalling,roulette(false);.Foratwozerogame,
//CALL,roulette(true);

//ForPHPversionspriorto4.2.0,uncommentthenextline:
//mt_srand(crc32(microtime()));

$number=rand(($twozeroes?-1:0),36);
if($number>0)
{
$colour=(($number%2)==1?'red':'black');
}else{
$colour='green';
if($number==-1)
{
$number='00';
}
}
returnarray('number'=>$number,
'colour'=>$colour);
}//Endoffunctionroulette()


//Exampleofhowyoumightuseit:
$results=roulette();
?>
<p>
You spun the wheel, and here's what you get:
<font style='font-size: 25px; font-weight: bold; color:<?phpecho$results['colour'];?>;'>
<?phpecho$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. Thanks mate


Discussion

No Comment Found