Solitaire
Polymorphic solitaire engine in vanilla Javascript
Install / Use
/learn @oddstream/SolitaireREADME
Solitaire
To play the games, visit the live version.
For user-oriented information, please see the FAQ.
There is also a Lua/Corona SDK version of this at the Google Play Store.
Implementation
Written in vanilla ES2017 Javascript, formatted as per the Google style rules with JSDoc annotations to try to keep the Visual Studio Code type checker quiet.
Implemented as a small hierarchy of classes; a Card class and a Pile class, with classes derived from that for Stock, Waste, Foundation, Tableau &c. Some specialized piles, for example a Freecell tableau, get derived.
Each variant has it's own html file which contains layout information for each pile and gameplay rules for that variant. The html file consists of boilerplate header and footers, wrapped at build time around a central guts file and some SVG symbols. The build script (bake.tcl) requires Tcl to be installed and is hardwired to my folder configuration.
At run time, the layout information in the html is linked to the Javascript pile classes.
The graphics are implemented in SVG, so they scale smoothly.
Time has been spent making it compatible with both mobile and desktop versions of Chrome, Firefox and Edge. I think it runs The Best on a touchscreen Chromebook.
Philosophy
Keep it simple and facilitate the player's flow. So: no distracting graphics or animations, make the cards easy to scan visually, and no unnecessary features.
Also, make the games authentic, by taking the rules from reputable sources and implementing them exactly.
Known problems
-
Redeals and scorpion/spider symbols not displaying on a Chromebook. There's an open issue on the chromium tracker that relates: https://bugs.chromium.org/p/chromium/issues/detail?id=914919
-
Cards sometimes don't animate, so the card is displayed where it started, but the software thinks it's somewhere else. Can be cleared by reloading the page. May be linked to grabbing a moving card?
-
Dragging cards goes through phases of being unreliable, as browsers get updated. It's caused when the user agent sends an unwanted pointercancel event. It's currently fixed by having dummy touch start/move/end listeners so all the touch events get ignored.
Related Skills
node-connect
344.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
96.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
344.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
344.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
