Chess AI

Blitz3D Forums/Blitz3D Programming/Chess AI

Ross C(Posted 2003) [#1]
Hey, does anyone know where i can get some good, easy to understand info on Chess AI?


Neo Genesis10(Posted 2003) [#2]
The best way, imo, is to set up a list with various moves. Have the computer check all possible moves (needs to be fairly optimised though!) and scan ahead several moves as well. Im sure you know that each piece has a points value, so you can check the points values for pieces taken to see if one move is better than another.

For easy CPUs, have them scan ahead for around ten turns. Intermediate should be around 15 and expert 20+. Im sure someone will debate this, but it seems to work well enough for me.


MSW(Posted 2003) [#3]
www.gamedev.net


Had a series of Chess AI articles last year...very good stuff, applicable to all sorts of AI problems...might not be as "easy to understand" as you want (IIRC, they used some C/C++ source code examples), but with some clever codeing it wouldn't be hard to implament such AI examples in Blitz..


jfk EO-11110(Posted 2003) [#4]
http://ai-depot.com/LogicGames/MiniMax.html
http://www.aihorizon.com/essays/chessai/index.htm
http://tict.ticalc.org/projects.html

chess ai sourcecode @ yahoo...


Dirk Krause(Posted 2003) [#5]
A maybe simple, yet impressive chess algorithm was made in JavaScript by Neil Pearce. I always wanted to port it to Blitz but didn't find the time. It's here:
http://www.neilpearce.co.uk/chess/


Rob(Posted 2003) [#6]
Stalemated it easy, it's not particularly clever.


Dirk Krause(Posted 2003) [#7]
Might be true :-) - I am not a chess player. But it _is_ a nice gimmick with a low footprint.


BHoltzman(Posted 2003) [#8]
If you're intetested in a laymans chess AI tutorial there is a site that has one available called
http://www.howstuffworks.com/

look under computer chess for the tutorials.

Take Care,

Ben


Ross C(Posted 2003) [#9]
Thanks guys. Never really done any AI before, so this is a bit of a challenge for me :)


jfk EO-11110(Posted 2003) [#10]
I like that "Checkmate!" Javascript Alert :) - tho it's dead slow. Clever Chess AI needs a pretty fast binary/cpu. No way for script.


puki(Posted 2003) [#11]
"Clever chess AI needs a pretty fast binary/cpu" - Yep!, years ago, when I was writing my "Blitz Chess" talking chess program on my Amiga, I came across a stumbling block -it relies on tens of thousands of book moves to be any good. I used to wonder why so many chess programs/machines boasted about the number of book moves - it's coz they cheat on the AI! The problem is always going to be when someone plays a duff move (especially someone who can't play chess) and then you have to rely on the AI right from the beginning.

Interesting diversion "Ross C" is your current project going to feature a chess game?


Ross C(Posted 2003) [#12]
Yeah, but with a difference. See the user creations forum for a wee sneak peek :)


Rob(Posted 2003) [#13]
the best chess I've played is chiefy chess.


AbbaRue(Posted 2003) [#14]
I would like to get my hands on a set of very quick
Algorithyms for how each peace moves. You want to represent
the game board in some kind of special array so you can
quickly go through all the legal moves available at any
point in the game. Each chess piece has a formula representing how it can move. The faster this algo. the
faster the puter can find the best move.
If anyone has seen a list of chess piece formulas, I would
like the link.
Thanks.


Ross C(Posted 2003) [#15]
That would be interesting, but we haven't really decided how our pieces will move yet :)


eBusiness(Posted 2003) [#16]
Neo, I don't think any of your AI's will ever finish thinking. If we say 20 possible moves a turn (and that's an underestimation), then the computer should go trou 20^10 = 10240000000000 combinations for the easy mode. Instead I think you should go fully trou a 2-5 moves, from there cut off those that seem dumb (and that's the real task), and continue with fewer. For each move, cut off those that makes less sense. In this way the computer can think a good way forward. But some of these AI pages probably say something more detailed.


Ross C(Posted 2003) [#17]
Hey eBusiness. How do the maths work out for it?

20^10 = 10240000000000

where did you get that figure from :)


jfk EO-11110(Posted 2003) [#18]
I am using a ply-2 depth full width exploration with material assessment and positional monocriterion decision heuristics. The result is a Strength of approx. 750 ELO. Not that clever, but still sly enough to beat me 9 out of 10 times.


Ross C(Posted 2003) [#19]
....w......t.....f...... :S :S

*i'm very scared and confused :S *

lol


eBusiness(Posted 2003) [#20]
Sorry Ross, 20^10 is just my estimation of how many ways a game of chess can develop in 10 turns. Made it in order to turn down Neo Genesis's idea about calculating up to 10 turns forward. It havn't got anything to do with what I describe later. You do know what 20^10 means? 20*20*20*20*20*20*20*20*20*20


Ross C(Posted 2003) [#21]
yeah, i get the ^10 thing. Hmm, it does seem like alot of moves. But i suppose pretty decent chess players only really think about 5 moves ahead. Cheers man


eBusiness(Posted 2003) [#22]
Yeah, and then they will have to skip most options anyway, based on... whatever they base it on. Funny game, chess. Maybe I should write such an AI myself, it's a fair challenge. And by the way, if you do a bit of counting, then the 20 possible moves thing is a too low number.


Foppy(Posted 2003) [#23]
You could do a search for the "minimax" algorithm, I don't think the name was mentioned in this thread but it's the most often used algorithm for turn based games such as chess. I have also written a chess game in BB using this same algorithm.

For instance:

http://ai-depot.com/LogicGames/MiniMax.html


Ross C(Posted 2003) [#24]
Cheers man :)


Foppy(Posted 2003) [#25]
Oh, I see now that jkf mentioned the same URL earlier.

If you want to try my game, it is located here:

http://www.oprit.rug.nl/prins13/download/MiniMaster.zip

(603 Kb, and there's no source code included yet)

Somewhere in that game there is a bug (in the minimax algorithm I think) since every now and then it plays quite bad (although I normally lose against it so there are still more bugs in my head). It's quite hard to debug... If you plan to program such a game my advice would therefore be to make sure the basic algorithm works perfectly before you add all pieces and moves ;). For instance, if I were to program it again I would perhaps create "4 in a row" first.


Ross C(Posted 2003) [#26]
Dam foppy, that was tough! Look like the way to go :) I'm gona start just now. I'll prob be back with lots more questions :D Thanks once again!