Pages

Thursday, 21 September 2017

RetroChallenge 2017/10: Pyramid Solitaire

I saw my wife playing Pyramid Solitaire on the MS solitaire games collection for Windows 10. I immediately thought, hey you don't need a Windows 10 class computer to play a simple game like that!  I could program that on an MC-10!  I dug out a game I had converted recently from Coco Basic. Solo Poker by James Garon.  I had seen the original in a video by the HighRetrogamingLord:
I had simply converted it from using the hires graphics screen to using lowres Semigraphics 4 representations of the playing cards.
I had created this card set for several prior card games like Crazy 8s. Since Garon had worked out a nice little routine for "shuffling" the deck and I had already worked out routines for displaying the cards, all I had to do was figure out the rules to Pyramid Solitaire and put those routines to use. I ran the MS Card games pack and called up the help screen for Pyramid Solitaire.  A little research on Wikipedia helped clarify some issues.

First I made a routine to lay out the first 28 cards out from the randomized deck in a pyramid, starting with the top card.  Then I created a simple cursor routine to jump between the cards in a diamond direction pattern using the ASZX keys.  It just checks that it doesn't jump off into the cyan border area around the cards.  As part of that routine I took note of the card value of the current card highlighted by the cursor.  Hitting (Enter) would select and reverse video that value and then allow you to move again to select another card, or simply choose from the deck (D) or from the wast pile (W).  Pressing (C) would cycle the cards from the deck to the waste pile for a max of three cycles.

The biggest challenge was creating a refresh routine for the pyramid that would recreate the proper illusion of the cards lying on top of each other with some being only partially revealed as they alternate from top to bottom.  In the end it was simplest just to blank the removed cards and then refresh the pyramid from top to bottom and the top of the piles, but leaving out removed cards.

The whole process took surprisingly little time. I am getting proficient creating simple card games. Don't know what to try next, but if anyone out there has any ideas of card games they would like brought to the MC-10, or Coco, just let know.  Here's what the final product looked like:
And this is what happens when you win:
After playing the game for a while I got much better at it.  At one point I had a real run of victories.  5 to be exact, with no losses.  A total fluke I think.

No comments:

Post a Comment