Programming chess engine
-
- Posts: 18
- Joined: Sat Mar 22, 2014 1:15 pm
Re: Programming chess engine
When I go to Stroustrup`s homepage there is Programming: Principles and Practice using C++ (a programming text book aimed at beginners who wants eventually to become professionals)
http://www.stroustrup.com/programming.html
It is an introduction to programming for people who has never programmed before. It will also be useful for people who have programmed a bit and want to improve their style and technique - or simply learn modern C++
To me it seems suitable to start from C++ because I think Python comes in handy for writing graphical interfaces that open windows. But Chess engines do nothing of the sort. They are simple console programs that communicate by printing text on the terminal they are run in.
http://www.stroustrup.com/programming.html
It is an introduction to programming for people who has never programmed before. It will also be useful for people who have programmed a bit and want to improve their style and technique - or simply learn modern C++
To me it seems suitable to start from C++ because I think Python comes in handy for writing graphical interfaces that open windows. But Chess engines do nothing of the sort. They are simple console programs that communicate by printing text on the terminal they are run in.
-
- Posts: 1242
- Joined: Thu Jun 10, 2010 2:13 am
- Real Name: Bob Hyatt (Robert M. Hyatt)
- Location: University of Alabama at Birmingham
- Contact:
Re: Programming chess engine
spacerocket wrote:Hello!
I use opensuse 13.1 and now I`m working with the c-language. What would be the best Linux distro for programming? I want to program own chess engine, I think I need to write a board representation. Is bitboard related to this somehow? I also need GUI I have xboard 4.7.2 but don`t know how to use it with programming. If someone would advise me how to get started but be great, thx.
I am not a Suse fan. WAY too much crapware included, too many things set up to automatically run, etc. I have become a Fedora-hater because they have gone too far into security, SELinux and such, also. I have recently installed Ubuntu and it seems to be OK, but I don't particularly like their apple-wannabe desktop approach (where individual windows don't have a menu bar, they all share the menu bar at the top of the screen for options. )
-
- Posts: 18
- Joined: Sat Mar 22, 2014 1:15 pm
Re: Programming chess engine
I use Ubuntu
Re: Programming chess engine
Hi. Let me say some tips to write chess program you could find useful.
1) Understand each of the 3 parts of a chess engine. Board representation, move generator and search function. Leave the position evaluation methods as second task.
2) Once you did it, try to write a simple tic-tac-toe to make practice.
3) Begin with your chess engine. As first try, don't waste time for optimization. Be concentrated for a code that is easy to write and mantain. You will have time to change it in future versions.
4) Choose the programming language you better know. I released a very simple engine written in Ada (very uncommon).
Programming a chess engine is not an easy task, then it's better to not introduce complication while you are still learning basics. That's why I suggest you to give priority for a working engine instead of think about performance.
I found TSCP very useful, an LaMoSca too (italian tutorial).
Last tips: never give up (i failed for almost 4 years before having a "bug-free" version). If things become too much hard then stop it ad start again following another way.
Ask everything you want and community will help. Good luck!
1) Understand each of the 3 parts of a chess engine. Board representation, move generator and search function. Leave the position evaluation methods as second task.
2) Once you did it, try to write a simple tic-tac-toe to make practice.
3) Begin with your chess engine. As first try, don't waste time for optimization. Be concentrated for a code that is easy to write and mantain. You will have time to change it in future versions.
4) Choose the programming language you better know. I released a very simple engine written in Ada (very uncommon).
Programming a chess engine is not an easy task, then it's better to not introduce complication while you are still learning basics. That's why I suggest you to give priority for a working engine instead of think about performance.
I found TSCP very useful, an LaMoSca too (italian tutorial).
Last tips: never give up (i failed for almost 4 years before having a "bug-free" version). If things become too much hard then stop it ad start again following another way.
Ask everything you want and community will help. Good luck!
-
- Posts: 18
- Joined: Sat Mar 22, 2014 1:15 pm
Re: Programming chess engine
Yep, though I`m more interested in writing in C++ rather than C. Simple C programs can be useful though. What comes to C++, I need to understand the standard libraries besides the language. I did a google search and found first edition: http://www.amazon.com/Programming-Princ ... 0321543726 and second edition: http://www.amazon.com/Programming-Princ ... 0321992784
The books cover the STL Libraries, just thinking should I buy the second edition(newer one) instead of first one.
The books cover the STL Libraries, just thinking should I buy the second edition(newer one) instead of first one.
Re: Programming chess engine
If you prefere C++ over C for a chess engine then I suppose you're going to use classes and other C++ features that C doesn't have.
If you don't need them, C will be a better idea.
But, as others said, you first need to be skilled in C++ if you want to develop a chess engine. Anything has to be done step by step!
If you don't need them, C will be a better idea.
But, as others said, you first need to be skilled in C++ if you want to develop a chess engine. Anything has to be done step by step!
-
- Posts: 9
- Joined: Sat Jun 21, 2014 12:52 pm
- Real Name: Syed Fahad
Re: Programming chess engine
look, the c++ programming language contains EVERYTHING about c++. it is supposed to be a reference. thqt other book is only an intro. u can read the other book first n thn move to bjarnes one.spacerocket wrote: But how about my original question, which of the books would be better? Allains book is about 10 times shorter than Bjarnes does that affect something?
Re: Programming chess engine
Check this site out, it is a great reference for c++. http://www.cplusplus.com
Re: Programming chess engine
If you find TSCP hard to understand maybe you can try Firstchess:
http://chessprogramming.wikispaces.com/Firstchess
Take into account that Firschess lacks en pasant capture and castle, but you can get a proper idea of how a chess engine works.
If Firstchess is still to difficult for you, then maybe you need to spend some time programming other stuff (IMHO writing a chess engine is not an easy task at all).
http://chessprogramming.wikispaces.com/Firstchess
Take into account that Firschess lacks en pasant capture and castle, but you can get a proper idea of how a chess engine works.
If Firstchess is still to difficult for you, then maybe you need to spend some time programming other stuff (IMHO writing a chess engine is not an easy task at all).
-
- Posts: 18
- Joined: Sat Mar 22, 2014 1:15 pm
Re: Programming chess engine
Ok, the actual source is actually here: http://devwebcl.atarionline.pl/cc65/
I tried to compile the firstchess.c but get this error message:
Maybe the compiler settings are wrong, anyway I haven`t had much time in writing code lately hopefully will have in the future.
I tried to compile the firstchess.c but get this error message:
Code: Select all
gcc Documents/firstchess.c
Documents/firstchess.c:18:19: fatal error: conio.h: No such file or directory
#include <conio.h>