I have recently added Golden Spider Solitaire , so I want to talk about it:)
As I mention on the home page, Solitare Online is a place where I can create and add the games of Solitaire that I want to play.
Some are old fashioned varieties that you won't find in many places like (Quadrille Solitaire), and others are more to allow me to play me play with themes.
Golden Spider Solitaire is a case in point. It is a variety of Spider Solitaire where you are allowed to deal even when one of the columns is empty (which isn't allowed in Spider).
And so, I decided to add a golden spider theme.
Many years ago, I worked on AAA titles as a games programmer, as I have always missed a part of that type of work. I don't miss the long hours, crunch times and the mundane content that is often produced, but I do miss coding which can be fun.
And Solitare online lets me scratch this itch.
My admittedly retro design is working well regarding extensibility and additional games of Solitaire.
The code isn't as *pretty* as I would like. I never bothered refactoring it once I had fully understood what was required. The overall structure is however pretty good.
As a programmer you might well look at it, and shake your head in disgust at the globals, the old school design and so on.
The fact is though, that this style works well in many *simple situations* - especially where only one person is involved and you don't need to worry about polluting the global namespace/maintenance. I don't need to worry as I'm not using any libraries or frameworks.
By the way, I was a C++ and C programmer so do know about OOP, and why globals are bad and this structure can be (or is) largely considered sub-optimal.
The fact is that a similar setup was used in many reasonably large games back in the day - perhaps with better naming conventions.
I can create additional games of Solitaire just by including a different javascript file with a few settings. I am aware of the other more sophisticated approaches, and I have used them. Sometimes though, going back in time rocks.
It also lets me add themes which are completely separate from the main game. Again this is done by including a javascript file.
Again, if you are a programmer, although I'm not necessarily advocating this style is the way forward, I would suggest that there are often simple solutions exist that work.
I haven't worried about reusability for my animation code. I've copying and pasting as necessary. I don't anticipate any of the animations becoming particularly sophisticated.