Go Back   RunUO - Ultima Online Emulation > Developer's Corner > Programming > Script Languages

Script Languages Perl/PHP/Python/Ruby so on and so forth.

Reply
 
Thread Tools Display Modes
Old 11-11-2007, 01:06 PM   #1 (permalink)
God of Pandora
 
KillerBeeZ's Avatar
 
Join Date: Jun 2003
Location: Gainesville GA
Age: 31
Posts: 2,000
Default php poker problem

I am working on a small poker program for my site in PHP.

I have many of the hands scripted and ready, but pairs, full houses and trips are being a pain.

The problem area is in the pairs, sometimes it shows up that its a pair on the site, and other times not (even if there is definatly a pair... see attatched image).

this is the problem area (sorry for not putting it in code box, it wont let me do so without deleting the $c1n and such)

// Pair
else if ($c1n == $c2n | $c1n == $c3n | $c1n == $c4n | $c1n == $c5n)
{
echo ("<br><b><h2>Pair - No Prize</h2>");
}
else if ($c2n == $c3n | $c2n == $c4n | $c2n == $c5n)
{
echo ("<br><b><h2>Pair - No Prize</h2>");
}
else if ($c3n == $c4n | $c3n == $c5n)
{
echo ("<br><b><h2>Pair - No Prize</h2>");
}
else if ($c4n == $c5n)
{
echo ("<br><b><h2>Pair - No Prize</h2>");
}

echo ("<br>CN - c1n = $c1n, c2n = $c2n, c3n = $c3n, c4n = $c4n, c5n = $c5n<br>CS - c1s = $c1s, c2s = $c2s, c3s = $c3s, c4s = $c4s, c5s = $c5s<br>Cards - C1 = $c1, c2 = $c2, c3 = $c3, c4 = $c4, c5 = $c5");


As you can see in the image, there is a pair of Queens. The debugging info below the cards "CN - c1n = 13, c2n = 12, c3n = 2, c4n = 11, c5n = 12" show that c2n and c5n are both 12 (queen) the code above "else if ($c2n == $c3n | $c2n == $c4n | $c2n == $c5n)" more specifically "$c2n == $c5n" shows that the statement should be true right? if so the echo code should be displayed... yet its not.

Now, keep in mind that I am new to PHP. I thank my C# background for allowing me to get this far, but maybe I screwed it up somewhere where php is different than C#

Any help you can give me as to why this is happening and/or how to fix it will be appreciated.
Attached Images
File Type: gif Clipboard01.gif (21.6 KB, 27 views)
__________________
The Den of KillerBeeZ...Kender's Komments, uncensored commentary from the Kender. Plus anything else the Kender might have in his pouches.
KillerBeeZ is offline   Reply With Quote
Old 12-26-2007, 11:44 PM   #2 (permalink)
Forum Expert
 
PerfectWing's Avatar
 
Join Date: Oct 2002
Location: USA, Ga.
Age: 24
Posts: 1,202
Send a message via ICQ to PerfectWing Send a message via AIM to PerfectWing Send a message via MSN to PerfectWing Send a message via Yahoo to PerfectWing
Default

It's been a very, very long time since I've coded in any PHP, but could it maybe have something to do with using a bitwise operator | (or) as opposed to the logical operator || (or)?
PerfectWing is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5