C Board  

Go Back   C Board > Cprogramming.com and AIHorizon.com's Artificial Intelligence Boards > General AI Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 08-17-2007, 07:06 AM   #1
Sanity is for the weak!
 
beene's Avatar
 
Join Date: Jul 2006
Posts: 321
Chess engine

Hi all, havn't posted anything in a while so how are all of you?

Anyways, I've wanted to make a chess engine since I was little, but the problem is I don't know how to program any AI. And I have a few design issues of my framework/engine that I havn't even started to code yet, still in the design stage. So..... What should the base class include, just to start me off? I'm pretty stuck because a chess engine is extremely new to me and I havn't programmed anything in a while. Is the AI hard to program? Is their any tutorials on how to program AI? If so can somebody please point me in the right direction?

Best wishes

Beene
beene is offline   Reply With Quote
Old 08-17-2007, 10:55 AM   #2
GA
 
ichijoji's Avatar
 
Join Date: Nov 2002
Posts: 179
The AI you'd normally use for chess is a minimax tree, which isn't that bad. If you have a class that can represent a board state, let the user change the board state, and evaluate the board state for each player then you have most of what you're going to need. To do the AI you just build a tree where the root is the current state, the next layer is all of your possible moves, the layer after that is all of your opponents possible moves (you might want to start with checkers or connect 4 here because the branching factor on chess is something like 40). Once you have the tree built to a certain depth, you evaluate each board state in the tree and find a path to the end where you go for your highest score while assuming your opponent plays optimally.
__________________
Illusion and reality become impartiality and confidence.
ichijoji is offline   Reply With Quote
Old 08-17-2007, 08:20 PM   #3
Registered User
 
Join Date: Dec 2006
Posts: 1,780
I am currently writing my chess engine. If you want some search keywords for google, try minimax, alpha-beta prunning, transposition table, iterative deepening. Here is a tutorial specifically on Chess programming http://www.gamedev.net/reference/lis...categoryid=163
starting from "Chess Programming Part I: Getting Started." Also, if you don't want to write a GUI but want to have one, try writing your chess engine to interface with xboard/winboard compatible interfaces (google "xboard communication protocol"), that is what I am doing now. However, like ichijoji said, I wouldn't recommend starting with chess if you have never programmed any AI before, as the rules of chess is pretty complicated (castling, en passant, promotion, draw by repetition, 50 moves rule etc), and the average branching factor is around 35, which means your code has to be pretty optimized to reach any considerable depth. This is my second AI program, my first one was an AI for reversi (othello), and I would recommend starting on reversi because of its much simpler rules and smaller average branching factor of 8.

Last edited by cyberfish; 08-17-2007 at 08:25 PM.
cyberfish is offline   Reply With Quote
Old 08-21-2007, 12:16 PM   #4
Frequently Quite Prolix
 
dwks's Avatar
 
Join Date: Apr 2005
Location: Canada
Posts: 7,629
For basic Chess AI: http://aihorizon.com/essays/chessai/index.htm

(Though cyberfish's page looks better.)

[edit] Moderators: consider moving this thread to the General AI Programming forum. Just a thought. [/edit]
__________________
dwk

Seek and ye shall find. quaere et invenies.

"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell


Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net

My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, etc.

New project: nort
dwks is offline   Reply With Quote
Old 08-21-2007, 11:21 PM   #5
Super Moderator
 
Bubba's Avatar
 
Join Date: Aug 2001
Posts: 7,472
Good idea.

Done.
Bubba is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
In a game Engine... Shamino Game Programming 28 02-19-2006 11:30 AM
Game Engine Link Prob swgh Game Programming 2 01-26-2006 12:14 AM
Chess engine coconutkid Projects and Job Recruitment 16 11-22-2004 07:30 AM
Ultra chess engine contest yodacpp Projects and Job Recruitment 8 11-21-2004 07:58 AM
Ultra chess engine yodacpp Game Programming 2 11-19-2004 12:33 PM


All times are GMT -6. The time now is 08:26 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22