Just before I start, I've added Flower Garden Solitaire Gloucestershire Solitaire, Spanish Solitaire, Stonewall Solitaire and a few others.
I've added these fairly quickly mainly due to my slightly clunky but it seems adequate design.
And it is this design that I want to write about as a way of getting my thoughts in order.
I started Solitaire Online as a coding challenge. The challenge wasn't so much to code a game of Solitaire, but rather to code a data driven game of Solitaire. This would in theory allow me to add many different games by changing a few bools.
So, has my design worked?
Well, the answer is yes and at the same time no, and this is partly due to a lack of domain specific knowledge. In other words, it turned out that my knowledge of Solitaire wasn't as thorough as I thought.
My design has worked to the extent that I can easily add new games of Solitaire. I added Brigade Solitaire while musing on what to write here. I didn't need to change the code in solitairemainjs. This contains the main functionality, and as I've added more games, the functionality has increased.
So, that is a definite win.
However, I'm still having to create a specific file for each new game of Solitaire that I create.
I would like to get to the point where I just read in a data structure.
That was my original idea.
The first part of the file sets a few bools and variables such as number of packs, whether suits have to match and so on. This would be easy to load from a file of some sort.
The second part of the fgame ile specifies the grid layout and how the cards are dealt.
This *could* be loaded from a file. I need to think about how to do this, and whether it's worth it for this particular project.