Recent

Author Topic: Current state of the art - solitaire smart hint feature  (Read 300 times)

TBMan

  • Sr. Member
  • ****
  • Posts: 281
Current state of the art - solitaire smart hint feature
« on: October 13, 2025, 04:31:58 am »
I developed code to give hints in a solitaire game. The current game is Eight by Eight (game #40). Eight by Eight is a difficult game to win as you can't fill empty table stacks with a card from other table stacks or the waste stack. The foundations are placed Ace through King. Two decks are used in the game. Also the deck is rolled over only 3 times so you literally run out of time.

The card placement rule for placing a card on a table stack or moving from one stack to another, in this game, is that the cards must be the same suit and the moving card must be one value lower than the target stack card. The game also allows for cards to be moved as a stack, as long as each card fits the rule in sequence. That makes creating a hint feature, and a game over feature, more involved than a game that only allows the top table stack card to be moved.  The technique for creating a movable stack I have had since the first solitaire game I coded, Klondike. The data structures for that game are slightly different than what I use now, although the same sort of data is dealt with. The concept of a "moving stack," which has the same data setup has a table stack, is now applied to the "movinghint" stack which I use in this game. The only difference is how I build the data, but that doesn't matter for this thread. Once I have the movinghint stack made, I test the first card in the movinghint stack against other table stack last cards. If the rule applies AND the card that the stack is moved FROM isn't the same as the target card, then the hint is supplied. If the last test isn't done, a lost game can't be calculated and the hint feature would just keep telling you to move the same cards back and forth from one stack to another. 

Here are two demo videos. The first one is the demo of the hint feature showing a stack of cards that can be moved and the second illustrates the "smart" hint feature of ignoring a card,  the 4 of spades, that could be moved back and forth between the two 5 of spades forever. Instead of recommending the table card, it suggests that the player turns the deck card over.

Basic  Hint demo:

https://youtu.be/EXdl2obGWGk

"Smart" hint demo:

https://www.youtube.com/watch?v=-gCRUPctzzc


I love programming.

Some things I've done using PTCgraph:

NFL Retro Football (almost finished):
https://www.youtube.com/watch?v=78mTtsd7ppk


Solitaire games:
https://www.youtube.com/watch?v=zmtxI7FdWuQ&list=PLa4BPpFl34iVhFwX1JZwVm3vE5ay_i3R2

 

TinyPortal © 2005-2018