Giter VIP home page Giter VIP logo

minimalklondike's Introduction

Minimal Klondike Solver

Finds minimal length solutions for the thoughtful version of Klondike (Patience) Solitaire.

Piles

  • A = Waste Pile
  • B = Clubs Pile
  • C = Diamonds Pile
  • D = Spades Pile
  • E = Hearts Pile
  • F = Tableau 1
  • G = Tableau 2
  • H = Tableau 3
  • I = Tableau 4
  • J = Tableau 5
  • K = Tableau 6
  • L = Tableau 7

Deck Format

I took the format from an old web site, it's not the best, but haven't got around to adding anything better.

Each card is 'RRS' where R=Rank and S=Suit. Rank goes from 01 - 13 and Suit goes from 1 - 4 (Clubs,Diamonds,Hearts,Spades)

ie) 052 = 5 of diamonds

Position of cards in deck string:

 A        B  C  D  E

 F  G  H  I  J  K  L
01 02 03 04 05 06 07
   08 09 10 11 12 13
      14 15 16 17 18
         19 20 21 22
            23 24 25
               26 27
                  28

Draw pile 29-52

072103023042094134111092051034044074114052123011083122012131091082124064014093033112071104132053133102084041013073063031061043081054113062024021101022032121

Would equate to this (+ represents visible cards), the 7C is the first card to be turned over in the draw pile when drawing one at a time, then TS, KD, etc...:

  A        B  C  D  E

  F  G  H  I  J  K  L
+7D TH 2H 4D 9S KS JC
   +9D 5C 3S 4S 7S JS
      +5D QH AC 8H QD
         +AD KC 9C 8D
            +QS 6S AS
               +9H 3H
                  +JD

 7C TS KD 5H KH TD 8S
 4C AH 7H 6H 3C 6C 4H
 8C 5S JH 6D 2S 2C TC
 2D 3D QC

Moves

Are in the format XY, where X is the character of the source pile, and Y is the character of the destination pile. '@' represents a draw

ie) For the above deal with a draw count of 1 running this sequnce of moves would result in the following state:

 "IC @@AL KL @@AK @@@@@AE LJ AK LK"

  A        B  C  D  E
 8S          AD    AH
  F  G  H  I  J  K  L
+7D TH 2H 4D 9S KS JC
   +9D 5C 3S 4S 7S JS
      +5D+QH AC 8H QD
             KC 9C 8D
            +QS+6S+AS
            +JD+5H
            +TS+4C
            +9H+3H

 7H 6H 3C 6C 4H 8C 5S
 JH 6D 2S 2C TC 2D 3D
 QC
+TD+KH+KD+7C

minimalklondike's People

Contributors

shootme avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

minimalklondike's Issues

Counterexample to MinimalKlondike solution

Hello ShootMe

I discovered a counterexample to MinimalKlondike finding the fewest possible moves for any deal, including unsolvable deals. The link is https://greenfelt.net/klondike?game=2095819838.

MinimalKlondike finished the search with a score of 10 in 54 moves. The "high scores" button shows a score of 10 in 53 moves. This may be a trivial counterexample but I thought you might be interested. It is my understanding that MinimalKlondike performs an exhaustive search of all possible moves. In this particular case, a move was saved by not playing the 4-hearts onto the 5-clubs.

Thanks to MinimalKlondike, the skills that I have acquired improve daily and the joy that I experience playing Klondike exceeds my expectations.

How to make sure this is the minimum solution

thanks for sharing this solution , but I hava some questions.

1.How to make sure this is the minimum solution?

2.It's hard for me to understand the solve process , Can share your thinking?

thanks.

Please solve GreenFelt deal 1492773577 using MinimalKlondike

Hello ShootMe

Would you please run this command line on MinimalKlondike with a sufficiently large value for -S option to generate a solution.

klondike -S 500000000 1492773577

The above command line ran on my laptop for several hours without a solution while using the maximum available memory on my 16GB system.

This deal is solvable as evidenced at https://greenfelt.net/klondike?game=1492773577.

Please post the solution and the value used for -S option.

Thanks for your assistance.

Use MinimalKlondike to solve any deal in the GreenFelt database

ShootMe stated in a previous thread:
"Go ahead and redownload the zip. I added a way to just specify a seed from GreenFelt

Klondike.exe Seed#

Will solve that given seed. You can also specify -D 3 if you want to solve the draw 3 variant"

Wow...pure genius...but you just opened the door to cheating on GreenFelt on a massive scale!

How were you able to retrieve the starting positions of the full 52 card deal? I previously tried inspecting the html code to retrieve the deal order without any success. Do you have access to some sophisticated html debugging software? To my knowledge, nobody who uses the GreenFelt site has ever succeeded in breaking the html code to retrieve the deal order.

Where I made an error ?

this is my klondike command : Klondike.exe 062122133041014042081034084111053124132083091113022071074023082033131021061104043064092054134

this is my cards : 6D,??,??,??,??,??,??,
QD,??,??,??,??,??,??,
KH,??,??,??,??,
4C,??,??,??,
AS,??,??,
4D,??,
8C,

and this is deck(drawing cards) : 3S,8S,JC,5H,QS,KD,8H,9C,JH,2D,7C,7S,2H,8D,3H,KC,2C,6C,10S,4H,6S,9D,5S,KS

when I run command witout initial move. it gives this output : Klondike.exe 062122133041014042081034084111053124132083091113022071074023082033131021061104043064092054134
Deal: 031112012094033022071023111021072032122104064121043062044133061024073114082052054083102134124074132013081053092011113084034103091014051063042093131101123041

A B C D E

F G H I J K L
+3C JD AD 9S 3H 2D 7C
+2H JC 2C 7D 3D QD
+TS 6S QC 4H 6D
+4S KH 6C 2S
+7H JS 8D
+5D 5S
+8H

TD KS QS 7S KD AH 8C
5H 9D AC JH 8S 3S TH
9C AS 5C 6H 4D 9H KC
TC QH 4C

Moves: IK KI @ak @@@al @@AE GE @@@@ab AH HG @@ag JG IG IB FB JF AJ @@ah @ah @ad LI IK @@ak @@@ai @AJ @@ab AI LK LH LD AJ AK AB AD JF KI AK AF JF JE KF KE FE FB IL IE KG LI HL HC KC GC GD IC GC ID GD GE IC FC ID GD IE LC GC ID GD IC GC ID LI LC LB FB FE IB FB IE FE IB FB IE FE IB AC AD AD

(Deal Result: Minimal Foundation: 52 Moves: 110 Rounds: 1 States: 3272426 Took: 00:00:08.9502218)
Done 00:00:09.1256026 in description you said + represents visible card but I dont have 3c at my screen. and my game version does'nt allow undo action. Here is the screenshot of fresh game .
image
in moves it says IK KI it means table4 to 6 but you cant move 4C to 4D
any help appreciated.

Feature Request - notify user immediately if deal is solvable

Hello ShootMe

MinimalKlondike is amazing on GreenFelt. As I told you previously, I have used it hundreds of times to only attempt to solve deals that are actually solvable.

My understanding is that the your code will often require a lengthy time to find the minimal solution. It would be a great timesaver if, prior to searching for the minimal solution, the code outputs a message informing the user that the deal is solvable.

Thanks for your assistance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.