PHP Classes

Csx PHP Texas Holdem Poker: Manage and display Texas Holdem cards

Recommend this page to a friend!
  Info   Example   Screenshots   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStar 39%Total: 863 All time: 4,061 This week: 571Up
Version License PHP version Categories
csxtexasholdempoker 1.0GNU General Publi...4.0Games
Description 

Author

This class can be used to manage and display Texas Holdem cards.

It can shuffle the cards, deal the cards and evaluate hands.

The class can also present the cards in an hand by using separate image files.

Picture of Martijn Loots
Name: Martijn Loots <contact>
Classes: 2 packages by
Country: The Netherlands The Netherlands
Age: 62
All time rank: 55115 in The Netherlands The Netherlands
Week rank: 47 Up1 in The Netherlands The Netherlands Up

Example

<?php

////
//// Version : index.html to CsxTexasHoldemPoker.class.php version 1.0
////
//// Author : (c) 2008 Martijn Loots, Cosix Automatisering, The Netherlands
//// See also: www.cosix.com
////
//// License : GNU General Public License, see "gnugpl.txt" for more
//// information
////

// Cosix Texas Hold'em Poker - demo of class

include_once "CsxTexasHoldemPoker.class.php";


function
showgame($theGame) {
 
$theGame->newDeck();

 
$theGame->showDeck();

 
$theGame->dealPockets();
 
$theGame->showPockets();

  echo
"<p>Community cards:&nbsp;";
 
$theGame->dealFlop();
 
$theGame->showFlop(); echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";

 
$theGame->dealTurn();
 
$theGame->showTurn(); echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";

 
$theGame->dealRiver();
 
$theGame->showRiver(); echo "</p>";

 
$theGame->rankHands();
}

if (isset(
$_REQUEST["thpsel"])) {
 
$thpsel = (($thpsin = $_REQUEST["thpsel"]) < 2 || $thpsin > 9) ? 0 : $thpsin;
}

?>
<html>
  <head>
    <title>CsxTexasHoldemPoker Class Demo</title>
  </head>
  <body>
    <h2>CsxTexasHoldemPoker class - PHP Texas Holdem Poker engine - <a href="demo.html"
    target="_new">demo</a></h1>
    <form name="thpform" action="demo.php" method="POST">
      CsxTexasHoldemPoker Class - Select game:&nbsp;
      <select name="thpsel">
        <option value="0"<?if($thpsel==0)echo" SELECTED";?>>- select number of players -</option>
        <option value="2"<?if($thpsel==2)echo" SELECTED";?>>Heads Up</option>
        <option value="3"<?if($thpsel==3)echo" SELECTED";?>>Three Handed</option>
        <option value="4"<?if($thpsel==4)echo" SELECTED";?>>Four Handed</option>
        <option value="5"<?if($thpsel==5)echo" SELECTED";?>>Five Players</option>
        <option value="6"<?if($thpsel==6)echo" SELECTED";?>>Six Players</option>
        <option value="7"<?if($thpsel==7)echo" SELECTED";?>>Seven Up</option>
        <option value="8"<?if($thpsel==8)echo" SELECTED";?>>Eight Players</option>
        <option value="9"<?if($thpsel==9)echo" SELECTED";?>>Nine's a crowd</option>
      </select>
      &nbsp;<input type="submit" name="sub" value="Go (again ?)" />
    </form>
    <?
     
if ($thpsel > 1 && $thpsel < 10) {
       
$game = new csxTexasHoldemPoker($thpsel);
       
showgame($game);
      }
   
?>
</body>
</html>


Details

//// //// Version : README to CsxTexasHoldemPoker.class.php version 1.0 //// //// Author : (c) 2008 Martijn Loots, Cosix Automatisering, The Netherlands //// See also: www.cosix.com //// //// License : GNU General Public License, see "gnugpl.txt" for more //// information //// Files with the package: CsxTexasHoldemPoker.class.php - the class file index.php - the demo of the class demo.html - brief explanation on functionality cardsbig.tgz -> carddecks/classic - a set of classic card images cardsmed.tgz -> carddecks/medium - the same set a bit smaller cardssml.tgz -> carddecks/small - the same set very tiny gnugpl.txt - the GNU General Public License text index.html (several) - basic browsing prevention Requirements: PHP4 or higher Installation: Just put it in some viewable subdirectory on your webserver. Use: See index.php for a proof of concept implementation and feel free to add even more comments to the class file if you need it...

Screenshots (1)  
  • CsxTexasHoldemPoker.png
  Files folder image Files (9)  
File Role Description
Plain text file cardsbig.tgz Data big card images
Plain text file cardsmed.tgz Data medium size card images
Plain text file cardssml.tgz Data small sized card images
Plain text file CsxTexasHoldemPoker.class.php Class Class file
Plain text file demo.html Doc. demo description
Plain text file demo.php Example class demo
Plain text file gnugpl.txt Lic. license
Plain text file README Doc. readme

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:863
This week:0
All time:4,061
This week:571Up
 User Ratings  
 
 All time
Utility:50%StarStarStar
Consistency:50%StarStarStar
Documentation:56%StarStarStar
Examples:37%StarStar
Tests:-
Videos:-
Overall:39%StarStar
Rank:3894