Can a AHK script solve puzzles like CandyCrush Saga? Topic is solved

Ask gaming related questions (AHK v1.1 and older)
Pilkojr
Posts: 13
Joined: 08 Jan 2019, 20:59

Can a AHK script solve puzzles like CandyCrush Saga?

08 Jan 2019, 21:05

Hi all,

My first post :-)

As the title asks I guess. Can an AHK script be used to solve puzzles like CandyCrush Saga boards?

Thanks,
Pilkojr
Ruevil2
Posts: 173
Joined: 14 Jul 2014, 10:39

Re: Can a AHK script solve puzzles like CandyCrush Saga?

14 Jan 2019, 10:39

AHK is 'turing complete', so the short answer is yes, it can do anything that any other language can do. A better question is, are you smart enough to figure it out?
Pilkojr
Posts: 13
Joined: 08 Jan 2019, 20:59

Re: Can a AHK script solve puzzles like CandyCrush Saga?

14 Jan 2019, 16:38

Ruevil2 wrote:
14 Jan 2019, 10:39
AHK is 'turing complete', so the short answer is yes, it can do anything that any other language can do. A better question is, are you smart enough to figure it out?
Thanks Ruevil2. That's very good to know. I'm definitely not smart enough to figure it out, but I reckon there'd be plenty around who are.
Ruevil2
Posts: 173
Joined: 14 Jul 2014, 10:39

Re: Can a AHK script solve puzzles like CandyCrush Saga?

14 Jan 2019, 17:53

Pilkojr wrote:
14 Jan 2019, 16:38
Ruevil2 wrote:
14 Jan 2019, 10:39
AHK is 'turing complete', so the short answer is yes, it can do anything that any other language can do. A better question is, are you smart enough to figure it out?
Thanks Ruevil2. That's very good to know. I'm definitely not smart enough to figure it out, but I reckon there'd be plenty around who are.
I wouldn't start with self doubt my friend. Some of these problems become easier after a little analyzing. Start with trying to write down the steps you would physically take to solve the problem with your eyes. Then try to translate that into AHK commands. I would try to throw you some ideas that might get you started but I haven't played this game in particular.
Pilkojr
Posts: 13
Joined: 08 Jan 2019, 20:59

Re: Can a AHK script solve puzzles like CandyCrush Saga?

14 Jan 2019, 18:19

I've seen scripts written in Python that apparently can play the game. I've got one of those scripts, but looking through it means nothing to me.

I'm good for an imagesearch or 2, but solving a puzzle......hmmmm :-)
Ruevil2
Posts: 173
Joined: 14 Jul 2014, 10:39

Re: Can a AHK script solve puzzles like CandyCrush Saga?

15 Jan 2019, 09:17

I took a look at the game and from what I gathered in a few minutes you would have to start with board recognition. Basically determine the board space and how many tiles you are dealing with. Second step would be to determine color patterns. After that the logic of determining the best move starts to get into a bit of a game theory area.
Pilkojr
Posts: 13
Joined: 08 Jan 2019, 20:59

Re: Can a AHK script solve puzzles like CandyCrush Saga?

28 Feb 2019, 16:49

Hi Ruevil2,

I've given up on the Candy Crush type idea, and gone for a game a bit different.

I've uploaded a pic, and was wondering where to start for a script that could work out how to complete the board in the pic.

How it works is;
For each tile with a number on it, the next tile that can be selected will be 'n' tile away in any direction.
For each tile with a chess type piece, the following applies;
- Crown, next piece is on the edge of the board in any direction
- Sword Tower with Water, next piece is on the edge of the board in vertical or horizontal movement only
- Tower with Crossed Swords, next piece in on the edge of the board in diagonal movement only
- Dragon, next piece will be 2 tiles away vertically or horizontally, then 1 to the left/right/up/down (like a Knight in chess)

Any starting point would be amazing thanks.
Attachments
Blacksmithing.png
Blacksmithing.png (89.2 KiB) Viewed 3690 times
Ruevil2
Posts: 173
Joined: 14 Jul 2014, 10:39

Re: Can a AHK script solve puzzles like CandyCrush Saga?  Topic is solved

04 Mar 2019, 12:39

Fist place to start is by taking a shot of each individual image so you can recognize each square on the board and what tile each space represents. The board is a 6x6 square so you have 36 tiles to recognize. After the recognition part I don't really have any more advice since deciding the best move takes a little more understanding of the gameplay involved.
Pilkojr
Posts: 13
Joined: 08 Jan 2019, 20:59

Re: Can a AHK script solve puzzles like CandyCrush Saga?

04 Mar 2019, 16:15

I can get screenshots of each tile, but how do I get a script to piece together a 6x6 board and recognise what tile is in each position?
Ruevil2
Posts: 173
Joined: 14 Jul 2014, 10:39

Re: Can a AHK script solve puzzles like CandyCrush Saga?

05 Mar 2019, 09:31

Pilkojr wrote:
04 Mar 2019, 16:15
I can get screenshots of each tile, but how do I get a script to piece together a 6x6 board and recognise what tile is in each position?
That is going to be a little bit of the hard part, I can point you to the tools (basically Loop, ImageSearch and Array) but I can't really say what the best way to approach the problem will be. My gut reaction is to assign each tile a value and arrange them in an array that represents the board structure.

Like this: Referred to in the style of Array[2][3]
1 2 3 4 5 6
1|3 4 5 3 3 5
2|1 3 3 4 5 3
3|3 4 4 3 4 2
4|2 5 2 3 1 4
5|1 3 1 4 1 2
6|4 2 3 2 3 1

Then you can determine identity and position, how to move or perform logic is the part that is beyond me. Hope this helps!

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: Google [Bot] and 51 guests