Welcome to Dream.In.Code
Become a PHP Expert!

Join 150,171 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 2,278 people online right now. Registration is fast and FREE... Join Now!




slots payouts

 
Reply to this topicStart new topic

slots payouts

ghqwerty
24 Aug, 2008 - 04:10 AM
Post #1

D.I.C Regular
Group Icon

Joined: 8 Aug, 2008
Posts: 373



Thanked: 8 times
Dream Kudos: 25
My Contributions
:S i dont know which topic this is meant to be in but as its for a php project ill put it in here

does anyone know the correct payouts for slots :S

at the moment my slot machine is just numbers but will be assigning pictures to the numbers soon

so far i have
which is
2 0's = 2xbet
3 0's = 3xbet
2 3's = 5xbet
3 1's = 10x
3 2's = 20x
3 3's = 50x

but im sure there are a couple more

cheers
CODE


<?php
function check($bet)
{
global $one;
global $two;
global $three;
if((($one == 0) && ($two == 0 || $three == 0)) && ($one == $two || $one == $three || $two ==

$three))
echo $bet*2;
elseif ($one == 0 && $two == 0 && $three == 0)
echo $bet*3;
elseif((($one == 3) && ($two == 3 || $three == 3)) && ($one == $two || $one == $three || $two ==

$three))
echo $bet*5;
elseif ($one == 1 && $two == 1 && $three == 1)
echo $bet*10;
elseif ($one == 2 && $two == 2 && $three == 2)
echo $bet*20;
elseif ($one == 3 && $two == 3 && $three == 3)
echo $bet*50;
else
echo 0;
}
?>

User is offlineProfile CardPM
+Quote Post

JBrace1990
RE: Slots Payouts
24 Aug, 2008 - 06:49 AM
Post #2

D.I.C Regular
Group Icon

Joined: 9 Mar, 2008
Posts: 479



Thanked: 24 times
Dream Kudos: 350
My Contributions
http://www.learntoplayslotmachines.com/payouts.htm

ok, couple of things here....

1. this line, is too long... if((($one == 0) && ($two == 0 || $three == 0)) && ($one == $two || $one == $three || $two == $three))... you don't need the extra end of that (ie: $one == $two)... you already check that they all equal the same thing...

2. you're missing your { and }... add them in...

3. this line: echo $bet*3; will NEVER activate... the elseif is the exact same as the if, and the if comes first...

4. one again, this is all extra: && ($one == $two || $one == $three || $two == $three)
User is offlineProfile CardPM
+Quote Post

ghqwerty
RE: Slots Payouts
24 Aug, 2008 - 09:28 AM
Post #3

D.I.C Regular
Group Icon

Joined: 8 Aug, 2008
Posts: 373



Thanked: 8 times
Dream Kudos: 25
My Contributions
well below is what i have now and it works perfectly

CODE


<?php
function check($bet)
{
global $one;
global $two;
global $three;
if((($one == 0 || $two == 0 || $three == 0)) && ($one == $two || $one == $three || $two == $three))
echo $bet*2;
elseif ($one == 0 && $two == 0 && $three == 0)
echo $bet*3;
elseif((($one == 3) && ($two == 3 || $three == 3)) && ($one == $two || $one == $three || $two == $three))
echo $bet*5;
elseif ($one == 1 && $two == 1 && $three == 1)
echo $bet*10;
elseif ($one == 2 && $two == 2 && $three == 2)
echo $bet*20;
elseif ($one == 3 && $two == 3 && $three == 3)
echo $bet*50;
else
echo 0;
}
?>

User is offlineProfile CardPM
+Quote Post

ghqwerty
RE: Slots Payouts
24 Aug, 2008 - 09:33 AM
Post #4

D.I.C Regular
Group Icon

Joined: 8 Aug, 2008
Posts: 373



Thanked: 8 times
Dream Kudos: 25
My Contributions
QUOTE(JBrace1990 @ 24 Aug, 2008 - 07:49 AM) *

http://www.learntoplayslotmachines.com/payouts.htm

ok, couple of things here....

1. this line, is too long... if((($one == 0) && ($two == 0 || $three == 0)) && ($one == $two || $one == $three || $two == $three))... you don't need the extra end of that (ie: $one == $two)... you already check that they all equal the same thing...

2. you're missing your { and }... add them in...

3. this line: echo $bet*3; will NEVER activate... the elseif is the exact same as the if, and the if comes first...

4. one again, this is all extra: && ($one == $two || $one == $three || $two == $three)



also the first line
CODE

if((($one == 0) && ($two == 0 || $three == 0)) && ($one == $two || $one == $three || $two == $three))

is only if 2 of the slots are the same so the next one
CODE

elseif ($one == 0 && $two == 0 && $three == 0)

is only if al three are the same


{ and } as far as im aware is the same as &&
User is offlineProfile CardPM
+Quote Post

JBrace1990
RE: Slots Payouts
24 Aug, 2008 - 10:57 AM
Post #5

D.I.C Regular
Group Icon

Joined: 9 Mar, 2008
Posts: 479



Thanked: 24 times
Dream Kudos: 350
My Contributions
uh, no.... { and } represent where your if and elseifs and elses start and end... >_>

i'm saying that this line:

php
if((($one == 0) && ($two == 0 || $three == 0)) && ($one == $two || $one == $three || $two == $three))

can be this instead:
php
if($one == 0 && $two == 0 || $three == 0){}

which is a LOT shorter and cleaner... $one will HAVE to equal $two or $three... you don't need to add that extra on there =/
User is offlineProfile CardPM
+Quote Post

ghqwerty
RE: Slots Payouts
24 Aug, 2008 - 11:07 AM
Post #6

D.I.C Regular
Group Icon

Joined: 8 Aug, 2008
Posts: 373



Thanked: 8 times
Dream Kudos: 25
My Contributions
but i need it to payout if 1=3, 2=3 or 1=2 not if all three are the same cos for that one it is just 2 needed to 'win'
User is offlineProfile CardPM
+Quote Post

JBrace1990
RE: Slots Payouts
24 Aug, 2008 - 11:10 AM
Post #7

D.I.C Regular
Group Icon

Joined: 9 Mar, 2008
Posts: 479



Thanked: 24 times
Dream Kudos: 350
My Contributions
this:
php
   1. if((($one == 0) && ($two == 0 || $three == 0)) && ($one == $two || $one == $three || $two == $three))  


Translates to this:

IF $one = 0 AND EITHER $two = 0 or $three = 0 AND $one = $two OR $two = $three OR $onw = $three

you're adding more then there needs to be... >_>
User is offlineProfile CardPM
+Quote Post

ghqwerty
RE: Slots Payouts
24 Aug, 2008 - 11:17 AM
Post #8

D.I.C Regular
Group Icon

Joined: 8 Aug, 2008
Posts: 373



Thanked: 8 times
Dream Kudos: 25
My Contributions
QUOTE(JBrace1990 @ 24 Aug, 2008 - 11:57 AM) *

php
if($one == 0 && $two == 0 || $three == 0){}

which is a LOT shorter and cleaner... $one will HAVE to equal $two or $three... you don't need to add that extra on there =/


i see where your coming from but what if only $two and $three are the same then that if statement wont work how i want it

i see your point but for what i want it doesnt fit and as mine works im not really fussed about making it cleaner or shorter etc i wil do that when i am a bit better at php

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 03:17AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month