Is there an engine written in Go?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Is there an engine written in Go?

Post by zullil »

User avatar
velmarin
Posts: 1600
Joined: Mon Feb 21, 2011 9:48 am

Re: Is there an engine written in Go?

Post by velmarin »

You on Github, gochess. (search google)

and in this forum post Jim Ablett, Turgenev.


http://www.talkchess.com/forum/viewtopi ... t=turgenev
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: Is there an engine written in Go?

Post by Don »

zullil wrote:http://golang.org/
I have embraced go myself and I have written an automated tester and am planning to write other tools including a GUI using Go. I already have a chess package for move validation. I could in fact use that to quickly put together a very primitive go engine in a short amount of time. But I don't plan to do that.

Don
Capital punishment would be more effective as a preventive measure if it were administered prior to the crime.
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: Is there an engine written in Go?

Post by Don »

Don wrote:
zullil wrote:http://golang.org/
I have embraced go myself and I have written an automated tester and am planning to write other tools including a GUI using Go. I already have a chess package for move validation. I could in fact use that to quickly put together a very primitive go engine in a short amount of time. But I don't plan to do that.

Don
P.S. I give golang a big thumbs up - but it's probably not the ideal language for writing a super high performance chess program - but maybe in the future it could be. It's native code but it's not C speed - at least not yet.

I'm viewing golang as my new high level language of choice - to replace code I might write in perl, python, ruby, tcl or lua and get much of the speed I would get from C but with high level language ease of programming. This is kind of the holy grail of computer languages and I think golang so far is the best match for that, although I am also very fond of D.
Capital punishment would be more effective as a preventive measure if it were administered prior to the crime.
Henk
Posts: 7220
Joined: Mon May 27, 2013 10:31 am

Re: Is there an engine written in Go?

Post by Henk »

I have programmed in many languages at least more than ten. C++ used to be my favorite. But the last years its C#. Maybe it's a bit slower than C++. But you have less problems with memory leaks and it checks array boundaries. No problems with dangling pointers. It also supports generic types and methods. I don't want to go back to C++ only if I have to.

Scripting languages used to be too slow and instead of compile time errors you get run time errors which are more difficult to resolve.
AlvaroBegue
Posts: 931
Joined: Tue Mar 09, 2010 3:46 pm
Location: New York
Full name: Álvaro Begué (RuyDos)

Re: Is there an engine written in Go?

Post by AlvaroBegue »

Henk wrote:I have programmed in many languages at least more than ten. C++ used to be my favorite. But the last years its C#. Maybe it's a bit slower than C++. But you have less problems with memory leaks and it checks array boundaries. No problems with dangling pointers.
I haven't had a memory leak in C++ in 10 years. A few rules that will keep you out of trouble:
* Use standard containers of objects, not pointers (so std::vector<Move>, not std::vector<Move *>).
* If you need to use pointers (for polymorphism, mostly, although there is very little use for this in a chess engine), use the appropriate smart pointer (often std::unique_ptr).
* Don't use `new' directly, because you don't need it.

There are tools that can help with bounds checking, like AddressSanitizer (http://clang.llvm.org/docs/AddressSanitizer.html), available in Clang. I have used Valgrind in the past, which can help detect problems of that sort as well. But I have only used that in the context of a huge project with dozens of programmers and code that evolved over two decades. In my chess engine I haven't had any problems of this sort.

EDIT: This message isn't intended as a defense of C++ (I don't particularly like it!), but as practical advice for people who use it.