# AutoIt playing solitaire

## Recommended Posts

As my first AutoIt project, I have chosen to build a computer program that solves a game of solitaire for me.

I think the Artificial Intelligence won't be that difficult, but I have some problems with recognizing the graphics. (I have no source code yet, tried a few things with pixels, but I deleted them afterwards)

How would you approach the problem? How can I recognize the cards on the table?

Can it be done with PixelChecksum()? Any ideas are welcome, because I'm stuck at the moment..

##### Share on other sites

You'd probably have to get a OCR to read the card types, and use PixelSearch() for suit colors and I don't know how you're going to differentiate spades from clubs.

##### Share on other sites

Look at Blackjack...

##### Share on other sites

gamepin126: I was afraid that I had to do something like you are suggesting. I hoped that there would be an easier way to do it. OCR souds a little bit complicated for me, as I am an AutoIt noob. Maybe I should look out for a more simple project to begin with, but I'll give OCR a try. There are some interesting posts on this form about OCR. The only fear I have, is that the program becomes too slow.

w0uter: I don't like cheating. I'd rather lose than win a game with cheating.

Zedna: I don't see what a blackjack game has in common with card recognition in solitaire. I don't want to draw cards myself. How can I use `cards.dll' to recognize cards on my solitaire table?

##### Share on other sites

OK, with pixelchecksum(), I'm drawing the smallest square possible around the rank and the suit of a card. However, sometimes, the checksum is the same for two different cards:

card checksum

3d 2130154405

4d 724888128

6d 4281195598

7d 4281195598

9d 102357584

Td 521127524

Jd 1496215483

In the table above, read 3d as: the three of diamonds, etc.

Note that the checksums for 6d and 7d are the same.

How is this possible, how is the checksum for the square of pixels calculated anyways?

Edited by flet

##### Share on other sites

Isn't this in the wrong topic?

Larry didn't notice? Waky Waky

##### Share on other sites

Hmm, my checksums were different, are you sure this is for solitaire?

Edit:

I got

6d: 2802593504

7d: 2890732284

For the same coords being used for both.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

##### Share on other sites

y hasnt this been moved yet?? some1 move it

A great place to start Autoit 1-2-3

## Create an account

Register a new account

• ### Recently Browsing   0 members

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...