Page 1 of 1

Poker in PhP

Posted: Mon Oct 06, 2008 4:40 pm
by shidagernade
Hi All,

I am creating a very simple online poker game. The main poker engine that evaluates hands, distributes cards etc. is created in PhP.. I am not sure how to make the front end.. like the part that will be run at the client end to receive user inputs like mouse clicks.. I know I need to use javascript to capture mouse events but I am not sure how communicate information between php and javascript... for example.. when a poker tournament starts, some php array should keep track of a players chip count... and that based on the amount of chips he bets that array need to be modified.. I am not sure how to implement this type of functionality..

I will appreciate any suggestions and comments..

Thanks

Re: Poker in PhP

Posted: Mon Oct 06, 2008 11:57 pm
by alex.barylski
You poker cards would be images hyperlinked back to scripts on the server.

Code: Select all

<a href="index.php?card=ace_spades"><img src="images/ace_spades.png" alt="Ace of Spades" /></a>
Your index.php would act as a central processor handling the reuqests and performing the required operations:

Code: Select all

<?php
 
  switch$_GET['card']){
    case 'ace_spades':
      echo 'Do whatever is required for the ace of spades';
      break;
    case 'club_ten:
      echo 'Do whatever is required for the ace of spades';
      break;
  }

Re: Poker in PhP

Posted: Tue Oct 07, 2008 3:25 am
by onion2k
I wrote the beginnings of a poker game in Javascript once... http://www.ooer.com/poker/ ...it's not even close to finished though. If you want the source code it's there for the taking. The js files are in /js and the card images are in /cards.

Not entirely sure how you'd tie that to some PHP mind you. Maybe some Ajax?

Re: Poker in PhP

Posted: Tue Oct 07, 2008 10:59 pm
by shidagernade
hi guys... thanks a lot for your comments.. but the main thing that I am confused about is maintaining the varialble values in PhP.. as I mentioned before.. I need to keep track of the chips of all the people playing at the table.. now that variable is maintained at the server side within the php code.. how can I access and update this varialbe whenever some one bets during a specific poker round..

thanks