[Game] AHK Klondike Solitaire

Post your working scripts, libraries and tools
User avatar
SpeedMaster
Posts: 226
Joined: 12 Nov 2016, 16:09

[Game] AHK Klondike Solitaire

16 Jul 2018, 06:10

Klondike Solitaire

- Revision 6 (2018-08-10) -
added option to move any card not only a King on a empty tableau column.
- Revision 5 (2018-07-26) -
added "Thoughtful Mode" (aka Saratoga) - ( Press button F4 to reveal hidden cards )

Download: :arrow:
Klondike_Solitaire_v2.0.ahk
(271.46 KiB) Downloaded 43 times
klondike.png
klondike.png (100.91 KiB) Viewed 942 times
After Mahjong I also managed to program Klondike :facepalm: :D

Screeshot Thoughtful mode
Spoiler
Cheers
Last edited by SpeedMaster on 09 Aug 2018, 18:00, edited 6 times in total.
Helgef
Posts: 3200
Joined: 17 Jul 2016, 01:02
Contact:

Re: [Game] AHK Klondike Solitaire

16 Jul 2018, 06:20

Cool, thanks for sharing :thumbup:

Cheers.
burque505
Posts: 585
Joined: 22 Jan 2017, 19:37

Re: [Game] AHK Klondike Solitaire

16 Jul 2018, 16:16

Hi, it looks really good. I can't move aces to the top, though. I also can't move a stack to an adjacent pile. Win7, 64-bit, 125% scaling. Could the scaling have anything to do with it?
Regards,
burque505
User avatar
SpeedMaster
Posts: 226
Joined: 12 Nov 2016, 16:09

Re: [Game] AHK Klondike Solitaire

16 Jul 2018, 17:03

burque505 wrote: I can't move aces to the top... Could the scaling have anything to do with it?
Yes :? the game does not support dpi scaling :cry:
Thanks for pointing out this problem. ;)
I fixed the script by disabling dpi scaling :roll:
(add gui, -dpiscale at the top of the script) :thumbup:

Cheers
burque505
Posts: 585
Joined: 22 Jan 2017, 19:37

Re: [Game] AHK Klondike Solitaire

16 Jul 2018, 18:21

Excellent, works perfect with the change! :bravo:
Thanks!
Regards,
burque505
User avatar
Relayer
Posts: 116
Joined: 30 Sep 2013, 13:09
Location: Delaware, USA

Re: [Game] AHK Klondike Solitaire

18 Jul 2018, 11:03

Great program. I love to see how people do different tasks. Even though this has been done before in other code it is always fun to see how it can be done, and done this well, in AHK. Thanks.

I found something I didn't like though. The code unconditionally copies all *.png to the folder intended to hold the card faces. I had a bunch of .png files in the folder where I launched the script and it moved all my files. :evil: A simple modification neutered this behavior.

Code: Select all

loop, parse, tileset, "`,"
{
 if !fileexist(a_scriptdir . "\tiles_cards\" . a_loopfield . ".png")
 extract_tile(%a_loopfield%_Data, a_scriptdir . "\tiles_cards\" . a_loopfield . ".png")
}

;filemove, *.png, tiles_cards\*.*
It may just be a peeve of mine but I believe code should "do no harm". I'm always careful to not disturb anything that is not meant to be under direct control of the script.

Again, good work!
Relayer
User avatar
SpeedMaster
Posts: 226
Joined: 12 Nov 2016, 16:09

Re: [Game] AHK Klondike Solitaire

18 Jul 2018, 12:38

Relayer wrote:The code unconditionally copies all *.png to the folder intended to hold the card faces. I had a bunch of .png files in the folder where I launched the script and it moved all my files. A simple modification neutered this behavior.
You have made a good point here. I apologize for this inconvenience. :oops:
I did not notice this behavior because I am always testing my scripts on an empty isolated folder + secure virtual environment :? :!: .
I added your fix to the script. Thanks :thumbup:


Cheers
corstar
Posts: 6
Joined: 07 Apr 2018, 05:26
GitHub: corstar
Contact:

Re: [Game] AHK Klondike Solitaire

19 Jul 2018, 19:02

That's impressive. Thanks for uploading it.
gwarble
Posts: 240
Joined: 30 Sep 2013, 15:01

Re: [Game] AHK Klondike Solitaire

24 Jul 2018, 22:25

Awesome work

Bug: switching red/blue cards mid game makes all non-top level cards show as upside down but act as they were

Recommendations:
Drag from anywhere on the card, rather than snapping to the fixed drag point

Put the rounded rectangle black line border around the upside down cards too, and ditch the square outlines on the table, or make them rounded rects smaller than the cards, so they only show in empty spots
EitherMouse - Multiple mice, individual settings . . . . www.EitherMouse.com . . . . forum . . . .
User avatar
SpeedMaster
Posts: 226
Joined: 12 Nov 2016, 16:09

Re: [Game] AHK Klondike Solitaire

25 Jul 2018, 11:06

gwarble wrote:Bug: switching red/blue cards mid game makes all non-top level cards show as upside down
Fixed :thumbup:
gwarble wrote:Recommendations:
Drag from anywhere on the card, rather than snapping to the fixed drag point
Implemented :thumbup:
gwarble wrote:Recommendations:
Put the rounded rectangle black line border around the upside down cards too
Implemented :thumbup:
corstar wrote:ditch the square outlines on the table, or make them rounded rects smaller than the cards, so they only show in empty spots
Fixed :thumbup:

Thanks for your bug report and suggestions
Cheers,
User avatar
Relayer
Posts: 116
Joined: 30 Sep 2013, 13:09
Location: Delaware, USA

Re: [Game] AHK Klondike Solitaire

26 Jul 2018, 06:09

I like this a lot. Thank you.

Here's a challenge: Have the script look ahead enough to provide a hint for the next move. Sometimes a user stares at a game of solitaire but for some reason doesn't see an obvious move. It would be clever to be able to ask the computer if the game is truly over. It would be an interesting programming project.

Relayer
User avatar
SpeedMaster
Posts: 226
Joined: 12 Nov 2016, 16:09

Re: [Game] AHK Klondike Solitaire

26 Jul 2018, 18:20

Relayer wrote:Sometimes a user stares at a game of solitaire but for some reason doesn't see an obvious move.
Hey that's part of the fun :mrgreen: (I personally don't like hints)
I still wonder what is the point of playing a hidden object game with flashing hints :wtf:
Relayer wrote:It would be clever to be able to ask the computer if the game is truly over.
Yeah that would be great but i don't have any idea on how to implement such algorithm :think:

Cheers,
User avatar
SpeedMaster
Posts: 226
Joined: 12 Nov 2016, 16:09

Re: [Game] AHK Klondike Solitaire

26 Jul 2018, 18:41

New Version

Revision 5 (2018-07-26)

  1. added " Thoughtful Mode " 8-)
    Press button F4 to reveal hidden cards :thumbup:
Cheers :wave:
Ferry
Posts: 8
Joined: 10 Jul 2014, 15:55

Re: [Game] AHK Klondike Solitaire

02 Aug 2018, 02:51

Great script!!! Can you build in an "undo" (last set) option? :-)
User avatar
Relayer
Posts: 116
Joined: 30 Sep 2013, 13:09
Location: Delaware, USA

Re: [Game] AHK Klondike Solitaire

08 Aug 2018, 12:58

Hi,

Another enhancement idea... other solitaire games allow you to double click on a card and the pending logical move for that card is made for you so that you don't have to drag and drop the card yourself. It would be a nice addition!

Relayer
User avatar
SpeedMaster
Posts: 226
Joined: 12 Nov 2016, 16:09

Re: [Game] AHK Klondike Solitaire

09 Aug 2018, 18:13

Ferry wrote:Great script!!! Can you build in an "undo" (last set) option? :-)
@Ferry I will try to implement that as soon as I have more time. ;)
Relayer wrote: other solitaire games allow you to double click on a card and the pending logical move for that card is made for you
@Relayer It's a good idea but I have to implement an artificial intelligence and associate it with a double click and it's just too much for me.
User avatar
SpeedMaster
Posts: 226
Joined: 12 Nov 2016, 16:09

Re: [Game] AHK Klondike Solitaire

09 Aug 2018, 18:18

SpeedMaster wrote:New Version 2.0

Revision 6 (2018-08-10)

  1. added option to move any card not only a King on a empty tableau column. :thumbup:
  2. fixed some minor bugs
Cheers :wave:
rommmcek
Posts: 374
Joined: 15 Aug 2014, 15:18

Re: [Game] AHK Klondike Solitaire

11 Aug 2018, 06:39

Awesome work!
It seems you implanted a bug in 2.0. I had a lot of problems with that jack (didn't fit nowhere, looks like it is a king).
Solved it any way with new feature of yours (any card).

P.s.: When picking up a stack, I think, you should disable a mouse until the stuck is "loaded" to cursor.
Attachments
Klondike.png
Klondike.png (36.33 KiB) Viewed 304 times

Return to “Scripts and Functions”

Who is online

Users browsing this forum: hoppfrosch and 19 guests