Which programming language should I use for developing an AI that plays Go?

Since I don’t think anyone has mentioned it yet, the Go programming language is wonderful. It’s small and easy to learn due to its minimalism of design. The community is great, it’s a nice modern language with helpful built-in tooling, and it has good performance. It’s also a statically-typed language, which helps avoid mistakes and reduce the need for testing, while still being extremely good for get-up-and-go productivity.

Is it the absolutely easiest language to pick up as your first thing to learn? Probably not, but it’s not far off. And I see no reason why it couldn’t be put to good use in this domain (there are certainly Go AI libraries out there you can draw upon as well – perhaps not the rich ML ecosystem Python has, but you can also bind to that stuff from Go if you really want to use some of it).

Plus, it’s named Go!

1 Like

I’m quite sure the last three responses are confusing the topic title with the question “Which programming language should I use for learning programming”.

As a test I googled “machine learning tutorial”, opened all links on the first page, and counted which programming language was being used.


The first two use Python

The third one doesn’t even mention any programming language at all (since it’s about machine learning).

The fourth and fifth one, Python again.

The sixth one is a video which for 90% does not cover any programming, but for the 10% it does: Python

The seventh one is another video which doesn’t really talk much about programming, but it doesn’t use Python! Thank God, finally some programmers who know how horrible Python is! See, Python isn’t the best language to start with!
They use Matlab instead…

The eighth one does not cover much programming, but has a section on how to learn Machine Learning. It recommends to start with mathematics, statistics and machine learning algorithms before coming to programming languages.There they recommend Python, Java, Scala and R, specifically stating that Python is the most popular one

The ninth one does not give any programming examples, but has the following to say about Python:

Python is the most popular programming language used by machine learning professionals. Syntax of Python is elegant and very simple. So, it can be learnt very easily. Hence, many machine learning algorithms can be implemented in it. Python takes very less development time when compared with other programming languages such as Ruby, C++, or Java.

And the following about C++:

C/C++ may not be your first choice when you are working on machine learning problems, but, it can be the answer when you cannot afford the overhead of a Python or a Java Virtual Machine interpreter. However, you need to get back to the world of pointers when you need to squeeze every last bit of performance from the system.

I’m not sure about you, but the first one reads like the friendlier language for beginning programmers.

The tenth one: Python

The eleventh one doesn’t even mention any programming language

The twelfth mentions that Python is the most popular and has most libraries to use, but recommends Java and C/C++ for those who want to get better performance, security or freedom. It specifically mentions that these are preferred by professionals due to being good programmers.

Finally there’s a book that does not mention any programming examples, except for a section on logical programming, which seems to use some Prolog examples.


Bottom line: if you’re trying to find a tutorial on Machine learning, the vast majority are either given in Python or are not programming tutorials in the first place.

7 Likes

In case it was extremely confusing, any of these languages will honestly work just fine for implementing an AI that plays go:

  • C
  • C++
  • C#
  • Common Lisp
  • D
  • Erlang
  • FORTH
  • Fortran
  • Go
  • Haskell
  • J
  • Java
  • JavaScript
  • ML
  • Perl
  • PHP
  • Prolog
  • Python
  • Ruby
  • Rust
  • Scheme
  • Smalltalk

Just pick any. There are only a few domain specific languages that are clearly unsuitable despite being Turing complete, like PostScript, TeX and SQL.

Your first project is not going to be AlphaGo anyway, but programming is great fun and will be the most important skill during the remainder of 21st century (unless superceded by futile attempts at agriculture in a radioactive wasteland, but then you will look back at the good old days when we had electricity and were programming as you eat your glowing potatoes).

2 Likes

I was under the impression that the OP wanted to focus on the AI engine part of a Go bot, rather than worrying about a GUI to interact with it. Writing a GUI is a completely separate task, and could be accomplished with any of a variety of programming languages and GUI frameworks and libraries.

The GUI and AI should be modular (interchangeable) components that can be developed independent of each other. A commonly used standard for the interface between the two is called the Go Text Protocol (GTP). See that link for a variety of GUIs (clients) that can interface with any bot that implements the GTP.

If one does not want to implement a GUI, I would recommend using Sabaki or Lizzie, in particular.

The overwhelming majority of deep learning practitioners, who use Python, would strongly disagree with that.

The lack of such operators has very little impact on the practical performance of the language.

It seems that you might not be familiar with how intensive scientific computing works in Python. The heavy number crunching is not typically executed in plain Python through the interpreter, but instead people use libraries like NumPy that performs the compute by offloading to a natively compiled backend library. Deep learning frameworks offload the heavy compute to the GPU via libraries like cuda and cudnn.

Basically, the interpretted nature of Python does not prevent its widespread use for applications with high computational demands.

Lol, that describes a common practice with virtually every programming language.

3 Likes

A language should be as expressive as possible, a good example is APL.

Yes, it does. Maybe not for this application, but for heavy applications in general. C will perform much better, Python will be about 10 times slower in the general case, and it will still be slower even if you use a native library.

Only by extremely bad programmers who have no business being near a compiler.

My last was (turbo) pascal but I see it’s now a dinosaur thing

Why discuss that on this topic then? I don’t think OP has to worry in the slightest about optimisation for their first project. It’s a thing to tackle once it becomes a problem.

C/C++ seems to me like the easiest way to kill an early interest in machine learning by sending the OP into the arduous and irrelevant task of wading through pointers, mismatched brackets and mem alloc errors.


Compare it to teaching Go, you explain the rules roughly, and deal with seki once the time is ripe. You don’t send a beginner to read through the whole Japanese ruleset before their first game.

3 Likes

Last time I wrote a chess engine it was slow, and it was written in C. I was very happy that I did not write in in Java when I saw how slow it was at a relatively shallow search depth. I assume this will be slow or slow-ish too, but I have never written an ANN.

Ah, on the contrary, I think C is the best lesson you can have. The best start. It makes you understand what an array is and what a pointer being null really means. I totally 100% agree with you on C++ though – what a nightmarish mess.

1 Like

Which I agree is a good thing if you want to learn programming.

But this topic is about learning machine learning. It’s relatively irrelevant to learn programming…

3 Likes

I don’t think you need to program an interface. You could spend a long time tweaking something like that to look nice and get nowhere with the ai :slight_smile:

You could just get it to print ascii characters to the command line in the shape of the board :slight_smile:

If you use vanilla python maybe, it also has libraries like numpy, scipy and probably the same linear algebra libraries that any other code would use like BLAS and LAPACK.

Anyway I think the issue of getting something to run/work is much more pressing than how slow it is and I get at the end of the day that you want machine learning to be fast, but at some point that will be hardware issue too.

2 Likes

Cloud computing :wink:

1 Like

Then it becomes a money issue :money_mouth_face:

2 Likes

Lisp! Check this out https://github.com/norvig/paip-lisp/releases/download/v1.0/PAIP-scanned.pdf - Paradigms of Artificial Intelligence Programming

1 Like

Isn’t a book from 1992 a tiny little bit outdated? :sweat_smile:

1 Like

Still involves cash-money. I’ve seen google charge a decent bit to use gpus.

1 Like

No one said it has to look perfect. The OP has zero programming experience–let him tinker a little!

1 Like