English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I draw the chess board & pieces but I cant move them .
please help me

2007-01-18 17:59:17 · 2 answers · asked by simona 1 in Computers & Internet Programming & Design

2 answers

It's easy to write a chess engine. To make it
really good is the difficult part.
I came across same question in the past so I would like to paste the reply
===
It's easy to write a chess engine. To make it
really good is the difficult part.

Here is a simple plan:

1. Do the board and the move representation
2. Do the "do move" and "undo move" operations
3. Test it
4. Write a basic (pseudo legal) move generator
5. Test it
6. Complete the move generator: castling, en passant, promotion
7. Test it
8. If you generate pseudo legal move, write something to filter out
the illegal moves
9. Implement "perft". Use it to stress test the engine
10. Implement UCI and/or XBoard, play with Arena or Winboard
11. Implement a random player, just selects a random move from
the list of legal moves
12. Now you can play games, without any searching stuff, test!
13. Write a simple evaluation function
14. Evaluate each move and use the value add a weight factor to the
random move selector. Have fun.
15. Study MiniMax, NegaMax and Alpha-Beta. Make sure you really
understand how they work!
16. Implement it, write a move selector based on it.
17. Use the protocol to configure the search: infinite, fixed depth,
fixed node count, fixed time.
18. Add the more intelligent mode where you try to efficiently use the
remaining time for the right moves and don't waste time on on
interrupted or useless searches.
19. Complete the protocol.

Then you have a working engine. Might be hard work but it's not thatdifficult. And it doesn't play too good. Then you can try to make engine cleverer (and slower) by a more sophisticated evaluation function, or faster and deeper searching by adding a transposition table, move ordering, PVS or mtd(f), null move pruning, extensions, reductions, razoring or just optimizing the code.
===

There are several algorithms already existing for this. Writing your own algorithm would be a huge task in itself.
Some of the algorithms are
* Minimax (http://en.wikipedia.org/wiki/Minimax)
* Iterative deepening depth-first search
* Null-move heuristic

You probably can look for already existing Chess engines. One that I am aware of is called Fruit (chess engine) http://www.fruitchess.com/

A game of chess requires good mathematical analysis and reasoning. You can search for more details on Google Search. Look for these keywords.

--
Ck
http://www.gfour.net

2007-01-18 20:46:48 · answer #1 · answered by KingPin 3 · 0 0

I've been curious about that too so I'm looking for answers with you.

2007-01-18 18:02:13 · answer #2 · answered by Matty G 3 · 0 0

fedest.com, questions and answers