user19802: I am both an avid chess player and computer programmer. I would say that playing chess and programming are the two things I spend the most time doing. Naturally, I am wanting to create my own engine and, ultimately, Lichess bot.
In wake of AlphaZero's crushing performance against Stockfish last year, I am considering whether I should create this engine with machine learning (some type of neural network, possibly using Tensorflow) or traditional, hard coded heuristics.
I am less familiar with neural networks than other kinds of hard-coding. Still, it could be a good way for me to learn to work with neural networks.
Another thing I am considering is whether it is important which language I use to code the engine. I know many chess engines use C++, which I have never used before. I have used other C-based languages which do many of the same things, with mostly varying syntax. I am most familiar with Swift and Javascript, but am also familiar with Python and feel that it could do the trick for me.
So, in terms of creating the strongest chess engine possible, should I go neural network or hard-coded?
Update:
I am writing a traditional engine in C++. It is currently somewhat UCI compatible and plays at what I estimate is 1100ish ELO. But it generates legal moves and I’ll be posting updates here.
This is the link to the github repo for the engine. Feel free to fork and make PRs, or just make general suggestions/tips.

user307: I built a purely toy chess engine using: python chess it was really nice not having to code the rules of the game myself and just focus on the logic; however, the number of position I was able evaluate per second is very low. This might be a good starting point.

user18349: 
So, in terms of creating the strongest chess engine possible, should I go neural network or hard-coded?

Don't choose a NN unless you have access to ridiculous(A few hundred Nvidia V100s). Training a NN to play chess takes so much hardware. See the people contributing to Lc0 to train over 200 million games. Since you will probably have trouble accessing the hardware (you could try to get some at Google Colabatory, but with only that, training will be very slow).
Edit: Using a NN With Supervised learning, you MAY get away with just Google Colab and possibly one strong GPU (2080, 2080Ti, Radeon VII).

Another thing I am considering is whether it is important which language I use to code the engine. I know many chess engines use C++, which I have never used before. I have used other C-based languages which do many of the same things, with mostly varying syntax. I am most familiar with Swift and Javascript, but am also familiar with Python and feel that it could do the trick for me.

Python and Javascript are probably too slow for a strong chess engine. I haven't used Swift but it probably won't like platforms other than macOS, so it's probably better to use C or C++. You could also possibly use Rust, but that has many safety features that get annoying and you don't really need, which can get annoying. It's also going to be harder to get good performance out of it since certain low-level optimizations are hard to make. Of course, you can always write it in assembly but that's probably going to be too much work. see https://www.chessprogramming.org/Languages/

user20208: First step: Define your goals/reasons
I think this is the predominant factor. Which of these best fits you? (Choose only one)

You want to enjoy a fun, challenging coding task
You want to create an extremely good chess engine
You want to learn about how chess engines work
You want to learn/practice coding skills
You want to learn/implement computer science concepts/theory (e.g. machine learning)
(Other)

IMO it's fine to "toss a coin" for anything except 2. For all the others, you will meet your goal whether you choose ML or hard-coding. However you probably want a comparison between the choices to help you decide.
The case for hard-coding
Playing chess (as a human) involves logical thinking. You explore the space of possible actions you and the opponent can take. This has spawned a field called game theory which contains theoretical frameworks for analysing games in general.
If you enjoy working with details and being specific and reasoning about things then this could work well for you. In comparison, machine learning involves a lot more "black box" algorithms which are fuzzy and opaque. You don't know exactly what is going on.
Also I reckon you will have an easier time "figuring it out on your own" if you go the hard-coding route rather than machine learning. Less copy-pasting stuff you don't fully understand.
The case for machine learning
It can be exciting to give birth to a creation and watch it take on a life of its own.  While hard-coding is all about precision and detail, machine learning is flexible. Take away some neurons and the result will probably be similar.
Hard-coding is about studying chess. Machine learning is about studying the creature you have created.
And machine learning is, of course, a very hot topic.
Language choice for hard-coded
I am not sure what you mean by "other C-based languages". C++ is the only mainstream language that is anything like C. The advantage of C/C++ is that they are fast. Although other languages have caught up over the years, C++ still gives them a run for their money.
C++ isn't easy. You will get great performance out of more modern compiled languages like Rust, Golang or Swift. But it shouldn't be much worse if you go for a JIT language. I.e. don't use the CPython interpreter; use IronPython or Jython, or Node, or C# or Java.
GPU programming requires a different approach and I would advise against it at this point.
Language choice for machine learning
The problem with TensorFlow is that it is very low-level. It is more about writing number-crunching algorithms (which can be farmed out to parallel hardware) than about an interface dedicated to machine learning.
Of course, it can be a great learning experience! And is certainly very worthwhile learning today. However, you may want to start with Keras or PyTorch.

user15223: If you're trying to make the strongest engine possible, absolutely go for NN engines.
Traditional engines are great - Stockfish is arguably still the strongest engine on the planet on consensus equal hardware - but they are hard to write. These engines didn't get where they were overnight; they took years and years of work. Stockfish for example has been steadily gaining elo for six years. If you start from scratch, you will not get anywhere near Stockfish strength quickly; in fact you are likely to stall several hundred elo from where Stockfish currently is. For comparison some of the strongest single-author engines right now are Ethereal, Laser, and Xiphos (I neglect Houdini & Fire since they aren't open source). These engines are all substantially weaker than Stockfish.
Why are they so much weaker? Two reasons:

At this level, developing an engine takes a lot of computational power. What you do is look through your code and identify an idea that could gain elo. An example idea is, "if we know this move is probably good, do not search branches that reverse that move" (if this doesn't make sense to you, it means there's going to be a high learning curve as well). You then write a patch that implements the idea, and test the modified engine against the previous version. At this level, it takes tens of thousands of games to get a large-enough sample size to tell if the patch is effective. Playing these games takes huge amounts of computational power. Stockfish has access to super hardware: as of time of writing, the Stockfish testing ground Fishtesting is running with 1038 cores. For comparison a typical desktop computer might have 4-8 cores.

The other reason is that Stockfish is backed by many brains. As of time of writing, there are 8 patches written by 5 people being tested. If you look through the patch histories you'll find many more developers who've written patches. I don't know how many active Stockfish developers there are, but it's certainly >20.


On the other hand, NN engines (relatively) easily reach a strength that's well above Ethereal/Laser/Xiphos. See for yourself in the latest Top Chess Engine Championship tournament. Ethereal/Laser/Xiphos are in League 1, which is credible enough, but the engines in the top division (Division P) are:

Stockfish (community-backed traditional engine, runs with Fishtesting)
Komodo (commercial traditional engine, has full-time developers)
Komodo MCTS (commercial semi-traditional engine, has full-time developers)
Houdini (commercial traditional engine, is a one-man effort, hasn't been updated for two years)
Leela Chess Zero (community-backed NN engine, runs with the analog of Fishtesting aka a ton of hardware)
AllieStein (2-man NN engine)
Stoofvlees (NN engine)
ScorpioNN (NN engine)

The last three engines - AllieStein, Stoofvlees and ScorpioNN - are all small collaborations by people who, as far as I know, are enthusiasts like you and not full-time developers. They've gotten to Div P strength after less than two years of trying (all these NN engines only appeared after AlphaZero). Nobody single author has ever written a traditional engine that competed successfully with Stockfish/Komodo.* For comparison, in the recent history of computer chess there has only been one person who's ever written a traditional engine that competed successfully with Stockfish & Komodo on his own (Robert Houdart, the author of Houdini).
It's true that you probably won't have the hardware to compete with Lc0, but Lc0 takes this much computational power because it's a "zero" engine - it's supposed to play chess without any kind of human knowledge except for rules. You don't need to use the same methodology. You could use e.g. the Stein methodology that uses supervised learning. It's arguably even better than going "zero" - after all it's AllieStein playing in the superfinal, not Lc0.
The upshot is: if your aim is to compete with the best engines in the world, you are far more likely to succeed with NN engines than traditional ones.
*It might look like Houdini is such an example, but Houdini is plagiarized from Stockfish.

19802: <p>I am both an avid chess player and computer programmer. I would say that playing chess and programming are the two things I spend the most time doing. Naturally, I am wanting to create my own engine and, ultimately, Lichess bot.</p>
<p>In wake of AlphaZero's crushing performance against Stockfish last year, I am considering whether I should create this engine with machine learning (some type of neural network, possibly using Tensorflow) or traditional, hard coded heuristics.</p>
<p>I am less familiar with neural networks than other kinds of hard-coding. Still, it could be a good way for me to learn to work with neural networks.</p>
<p>Another thing I am considering is whether it is important which language I use to code the engine. I know many chess engines use C++, which I have never used before. I have used other C-based languages which do many of the same things, with mostly varying syntax. I am most familiar with Swift and Javascript, but am also familiar with Python and feel that it could do the trick for me.</p>
<p>So, in terms of creating the strongest chess engine possible, should I go neural network or hard-coded?</p>
<p><strong>Update:</strong>
I am writing a traditional engine in C++. It is currently <em>somewhat</em> UCI compatible and plays at what I estimate is 1100ish ELO. But it generates legal moves and I’ll be posting updates here.</p>
<p><a href="https://github.com/ChopinDavid/Maestro-cpp" rel="nofollow noreferrer" title="This is the link to the github repo.">This is the link to the github repo for the engine.</a> Feel free to fork and make PRs, or just make general suggestions/tips.</p>
 307: <p>I built a purely toy chess engine using: <a href="https://pypi.org/project/python-chess/" rel="nofollow noreferrer">python chess</a> it was really nice not having to code the rules of the game myself and just focus on the logic; however, the number of position I was able evaluate per second is very low. This might be a good starting point.</p>
 18349: <blockquote>
  <p>So, in terms of creating the strongest chess engine possible, should I go neural network or hard-coded?</p>
</blockquote>

<p>Don't choose a NN unless you have access to ridiculous(A few hundred Nvidia V100s). Training a NN to play chess takes so much hardware. See the people contributing to <a href="https://lczero.org/" rel="nofollow noreferrer">Lc0</a> to train over 200 million games. Since you will probably have trouble accessing the hardware (you could try to get some at <a href="https://colab.research.google.com" rel="nofollow noreferrer">Google Colabatory</a>, but with only that, training will be very slow).</p>

<p><strong>Edit: Using a NN With Supervised learning, you MAY get away with just Google Colab and possibly one strong GPU (2080, 2080Ti, Radeon VII).</strong></p>

<blockquote>
  <p>Another thing I am considering is whether it is important which language I use to code the engine. I know many chess engines use C++, which I have never used before. I have used other C-based languages which do many of the same things, with mostly varying syntax. I am most familiar with Swift and Javascript, but am also familiar with Python and feel that it could do the trick for me.</p>
</blockquote>

<p>Python and Javascript are probably too slow for a strong chess engine. I haven't used Swift but it probably won't like platforms other than macOS, so it's probably better to use C or C++. You could also possibly use Rust, but that has many safety features that get annoying and you don't really need, which can get annoying. It's also going to be harder to get good performance out of it since certain low-level optimizations are hard to make. Of course, you can always write it in assembly but that's probably going to be too much work. see <a href="https://www.chessprogramming.org/Languages/" rel="nofollow noreferrer">https://www.chessprogramming.org/Languages/</a></p>
 20208: <h1>First step: Define your goals/reasons</h1>

<p>I think this is the predominant factor. Which of these best fits you? <em>(Choose <strong>only one</strong>)</em></p>

<ol>
<li>You want to enjoy a fun, challenging coding task</li>
<li>You want to create an extremely good chess engine</li>
<li>You want to learn about how chess engines work</li>
<li>You want to learn/practice coding skills</li>
<li>You want to learn/implement computer science concepts/theory (e.g. machine learning)</li>
<li>(Other)</li>
</ol>

<p>IMO it's fine to "toss a coin" for anything except 2. For all the others, you will meet your goal whether you choose ML or hard-coding. However you probably want a comparison between the choices to help you decide.</p>

<h1>The case for hard-coding</h1>

<p>Playing chess (as a human) involves logical thinking. You explore the space of possible actions you and the opponent can take. This has spawned a field called <em>game theory</em> which contains theoretical frameworks for analysing games in general.</p>

<p>If you enjoy working with details and being specific and reasoning about things then this could work well for you. In comparison, machine learning involves a lot more "black box" algorithms which are fuzzy and opaque. You don't know exactly what is going on.</p>

<p>Also I reckon you will have an easier time "figuring it out on your own" if you go the hard-coding route rather than machine learning. Less copy-pasting stuff you don't fully understand.</p>

<h1>The case for machine learning</h1>

<p>It can be exciting to give birth to a creation and watch it take on a life of its own.  While hard-coding is all about precision and detail, machine learning is flexible. Take away some neurons and the result will probably be similar.</p>

<p>Hard-coding is about studying chess. Machine learning is about studying the creature you have created.</p>

<p>And machine learning is, of course, a very hot topic.</p>

<h1>Language choice for hard-coded</h1>

<p>I am not sure what you mean by "other C-based languages". C++ is the only mainstream language that is anything like C. The advantage of C/C++ is that they are <em>fast</em>. Although other languages have caught up over the years, C++ still gives them a run for their money.</p>

<p>C++ isn't easy. You will get great performance out of more modern compiled languages like Rust, Golang or Swift. But it shouldn't be much worse if you go for a JIT language. I.e. <strong>don't use the CPython interpreter</strong>; use IronPython or Jython, or Node, or C# or Java.</p>

<p>GPU programming requires a different approach and I would advise against it at this point.</p>

<h1>Language choice for machine learning</h1>

<p>The problem with TensorFlow is that it is very low-level. It is more about writing number-crunching algorithms (which can be farmed out to parallel hardware) than about an interface dedicated to machine learning.</p>

<p>Of course, it can be a great learning experience! And is certainly very worthwhile learning today. However, you may want to start with Keras or PyTorch.</p>
 15223: <p>If you're trying to make the strongest engine possible, absolutely go for NN engines.</p>
<p>Traditional engines are great - Stockfish is arguably still the strongest engine on the planet on consensus equal hardware - but they are hard to write. These engines didn't get where they were overnight; they took years and years of work. Stockfish for example has been <a href="https://nextchessmove.com/dev-builds" rel="nofollow noreferrer">steadily gaining elo for six years</a>. If you start from scratch, you will not get anywhere near Stockfish strength quickly; in fact you are likely to stall several hundred elo from where Stockfish currently is. For comparison some of the strongest single-author engines right now are <a href="https://github.com/AndyGrant/Ethereal" rel="nofollow noreferrer">Ethereal</a>, <a href="https://github.com/jeffreyan11/laser-chess-engine" rel="nofollow noreferrer">Laser</a>, and <a href="https://github.com/milostatarevic/xiphos" rel="nofollow noreferrer">Xiphos</a> (I neglect Houdini &amp; Fire since they aren't open source). These engines are all substantially weaker than Stockfish.</p>
<p>Why are they so much weaker? Two reasons:</p>
<ol>
<li><p>At this level, developing an engine takes a lot of computational power. What you do is look through your code and identify an idea that could gain elo. An example idea is, &quot;if we know this move is probably good, do not search branches that reverse that move&quot; (if this doesn't make sense to you, it means there's going to be a high learning curve as well). You then write a patch that implements the idea, and test the modified engine against the previous version. At this level, it takes tens of thousands of games to get a large-enough sample size to tell if the patch is effective. Playing these games takes huge amounts of computational power. Stockfish has access to super hardware: as of time of writing, the Stockfish testing ground <a href="http://tests.stockfishchess.org/tests" rel="nofollow noreferrer">Fishtesting</a> is running with 1038 cores. For comparison a typical desktop computer might have 4-8 cores.</p>
</li>
<li><p>The other reason is that Stockfish is backed by many brains. As of time of writing, there are 8 patches written by 5 people being tested. If you look through the patch histories you'll find many more developers who've written patches. I don't know how many active Stockfish developers there are, but it's certainly &gt;20.</p>
</li>
</ol>
<p>On the other hand, NN engines (relatively) easily reach a strength that's well above Ethereal/Laser/Xiphos. See for yourself in the latest <a href="https://www.tcec-chess.com/archive.html?season=16&amp;div=p&amp;game=1" rel="nofollow noreferrer">Top Chess Engine Championship tournament</a>. Ethereal/Laser/Xiphos are in League 1, which is credible enough, but the engines in the top division (Division P) are:</p>
<ul>
<li>Stockfish (community-backed traditional engine, runs with Fishtesting)</li>
<li>Komodo (commercial traditional engine, has full-time developers)</li>
<li>Komodo MCTS (commercial semi-traditional engine, has full-time developers)</li>
<li><s>Houdini (commercial traditional engine, is a one-man effort, hasn't been updated for two years)</s></li>
<li>Leela Chess Zero (community-backed NN engine, runs with the analog of Fishtesting aka a ton of hardware)</li>
<li><a href="http://www.chessdom.com/alliestein-the-new-neural-network-entering-tcec-s15/" rel="nofollow noreferrer">AllieStein</a> (2-man NN engine)</li>
<li>Stoofvlees (NN engine)</li>
<li>ScorpioNN (NN engine)</li>
</ul>
<p>The last three engines - AllieStein, Stoofvlees and ScorpioNN - are all small collaborations by people who, as far as I know, are enthusiasts like you and not full-time developers. They've gotten to Div P strength after less than two years of trying (all these NN engines only appeared after AlphaZero). Nobody single author has ever written a traditional engine that competed successfully with Stockfish/Komodo.* <s>For comparison, in the recent history of computer chess there has only been one person who's ever written a traditional engine that competed successfully with Stockfish &amp; Komodo on his own (Robert Houdart, the author of Houdini).</s></p>
<p>It's true that you probably won't have the hardware to compete with Lc0, but Lc0 takes this much computational power because it's a &quot;zero&quot; engine - it's supposed to play chess without any kind of human knowledge except for rules. You don't need to use the same methodology. You could use e.g. the <a href="https://www.patreon.com/jjosh" rel="nofollow noreferrer">Stein methodology</a> that uses supervised learning. It's arguably even better than going &quot;zero&quot; - after all it's AllieStein playing in the superfinal, not Lc0.</p>
<p>The upshot is: <strong>if your aim is to compete with the best engines in the world, you are far more likely to succeed with NN engines than traditional ones.</strong></p>
<p>*It might look like Houdini is such an example, but <a href="https://chess.stackexchange.com/questions/29181/is-houdini-6-a-stockfish-clone">Houdini is plagiarized from Stockfish</a>.</p>
