Warning: Array to string conversion in /home/a067cyberlearner/public_html/MyFirstSite/Work/PHPMYSQL/CH3/Pyramid.php on line 12

Printing the contents of the Array array
Array
(
)

Warning: Undefined array key "handCard" in /home/a067cyberlearner/public_html/MyFirstSite/Work/PHPMYSQL/CH3/Pyramid.php on line 33

Warning: Undefined array key "upCard" in /home/a067cyberlearner/public_html/MyFirstSite/Work/PHPMYSQL/CH3/Pyramid.php on line 34

Warning: Undefined array key "deckState" in /home/a067cyberlearner/public_html/MyFirstSite/Work/PHPMYSQL/CH3/Pyramid.php on line 35

Warning: Undefined array key "handState" in /home/a067cyberlearner/public_html/MyFirstSite/Work/PHPMYSQL/CH3/Pyramid.php on line 36

Warning: Undefined array key "discardState" in /home/a067cyberlearner/public_html/MyFirstSite/Work/PHPMYSQL/CH3/Pyramid.php on line 37
Pyramid Solitaire Game

This is the first attempt at a real type of card game.

Guess what, I tried a hard one!

The name of the solitaire game is Pyramid.

I scratched a pyramid map of cards onto some notepaper so I could see what it looked like to have the cards numbered in front of me then diagrammed the dependences of each card being "exposed" to be able to use and remove from the hand.

Structured English to Complete the Game

  • For this game the upCard is really two cards. In other words we will always have the current card showing from the "Pile" and the card we have currently showing as the upCard. Those aren't the discards though. The discards are the ones that add up to 13. So we need to implement another array to hold all of the cards in the current working pile. When you flip a card the last card you flipped buries the rest of the cards and so on. The object of the game is to get rid of ALL your cards: the deck (the upCard is the top card in the deck), the pile (show the top card as your second card), and the pyramid. So you need to implement a new array for this pile of cards that keeps getting buried as you look at the cards in the deck. We can just call this handPile for example.
  • Write a function to move cards onto the top of the handPile from the upCard.
  • Change the output form to include the handPile. The last card in the handPile should always have a radio button to include it as a passed value such that it can be moved to the discard pile as a sum of 13 with another card. Once you have this set up you have the whole gameboard ready!
  • If the two dependent elements in the hand array are empty ("") print out the radio button associated with this card.
  • If there are less than or more than two cards selected do nothing and return a status message of "You must select only two cards!".
  • If the two cards selected <> 13 do nothing and return a status message of "Your two cards must total 13".
  • If the two cards selected = 13 then remove cards to the discard pile.
  • If count(deck) = 0 return status message of "YOU LOSE!"
  • If count(deck) AND count(handPile) AND count(pyramid) = 0 then return status message of "YOU WIN"
These are just more scratch notes really. Perhaps there are some logical errors. I am sure you will find them as you complete the game :D.
It is Currently Round: 0

Warning: Undefined variable $gameStatusMessage in /home/a067cyberlearner/public_html/MyFirstSite/Work/PHPMYSQL/CH3/Pyramid.php on line 399
Current Hand: 28
Cards Remaining In The Deck: 24
Current Discard Pile: 0

Warning: Undefined variable $currentDiscardPile in /home/a067cyberlearner/public_html/MyFirstSite/Work/PHPMYSQL/CH3/Pyramid.php on line 406