project: spider solitaire

2021-05-09 - 2021-06-17
a terminal based game of spider solitaire

this is a low memory game of spider solitaire. it is terminal based. this spider solitaire works properly on impetuOS and linux.

there is a small level of autoplay but it is unable to complete a game alone. initially i was going to work on a more complete AI for it but this started to use enough RAM that the primary goal(impetuOS on SLAB1) was starting to seem unacheivable.

this has been won at least twice on PILE1 and at least once on SLAB1

this is implemented in C and is built with make; there are no external dependencies beyond stdlib.

it has been verified on arm CM4 by playing through and verifying free heap before and after.

when run in valgrind on amd64 there were no lost memory errors. it has been a long time but i think there were a couple of other valgrind errors when valgrind was set to be harsh

the game is played by entering commands such as 'mb2a' which would move the stack from b2 to the top of stack a. there is a hint command 'h', an automove 'a', an autoplay 'b', and quit 'q'. some revisions also have history and can be gone back by using the 'u' command. cards are dealt with the 'd' command

there is only a single suit(hearts) that is why all visible cards are red. unshown cards are shown as (xx), visible cards as (sn) where s is the suit and n is the number(k,q,j,t,a for named cards)

as this uses a pseudorandom number generator it is useful to start a new game by running n <$number> where $number is a seed to start a new game

blog

date: 2023-10-03 03:03:53 other projects: impetuOS
for a long time there has been a bug in impetuOS heap which will cause memory to be lost
not anymore! it has been fixed and spider solitaire works properly