How to compile discocheck?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
mohzus
Posts: 106
Joined: Tue Sep 24, 2013 2:54 am

Re: How to compile discocheck?

Post by mohzus »

tmokonen wrote:You would have to issue isready and position commands, at a minimum, before issuing a go command.
I had already set a position, only the "isready" command was missing. Thank you very much, I can finally fully use discocheck!!!
Rein Halbersma
Posts: 741
Joined: Tue May 22, 2007 11:13 am

Re: How to compile discocheck?

Post by Rein Halbersma »

lucasart wrote: DiscoCheck was written in plain C up to version 3.7.1. Version 4.0 is a complete C++ rewrite:
* the transition was a lot of (useless) work.
* it is not worth the switch at all. C++ adds nothing useful to the table, except being and endless waste of time to read encyclopedic books to be able to use it properly...

Besides the syntactic sugar, the only things in C++ that I did find useful are:
* string/stringstream
* namespaces (technically they are syntactic sugar, but I really do like them)
* std::chrono (portable high resolution clock avoiding lots of ugly ifdef's)

Don't listen to the C++ Mermaids... I speak from experience.
Why do you always sound so frustrated with C++ and still continue with it? Your language is just a tool, and you cannot expect to master it without studying it. There are very accessible books nowadays: a Tour of C++ by Stroustrup is only 180 pages, hardly encyclopedic, and will teach you a modern C++ style. If you are serious about learning, I can seriously recommend it ;-)
User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: How to compile discocheck?

Post by lucasart »

mohzus wrote:
tmokonen wrote:You would have to issue isready and position commands, at a minimum, before issuing a go command.
I had already set a position, only the "isready" command was missing. Thank you very much, I can finally fully use discocheck!!!
The hash table is allocated only after isready is received. If you issue a go command before, Discochech will segfault. It sounds crazy, but is perfectly UCI compliant. It's a feature allowing to reduce memory footprint.
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
tttony
Posts: 268
Joined: Sun Apr 24, 2011 12:33 am

Re: How to compile discocheck?

Post by tttony »

lucasart wrote:
Tom Likens wrote:
lucasart wrote:Seems people have already answered. You need a C++11 capable version of GCC. Version 4.8.1 is fine, and it's the one I'm using. Ubuntu comes with GCC (C compiler only) but you have to install the package g++ separately for the C++ compiler (and C++ standard libraries).

If you have a slightly old version of GCC, it should work by replacing 'c++11' bu 'c++0x' in the 'make.sh' file. If it's really old, then it will not work.
Hey Lucas,

I'm thinking of switching to C++11 and I'm wondering about your experiences with it. Has it been worth the switch? How painful was the transition?

regards,
--tom
DiscoCheck was written in plain C up to version 3.7.1. Version 4.0 is a complete C++ rewrite:
* the transition was a lot of (useless) work.
* it is not worth the switch at all. C++ adds nothing useful to the table, except being and endless waste of time to read encyclopedic books to be able to use it properly...

Besides the syntactic sugar, the only things in C++ that I did find useful are:
* string/stringstream
* namespaces (technically they are syntactic sugar, but I really do like them)
* std::chrono (portable high resolution clock avoiding lots of ugly ifdef's)

Don't listen to the C++ Mermaids... I speak from experience.
Really? I thought that at least it would "improve" something in a chess engine

I remember that Linus Torvalds in their mail list were talking about C++, and he answered very angry even with bad words about C++, here you can read it: http://thread.gmane.org/gmane.comp.vers ... ocus=57918 but I think that they were talking about the Linux Kernel, pff you know, change all the damn C to C++ in a Linux Kernel, that's totally insane :lol:
User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: How to compile discocheck?

Post by lucasart »

tttony wrote: Really? I thought that at least it would "improve" something in a chess engine

I remember that Linus Torvalds in their mail list were talking about C++, and he answered very angry even with bad words about C++, here you can read it: http://thread.gmane.org/gmane.comp.vers ... ocus=57918 but I think that they were talking about the Linux Kernel, pff you know, change all the damn C to C++ in a Linux Kernel, that's totally insane :lol:
Whether C++ is acceptable to program an operating system kernel or not, is a completely different question. Torvalds knows very well what he's talking about. Very few people have first hand experience in writing an operating system from scratch, so I don't think anyone here has the competence to second guess Torvalds on this. Even the Windows kernel is written mostly in C, IIRC. So there must be good reasons why C++ is not an option in the kernel. I've never heard of a kernel developper say otherwise. As for the opinion of people on talkchess or on C++ forums... who cares?

But for user space programs (like a chess engine), C++ is a perfectly good programming language. My opinion is that:
* If you want to write a chess engine from scratch, you sould pick whichever language you're most experienced with. Writing a chess engine is complicated enough as it is, without having to fight with the programming language itself.
* If you have a perfectly working program written in C, and wonder whether you should rewrite it in C++, my answer is NO. This was the question asked, that I answered. And vice versa (no need to rewrite in C a perfectly working C++ engine).

PS: Linus really flamed that guy. But the guy was clearly a Troll, high on C++ kool-aid, trying to do some provocation in the kernel forum. He deserves to be flamed.
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.