Hello my name is FainterSquare and I was wondering how to code a chess program in C++. I found it very difficult to find way to code a chess program on my own from the references on the internet so I was wondering if there were any good resources that would allow me to code a chess program on my own from scratch. I have looked at chessprograming wiki and looked over the internet yet no one seems to have made any videos on how to code chess..
-----Sincerely FainterSquare
Chess programming C++
Moderators: hgm, Rebel, chrisw
-
- Posts: 1
- Joined: Mon Jan 28, 2019 4:56 pm
- Full name: John Berry
-
- Posts: 2662
- Joined: Wed Mar 10, 2010 10:18 pm
- Location: Hamburg, Germany
- Full name: Srdja Matovic
Re: Chess programming C++
I started with C and a MiniMax search for TicTacToe first,FainterSquare wrote: ↑Tue Jan 29, 2019 7:34 pm Hello my name is FainterSquare and I was wondering how to code a chess program in C++. I found it very difficult to find way to code a chess program on my own from the references on the internet so I was wondering if there were any good resources that would allow me to code a chess program on my own from scratch. I have looked at chessprograming wiki and looked over the internet yet no one seems to have made any videos on how to code chess..
-----Sincerely FainterSquare
then implemented AlphaBeta,
then started to implement move generation for chess by CPW,
which was a mind wrapping task back then....
--
Srdja
-
- Posts: 12542
- Joined: Wed Mar 08, 2006 8:57 pm
- Location: Redmond, WA USA
Re: Chess programming C++
Did you find this place:FainterSquare wrote: ↑Tue Jan 29, 2019 7:34 pm Hello my name is FainterSquare and I was wondering how to code a chess program in C++. I found it very difficult to find way to code a chess program on my own from the references on the internet so I was wondering if there were any good resources that would allow me to code a chess program on my own from scratch. I have looked at chessprograming wiki and looked over the internet yet no one seems to have made any videos on how to code chess..
-----Sincerely FainterSquare
https://www.chessprogramming.org/Main_Page
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
-
- Posts: 96
- Joined: Fri Jul 06, 2018 1:09 am
- Location: Chicago, IL
- Full name: Josh Odom
Re: Chess programming C++
Here's a great resource (the vice chess engine), but it uses c instead of c++ https://www.youtube.com/watch?v=bGAfaep ... tZHVbT-2hg
TSCP is the classic "reference" chess engine, in c (not significantly different from vice, in terms of features).
My engine GearHeart https://bitbucket.org/odomobo/gearheart is supposed to be a kind of a reference engine in c++17. However, I suspect it might be too advanced for people new to chess programming, and there's currently not much documentation.
TSCP is the classic "reference" chess engine, in c (not significantly different from vice, in terms of features).
My engine GearHeart https://bitbucket.org/odomobo/gearheart is supposed to be a kind of a reference engine in c++17. However, I suspect it might be too advanced for people new to chess programming, and there's currently not much documentation.
-
- Posts: 4367
- Joined: Fri Mar 10, 2006 5:23 am
- Location: http://www.arasanchess.org
-
- Posts: 27811
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: Chess programming C++
If you don't mind plain C, (which after all is a sub-set of C++) you could also start with micro-Max (far simpler than TSCP, and stronger), or KingSlayer (stronger still, and a bit more conventional). Both sources are elaborately commented.
-
- Posts: 1
- Joined: Mon Feb 04, 2019 6:04 am
- Full name: supriya lade
-
- Posts: 2
- Joined: Sun Mar 03, 2019 7:13 pm
- Full name: juanca lina
-
- Posts: 360
- Joined: Thu Jan 22, 2015 3:21 pm
- Location: Zurich, Switzerland
- Full name: Jonathan Rosenthal
Re: Chess programming C++
Definitely take a look at Andrew Grant's Ethereal. It is written in C, not C++, but the code is fairly straightforward and it is some of the cleanest and most well commented code I am aware of.
Stockfish also has a lot of good comments and is in C++, but I find it a bit more difficult to follow as it is extremely optimized and sometimes a bit over-engineered.
The benefit of these two (and Arasan from further up, but I haven't looked at that code myself) is that you won't really outgrow the codebase and most of the state of the art ideas for classical AB engines are implemented.
A large portion of the other engines I am aware of are small projects by individual (but oftentimes brilliant) programmers and this is unfortunately quite visible in the lack of comments and code cleanliness.
Stockfish also has a lot of good comments and is in C++, but I find it a bit more difficult to follow as it is extremely optimized and sometimes a bit over-engineered.
The benefit of these two (and Arasan from further up, but I haven't looked at that code myself) is that you won't really outgrow the codebase and most of the state of the art ideas for classical AB engines are implemented.
A large portion of the other engines I am aware of are small projects by individual (but oftentimes brilliant) programmers and this is unfortunately quite visible in the lack of comments and code cleanliness.
-Jonathan
-
- Posts: 1
- Joined: Sat Feb 25, 2017 1:58 am
- Location: USA
Re: Chess programming C++
I used C++ for Zotron (last release in 2004), with extensive use of object orientation to describe the various pieces. It helped me get the program working, but there is a performance price. If I were to do it again, and my goal was a strong engine, I'd stick to C.