Chess Ai

hi all!!!

i just started my ISU for my programming class and i decided i want to make a chess game… i was wondering how i should go about programming the AI (no specific code required, just general steps to take etc.)

I was thinking of using the minimax algorithm to determine the next move for the computer and using the bitboard method of storing all the positions of the peices on the board.

any help would be appreciated,

mike

Min/Max is definitely the way to go, but man! Can’t you try anything easier than chess? :-/

Sounds like a cool project =)

I did pong once… that AI is easy hehe =) i made it always win! =) hehe…
" paddle_y = (ball._y /2) "
hehe =)

*Originally posted by zylum *
**hi all!!!

i just started my ISU for my programming class and i decided i want to make a chess game… i was wondering how i should go about programming the AI (no specific code required, just general steps to take etc.)

I was thinking of using the minimax algorithm to determine the next move for the computer and using the bitboard method of storing all the positions of the peices on the board.

any help would be appreciated,

mike **

I designed a checkers AI a while back for C++… It wasn’t overly difficult… But it took alot of brainwork to figure it out…

Basically… To do a Chess AI correctly… You have to let the computer think ahead by a couple of turns… This is where the fun part comes in. You take every move humanly possibly by the player character… You assign a numeric value to that move… Let’s say… 0 = no threat, 1 = minor threat, 2 = possible piece lost, 3 = impiortant piece lost, 4 = have to move, king being checked

Then… You can go down the line… If there are any 4’s… You must move that piece… If there are any 3’s… You must move that piece… If there are any 2’s… You must move that piece… and so on down the line… Now… Not only do you have to figure that out… You have to figure out how to make it challenging… So the computer player is going to place his move on the board… You must virtually (in his mind)… Allow him to think if that is a good move or not… Basically, if he moves the bishop… Is there a piece that is going to intercept him? And then you can assign values to that specific move as well…

And this is just the gist of it… If I were to give you everything… I could probably take up a couple of pages with diagrams and explanations… Needless to say… I’ll have to do it sometime for my AI tutorials… Found in the end of this forum.

my friend had the same course last semester and he made a chess program that can think ahead 4 moves in an average of 30 seconds per move. i thought i’d challenge myself to make one that thinks 6 moves ahead and takes the same amount of time to calculate the move. this might be quite the challenge since for each extra “depth” the computer has to loop through an average of 35^depth moves. so his program loops through 35^4 moves while mine will hopefully loop through 35^6 (A LOT MORE). this means my program will have to be highly optimized aswell as have lots of short cuts to cut down the amount of moves to look through…

anyways i have 2.5 months to finish this so i’ll have plenty of time (hopefully)

right now im working on making a player vs player chess program and its going along fairly well but once im done ill be working on the ai.

Eh… If you need help… I could help you out… Especially in optimization :slight_smile:

Well, you probably know it already, but the alpha-beta pruning algorithm is perfect for such optimisation. I used to have a great link about it, can’t find it right now, but a search on google should help :slight_smile:

yea for sure, i think i read that the alpha-beta algorithm cuts down the moves the program has to look through by a square root.

i was just wondering exactly how i would get <i>started</i> lol. man, this is going to be tough :stuck_out_tongue:

Go for tic-tac-toe. Much more quicker. But if you do a chess, I wanna see this! I would grade it a A++++++.