Starting to add "Rules" to form a playable game.[/highlight]
Today I need to start getting the rules of Spider Solitaire to work, but as always will be looking for ways to reuse this code for all the future games.
-=-=-
The rules are fairly simplistic for this one.
You can only drop a card/group if the topmost card in your hand is one value below the card at the bottom of the pile.
You can also only lift a group if all the cards are in descending order.
With just those two simple rules, the majority of this game should instantly fall into place.
But trying to find a way to write those rules in code, when the code is in a separate function from the game, is going to be quite tricky I think.
Never-the-less, that's today's goal, and without it working properly, there's quite that can go wrong with the engine.
I'll also need to double/triple check along the way, that future tweaks don't break existing games, so whatever I do manage to code today will have to be as reusable as possible for future games.
.. Nice and easy, then!!
Views 64, Upvotes 4
Daily Blog