Coding Chess - Computer AI
Author |
Message |
threatbinder
|
Posted: Thu Dec 10, 2009 9:51 pm Post subject: Coding Chess - Computer AI |
|
|
Can anyone give me a basic idea on how to code the computer AI for a chess game? It doesn't have to be the actual code, but steps along the way for the game would be fantastic, thanks~ |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tony
|
Posted: Thu Dec 10, 2009 10:02 pm Post subject: RE:Coding Chess - Computer AI |
|
|
Similar to how you would play the game. You read the board, and pick one of all the possible valid moves to take.
I'm not sure what exactly you are asking here. The complexity depends on how "smart" you want the AI to be.
On the dumb scale, it could pick moves at random. That will work and it's easy to make.
On the other... well you need to be able to play the game yourself, and describe that process. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
Insectoid
|
Posted: Thu Dec 10, 2009 10:26 pm Post subject: RE:Coding Chess - Computer AI |
|
|
I suppose a min/max algorithm would be the way to do this. Chess AI is hugely complicated and probably not worth the effort without serious knowledge of the game and how it works. |
|
|
|
|
|
threatbinder
|
Posted: Thu Dec 10, 2009 11:21 pm Post subject: Re: RE:Coding Chess - Computer AI |
|
|
Tony @ Thu Dec 10, 2009 10:02 pm wrote: Similar to how you would play the game. You read the board, and pick one of all the possible valid moves to take.
I'm not sure what exactly you are asking here. The complexity depends on how "smart" you want the AI to be.
On the dumb scale, it could pick moves at random. That will work and it's easy to make.
On the other... well you need to be able to play the game yourself, and describe that process.
How exactly do you "read the board"? Do you measure where the x, y of a certain sprite is?
And you didn't really explain how the AI would be programmed.. as for the "easy mode", how would you go about doing the "random" moves? Do you make like 5 procedures for each and every single scenario that can occur in the game, and have it do a random one? (that was a complete guess / rhetorical question).
And for the expert AI, how would you program a smart version?
Please explain in more deph... ty. |
|
|
|
|
|
A.J
|
|
|
|
|
threatbinder
|
Posted: Fri Dec 11, 2009 1:09 am Post subject: Re: RE:Coding Chess - Computer AI |
|
|
[quote="A.J @ Fri Dec 11, 2009 12:20 am"]I present to you Wikipedia:
http://en.wikipedia.org/wiki/Minimax
http://en.wikipedia.org/wiki/Alpha-beta_pruning
.. lol. I already started on my chess project, and please don't post wikipedia articles; don't you think I've already researched by now?
.. where did tic tac toe come from? Did I ask for a simpler project? I'm already half way through. |
|
|
|
|
|
GalacticVenus
|
Posted: Fri Dec 11, 2009 7:27 am Post subject: RE:Coding Chess - Computer AI |
|
|
Make it so that they move their queen onto their rook on turn one, then put you in Checkmate on turn two. |
|
|
|
|
|
[Gandalf]
|
Posted: Fri Dec 11, 2009 1:11 pm Post subject: RE:Coding Chess - Computer AI |
|
|
First thing is first; legal move generation and board representation (whether it be bitboards, an 8x8 array, an 0x88 array, etc.)
A great resource is:
http://chessprogramming.wikispaces.com/ |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tony
|
Posted: Fri Dec 11, 2009 1:36 pm Post subject: Re: RE:Coding Chess - Computer AI |
|
|
threatbinder @ Fri Dec 11, 2009 1:09 am wrote: and please don't post wikipedia articles; don't you think I've already researched by now?
Hmm...
threatbinder @ Thu Dec 10, 2009 9:51 pm wrote: Can anyone give me a basic idea on how to code the computer AI for a chess game?
No. I don't think you have done adequate research. Otherwise you would have not only a basic idea, but some actual algorithms to reference (which is what A.J. is helping you here with). |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
threatbinder
|
Posted: Fri Dec 11, 2009 3:51 pm Post subject: Re: RE:Coding Chess - Computer AI |
|
|
Tony @ Fri Dec 11, 2009 1:36 pm wrote: threatbinder @ Fri Dec 11, 2009 1:09 am wrote: and please don't post wikipedia articles; don't you think I've already researched by now?
Hmm...
threatbinder @ Thu Dec 10, 2009 9:51 pm wrote: Can anyone give me a basic idea on how to code the computer AI for a chess game?
No. I don't think you have done adequate research. Otherwise you would have not only a basic idea, but some actual algorithms to reference (which is what A.J. is helping you here with).
I think I get the concept of a 2 player game now, so how would I go about programming the computer AI? I'll try researching more I guess for now. |
|
|
|
|
|
threatbinder
|
Posted: Fri Dec 11, 2009 3:54 pm Post subject: Re: RE:Coding Chess - Computer AI |
|
|
[quote="[Gandalf] @ Fri Dec 11, 2009 1:11 pm"]First thing is first; legal move generation and board representation (whether it be bitboards, an 8x8 array, an 0x88 array, etc.)
A great resource is:
http://chessprogramming.wikispaces.com/[/quote]
thanks for the article btw, i'll try reading some more. ^^ |
|
|
|
|
|
A.J
|
Posted: Fri Dec 11, 2009 6:08 pm Post subject: Re: Coding Chess - Computer AI |
|
|
threatbinder wrote:
how would I go about programming the computer AI?
Well, that is what I am saying. Try looking-up the minimax algorithm, as it is very useful. I am sorry if my previous message seemed harsh to you, as I was only trying to help. |
|
|
|
|
|
threatbinder
|
Posted: Fri Dec 11, 2009 8:11 pm Post subject: Re: Coding Chess - Computer AI |
|
|
A.J @ Fri Dec 11, 2009 6:08 pm wrote: threatbinder wrote:
how would I go about programming the computer AI?
Well, that is what I am saying. Try looking-up the minimax algorithm, as it is very useful. I am sorry if my previous message seemed harsh to you, as I was only trying to help.
okay, thanks. I read your post the wrong way (thought you were trying to insult me with wikipedia articles... but then when you said go back to tic tac toe.. lol i must've misunderstood). |
|
|
|
|
|
A.J
|
Posted: Fri Dec 11, 2009 11:08 pm Post subject: RE:Coding Chess - Computer AI |
|
|
Its ok. Chess AI is pretty complicated, although it isn't impossible, merely time consuming. |
|
|
|
|
|
|
|