After many years thinking about programming this on other libraries, I finally programmed a French solitaire using P5js.
It is slightly different from Klondike, since it uses two decks, you can place ANY card (not only kings) on empty foundations and dealing rules are not the same.
(If someone gives me the name of this kind of solitaire, I would be grateful to know).
Works is still on progress: it can’t detect a victory or a defeat, and you can’t undo your moves. But it is playable and enjoyable.
You can see it at:
It took me 24 hours split over three days.
Yours,
José G Moya Y.
Please notice there was a bug with dealing. I fixed it 12 hours after my post. But, another 12 hours later, I discovered that my fix had not been properly saved and a syntax error was thrown.
I hope it works now.
I’m thinking about:
A) Adding an undo option [unlimited? 3 moves in advance? Until you reveal or deal?]
B) Adding a fullscreen button (adding the button itself is easy. The tough part is I have to reload the cards from the SVG).
I’ve added a fullscreen mode and a winning detection routine.
I also changed a rule, following the suggestion of my sister, an expert on this kind of solitaire:
When you deal and have an empty pile, you deal just one card on the pile.
But when you deal and have face down cards, you shouldn’t deal.
Is there a new sketch, or is it the same one posted above? In the sketch above, there is a fullscreen button, finishing the game does not appear to trigger the winning detection routine – at least, nothing happens when the decks are loaded, and the cards remain draggable.
Hummm… Winning routine is triggered only if all cards are on the decks, but maybe it is broken somewhere.
Fullscreen does not work --at least not how I wanted it. Playing in my smartphone with fullscreen renders cards at same size as when playing in the small browser with headings.