Skip to content

pyengwoei/playing-cards

 
 

Repository files navigation

playing-cards

PHP Playing Cards

PHP objects for playing card games. Create a card shoe and specify how many decks of cards to use.

The Shoe

__construct($decks);
dealCard();
discardCard(Card $card)
shuffleDeck();
getCardsRemaining();
resetShoe();

The Card

getSuit(); // eg. C, S, D, or H
getValue(); // eg. A, K, Q, J, 10, 9, etc
getAsText(); // eg. Ace of Spades
getSuitAsText();
getValueAsText();
flipCard(); // toggles crd face up or face down flipFaceDown();
flipFaceUp();
isFaceDown();
getHtml($id = null)
getJson();

The Player

__construct($id);
getID();
addCard(Card $card);
removeCard($cardval); // The card as a shorthand string ie 10D
addChips($amount);
removeChips($amount);
getBalance();

The Table

__construct(Shoe $shoe, array $players);
addPlayer(Player $player);
removePlayer($id);
getPlayers(); //returns an array object with iterator
getNumPlayers();
getBanker();
setShoe(Shoe $shoe);
addToPot($amount);
removeFromPot($amount);
getPotBalance();

About

PHP Playing Cards

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 88.7%
  • CSS 11.3%