Jump to content

Ultimate AutoIt Checkers


Recommended Posts

Not bad at all!!!


Thanks for checking it out. At first glance you think "checkers? I can write that in 20 lines of code" but then you really have to break it down into logical steps. I'm pretty sure a chess game would take about 35% more code.

Link to comment
Share on other sites

Sweet! I was totally able to beat it first game.. LOL I suck at checkers tho. LOL Nice example... <_<

It's pretty easy to win right now. You should have tried the first version I made, AI movement wasn't random. AI pieces would be selected starting from the left side and if it could move it would, so one piece would move until it got kinged and no other pieces would move...good times.

The next version will actually look for pieces with jumps first instead of randomly choosing any piece that can move. I'm hoping to also have triple and quadruple jumps etc...

Link to comment
Share on other sites

I'm pretty sure a chess game would take about 35% more code.

I think that's a veeerry optimistic estimation. Unless you mean no AI whatsoever. <_<

Anyway, this looks really promising, keep up the good work.

I wanted to code checkers in AutoIt some time ago, but gave up on it pretty soon...

"be smart, drink your wine"

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

In checkers if a jump is available then you must jump. I notice that this is not the case in your version. Apart from that it is pretty good.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

  • 1 month later...

In checkers if a jump is available then you must jump. I notice that this is not the case in your version. Apart from that it is pretty good.

I've never played it like that.. seems more fun the way he has it.

Also good work with the code, very well laid out and easy to understand. Can't wait for the finished product! :)

Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()
Link to comment
Share on other sites

Just tested this out. Very nice, only thing I can say to help you improve is maybe work on it's way to see if it has a jump or if it's creating a jump for the opposing team. I understand that would be very hard. Good luck and keep up the good work!

Edit: As I sugusted to the user who wanted to create chess it would probabbly be much eiaser to just create a two player game rather than AI. Nice work though!

Edited by DBak


Link to comment
Share on other sites

  • 1 year later...

That's very slick!

I've never played where you had to *jump* if it was an option, but I think the rules are that you have to *move* if it's possible. So, the skip button sems to be a bit of a 'cheat'. A neutral-colored "Turns: " label would be cool so one could keep track of how many turns it takes to beat the AI. A number that would increase as you improve the AI until eventually the AI might come out triumphant!

A little code contribution, you might use, if you like, in CreateBoard and CreateTeams to simplify the $flip flag...

$flip = false
    For $Y = 0 To $boardRows - 1
        For $X = 0 to $boardCols - 1
            If $flip Then
                  ;flip1 - square type 1
                  ;flip0 - square type 2
            $flip = ($flip=0)
        $flip = ($flip=0)

EDIT: Oops! Just noticed your MVP status, I prolly shouldn't be offering code snippet to you guys <sheepish grin>. Well, I was born in Akron, so maybe you'll forgive me! Go Bucks!

Edited by Spiff59
Link to comment
Share on other sites

Well this certainly looks nice!

I just created a VERY simple tic-tac-toe game, put it in the examples forum too (http://www.autoitscript.com/forum/index.php?showtopic=89137), mostly as an attempt to create a working AI albeit the simplest one ever. Then I refresh the page a couple of minutes later and I see a checkers game! Cool.

My two cents worth of complaints:

1 - If you click on one of your pieces, you get the nice green circles for the possible moves. What if you change your mind and want to move another piece? That seems to be totally forbidden now. Clicking a pice to see its moves means you MUST move that piece and cannot change your mind any more. That seems user-unfriendly :)

2 - The flickers and the almost immediate moving of the computer means you cannot see clearly what the computer is doing. I would suggest placing a faint green square around the last moved piece, or color it's background a bit, something like that.

3 - Indeed, as others noted, it would be a good idea to make the program adhere to the rules of the game (at least that if a jump is possible you MUST jump). It seems [understatement]'vaguely important'[/understatement] to get that done before attempting AI.

I have not thought a lot about checkers AI (actually, not at all before today), but if you want to implement that, here's some things I can think of (assuming you will be using a recursive decision tree, and not difficult stuff like genetic algorithms or neural networks, which would (IMHO) be pretty much ridiculous to attempt in a slow non-OO language like AutoIt anyway):

- Better use breadth-first (as opposed to depth-first) searching because AutoIt is quite slow, especially seems so in array handling.

- Hill climbing algorithms seem unwise in board games where sacrifices may be in order, especially if all you do is just count pieces. Local maxima lurk around every corner. Either use workarounds for local maxima or leave the technique aside completely ^_^

- It seems that just counting your pieces will not be a very useful method of board score calculation, at least not on itself or as a primary score weight, taking into account the number of sacrifices that a regular checkers game contains.98

- I would deem it important if you encounter jumping moves in your recursive tree of options, to iterate along the jumping moves situation branching to every possible point where no further jumping is possible, before calculating a board score. Board score calculation in between jumps will be totally unthrustworthy and thus a waste of time, especially since you MUST jump if you can, so only after all necessary jumps have been done, the score calculation is useful. This should save prescious calculation time and give you a more informed AI.

Now this is ofcourse all very basic (and novice) theory and might not apply at all to your style of working. In that case, please disregard everything I said :) It's just what I would ask myself. Good luck! I hope you succeed in finding at least a working AI.

/edit: tpyos. I mena, i mean mean, typso, dman there i go agian, typos.

Edited by SadBunny

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Link to comment
Share on other sites

Another update to Beta 3:

- Added setup gui before game loads, allowing the user to specify players as human or CPU. If both are CPU the game will be simulated and the speed will be slowed down so you can see what moves are being checked.

NOTE: Things can get wonky when running as a simulation. Since the pieces aren't actively seeking each other they may get stuck in an endless loop when the board is almost empty.

Edited by weaponx
Link to comment
Share on other sites

  • 2 weeks later...

Updated to Beta 4:

-Selected piece can be changed if a jump hasn't been performed

-Removed Skip option

-New interface design

-Added move counter

-Added longest jump record

-Optimized movement to reduce flickering

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...