PESolitaire is written, designed, and maintained by PicturElements.
You are allowed to improve, modify, and share this work in any way you like, per the specifications of the MIT license. It is also appreciated if credit is given. More info can be found here.
PESolitaire relies heavily on vector graphics to produce a crisp and clean user layout. Every card is in fact generated by the script using SVG paths. Each icon of the four suits is created using a single path, which means a standard deck of cards requires 336 paths in total. Data such as path data and icon placement data is stored in the script and can be modified as seems fit. The suit icons are designed to be drawn using so-called relative offset values relative to the center of the icon, which makes for easy and uniform placement of the icons.
I've personally never seen anybody use SVG for something like this, as many prefer to use image sprites instead. So this is also an experiment that shows how versatile SVG is and how pretty and crisp the results are, and especially that SVG still renders quickly and reliably to make pretty and functional graphics.
Storing game logic
Solitaire is all about simple rules. Can I put this card on this tableau? How many cards can I move at once? It turns out that these rules are relatively easy to store as data in arrays and objects. This has a few big benefits:
1. Support for many solitaires
As logic doesn't have to be hardcoded into the script, this means that the code supports a large amount of different solitaires out of the box.
2. Flexible game library
As it's actually possible to store rules in data, it's also easy to add more solitaires by simply adding another one to the input data. The script will be able to just generate it without you having to tinker with the code itself.
To see how solitaires are stored in PESolitaire, and how to add your own, click here.
PESolitaire v1.0 - License
Copyright 2017 PicturElements
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.