Virtual Deck Of Cards

Published 2023-06-12



(v17 07-26-22)
TO LOAD THIS PICO-8 CART, in immediate mode, type: load #virtdeckcard

VVhat's new ?

07-26-22

Here, try it out, copy and paste these examples to see how they appear. Triple-click the field and press CTRL+C to copy it to the clipboard. Then in my engine either select PASTE FROM CLIPBOARD from the menu or just press CTRL+V in the engine.

52-cards already pulled and face-up. Reloading this clip will reveal the same cards each time.
ctable=$zzzzzzzzzz.H%zz%z.I1.L1.I%zz%z.R1z1.R%zz%z.HyIQ7GvUZ+ROWJLBTX08KEjwsFq6tN2Cg4VcSAdrpbiol3HxPDekh

52-grid boxes. Select from menu, "Place face-up cards in boxes." to pull and reveal all the cards. Reload this clip again for new cards each time.
ctable=.H%zz%z.R1.z1.711zz11.d1.z1.l!Q

The start to my "CAVERNS" game. See below. Select "Place face-up" from menu to reveal.
ctable=.m!F

5-Card Stud for 4-players, friends, or you control. You are at the bottom starting with 5 coins. Reveal and replace each card and coin as you go. Reload this clip again for new cards each time.
ctable=.G?L.21.Ia.0aa.0aa1.t1aa.0aa.0a.I1.2?L.o%GY

06-16-22

06-14-22

06-12-22

06-07-22

A FEW IMPORTANT NOTES:

If you activate auto-save every move it is instantaneous. You do not need to worry about the system slowing down even remotely for saving your work every move. This ability was automatic in the previous release, now you can choose whether to have it on or not through configuration menu.

06-02-22

06-01-22

05-31-22

Here is a game I made up called, "Caverns."

You place a single card face up in the center. You place another card. If it is minus 1 value or plus one value of the horizontal line center, then you lift that card up and place it next to the matching card vertically. The end result of the table will look like stalactites and stalagmites with all cards matched.

This program is a complete virtual green velvet table with a deck of cards, 52-in all, 6 pennies, and 6 dice. You can have 13 cards across by 11 cards down. You can lay down grid boxes to help you align where to place your cards. They can be face down or face up and can even be repositioned to another place on the table.

These cards can also be turned back over hiding their contents or discarded allowing you to pull new ones from the deck if you so desire.

It uses the arrow keys for navigation and the 2-standard joystick buttons of 🅾️ and ❎ to add and remove cards to the table.

The 🅾️ and ❎ also react in a special way depending upon whether the card it is on exists or not and if it is turned over or not. See below.

In running the cart, the deck of 52-cards will be shuffled. This shuffle method uses 2-different arrays and pulls a random card from the 1st pile to add it to the 2nd pile until all cards from the 1st pile are exhausted. This ensures a shuffling of the cards that is truly random.

After the shuffle the main screen will appear and there will be 3-values that appear at the bottom.

These are DECK to show how many cards remain in the deck. To start with there are 52 (I am not using Jokers).

The next item is PLAY to show how many cards are in play on the table above. This could be useful for counting score for your custom card games where the object is to remove matched cards from any method you develop.

The last item is DISC which keeps track of every card you have discarded and put in the EMPTY pile. This could also be used for scoring. Any cards that have been discard cannot be retrieved later - and if you use up all 52-cards, you cannot draw any new cards and must use what is on the table - or start over.

So if you have pulled or discarded each of the 52-cards, then you can select from the menu and choose RESET CART or press CTRL+R on your keyboard to start over with a fresh set of 52-shuffled cards and a clean table.

Both the 🅾️ and the ❎ keys have unique properties. See below.

Press 🅾️ on an empty square to add a grid box to the table. This does not count as a card and you can have as many as you would like on the table.

If you press 🅾️ on a grid box, a card will be pulled from the deck, face down, and replace the grid box.

If you press 🅾️ on a card that is face down, it will be turned over so you can see its contents.

If you press 🅾️ on a card that is face up, it is lifted and the cursor changes. Then you can use 🅾️ to reposition this card to an empty space or directly on top of another card to replace it thereby discarding of the one beneath.

If you press ❎ when you are in lifted mode, the mode will be canceled and the card you lifted along with the cursor will be returned from where you originally picked it up, still face up.

If you press ❎ on a card that is face up, it will be turned over hiding its contents.

If you press ❎ on a card that is face down, it will be discarded leaving a grid box here.

If you press ❎ on a grid box, the grid box will be removed leaving a blank space.

If you press ❎ on a blank space, two special items will occur. A coin will be flipped showing HEADS or TAILS in the top-left-hand corner and a single die will be rolled showing a value from 1-6 in the top-right-hand corner.

If you press ❎ AGAIN a new flipped coin will be added and a new die will be rolled. The totals will change. You can have up to 6 of these before the values reset.

To discard the coins and the dice merely move the cursor away one step.

If you cannot tell what a card is, position the cursor directly on it and an exact description of that card will appear in the text frame above.

What games can you think up with this engine ?

And that's it ! If you have any questions or suggestions, please let me know in the comments below.

Enjoi !

Please see below for earlier versions and descriptions.



(v00 05-30-22)
TO LOAD THIS PICO-8 CART, in immediate mode, type: load #virtdeckcard-0

I think we all write programs from one time to another not necessarily because we want to write a game for others to play or even something others can use in their own code - but for perfectly selfish reasons because we cannot find what we want written by other people.

I have examined no less than 20 card-flipping programs for my Android tablet and none do even close to what I wanted.

And as the term goes, "If you want something done right, do it yourself." so have I done so.

This is a bit more elaborate than a simple program that pulls a single card out of the deck to show it filling the full screen which is what most of them did.

If you press 🅾️ on a card that is face up, it and all cards to the right of it will be moved one tile across to the right. Any card at the extreme right can and will be discarded if it is there.

If you press ❎ on a square that has no card, all the cards to the right of this square will be moved one tile across to the left.

Overhauled entire engine.

New Dialog Window. When flashing "?" appears, use LEFT and RIGHT arrows to select choices followed by the 🅾️ key.

Select Quick LOAD/SAVE state to remember your work between reset. Select from menu "Configuration" to automate so your work is saved every time.

Added 7x7 pixel-image suits to show when you have the cursor over a face-up card on the table.

Press 🅾️ on a gold coin to remove it from the table.

Changed position of descriptions and card information.

Added single menu option to cover all previous menu options. Choose "custom cart menu" from menu to activate.

Fixed menu not to appear until table and cards are ready.

Added quick load + save state to table. now you can flip cards + change the table and then undo it all by quick loading your last saved state.

Added info to show if table has not yet been saved. If changes are to be saved, "S?" will appear in the bottom-right-hand corner of the screen.

Added to custom menu option ability to auto-save table for every move. Select last gear icon in custom menu selection. It will appear in the top-right-hand corner of the table to show activation.

Added place a face-up card option on every existing grid box on the table.

Wrote full and new joystick driver. Arrow keys are staggered, 🅾️ requires multiple presses now, and ❎ only registers a single stroke when released, not pressed.

With new joystick driver, you can combine ❎ and 🅾️ together to pull a card and place it face up on the cursor without added keystrokes.

You can also hold down any button or combination of 🅾️ or ❎ and 🅾️ together and then press arrow keys to auto-generate fields for those positions the cursor touches. This is a quick way to generate grids and face-up cards.

Auto-save to current layout is planned.

Load and Save to internal memory is planned. 32-slots will be available. This also works online.

Fixed moving card. Was not working properly for undo.

reissued color palette set.

Changed suit colors so they are easier to see. Thank you Lucky Charms cereal ! :)

You now have black spades, green clubs, red hearts, and blue diamonds.

Removed scrolling cards in favor of lifting and repositioning each card.

Added rolling a single die and flipping a coin ability. See below.