Answers.Body: <p>If I were going to do this, I'd choose Stockfish, Fruit 2.1, and Crafty for no reason other than their high quality is proven.  Then I'd compare and contrast the techniques, algorithms, and choices made by each.</p>
  
  <p>These aren't easy programs; it would be a lot of work to gain a true understanding.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2012-06-18T16:24:53.007Z
Answers.Text: +1 on this, your first priority should not be efficiency but understanding the theory, which is way easier if the framework has a proven high quality standard.  Performance comes later, after you understand what the hell is going on!
Answers.UserDisplayName: tmesser
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2013-05-22T12:17:39.557Z
Answers.Text: The Stockfish code is exceptionally clear, which is a rarity for chess engines.
Answers.UserDisplayName: dfan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2012-06-16T13:23:53.373Z
Answers.LastActivityDate: 2012-06-16T13:23:53.373Z
Answers.UserDisplayName: Tony Ennis
Answers.Body: <p>This is not a direct answer to your question — but because you're interested in Java, check out <a href="http://code.google.com/p/magnumchess/" rel="nofollow noreferrer">this link</a>, which has a UCI compatible engine written in Java. Browsing through the code it looked quite readable. It loses to Crafty and Stockfish regularly, but that is to be expected — they usually looked ~4 ply deeper because of the speed difference.</p>
  
  <p>I think it will suit your needs as a fairly strong engine that runs on Java, if only to review the code.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2012-06-18T03:35:10.897Z
Answers.LastActivityDate: 2016-12-20T18:01:17.537Z
Answers.LastEditDate: 2016-12-20T18:01:17.537Z
Answers.UserDisplayName: Eve Freeman
Answers.Body: <p>For many years, nearly all professional chess programmers have tested code changes <a href="https://chessprogramming.wikispaces.com/Texel%27s+Tuning+Method" rel="noreferrer">by running many blitz games</a> to see whether their changes have improved engine performance.  <a href="http://www.genetic-programming.org/hc2014/David-Paper.pdf" rel="noreferrer">Here's a paper</a> describing a genetic programming technique across many blitz games.  Stockfish programmers follow this same method in conjunction with <a href="http://tests.stockfishchess.org/tests" rel="noreferrer">Fishtest</a>.</p>
  
  <p>Stockfish programmers typically test proposed changes by running many fast games with tight time controls.  If the proposed changes show a benefit, then the change is submitted for testing at tournament time controls.</p>
  
  <p>Stockfish is not unique in this regard.  Nearly all professional or semi-professional engines were tuned at blitz time controls first, and then at tournament controls.</p>
  
  <p>So, in short, because of the way that most chess engines are tuned, I personally feel your supposition is incorrect -- I feel it is more likely that the "most efficient" chess engine will be the best performing engine at any time control.</p>
  
  <p>tl:dr; <a href="https://stockfishchess.org/" rel="noreferrer">use Stockfish</a></p>
  
  <p>EDIT: Not sure why my answer is getting downvoted here.  As further evidence that what I'm saying is correct, please check out the <a href="http://www.computerchess.org.uk/ccrl/404/" rel="noreferrer">CCRL 40/4</a> and the <a href="http://www.computerchess.org.uk/ccrl/4040/" rel="noreferrer">CCRL 40/40</a> automated ratings lists.  If you compare the two lists you will see that the strongest performers in the 40/40 list are almost exactly the same strongest performers in the 40/4 list.  And there is no engine that has an incredible performance jump at tournament vs. blitz controls -- they all typically remain within about 50 ELO of their blitz ratings at long time controls.  To me, that is clear evidence of a critical connection between blitz engine "efficiency" and tournament engine "efficiency".</p>
  
  <p>If you want a toy engine to hack on, here is my <a href="http://chess.johnbyrd.org" rel="noreferrer">Superpawn</a> engine.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-29T00:09:05.713Z
Answers.Text: You may be right, John, but the devil's advocate in me suggests that the engines are similarly rated at Blitz and Standard time controls because _they were engineered the same way_.  If a change was discarded because it showed no improvement under blitz timing, no one would ever know if that change would have resulted in a substantial improvement _but only at standard time controls_, because it's never been tested. For example, any tweak that might have helped overcome the Horizon Problem would probably not budge the ELO at blitz, but might be invaluable at STC.
Answers.UserDisplayName: jaxter
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-03T08:52:41.027Z
Answers.Text: If you're correct, then you should be able to point out a top-100 chess engine that has a significantly different ranking on the CCRL 40/4 from the CCRL 40/40 ratings lists.  HINT: You can't
Answers.UserDisplayName: johnwbyrd
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-05T19:56:34.867Z
Answers.LastActivityDate: 2016-02-10T00:36:13.580Z
Answers.LastEditDate: 2016-02-10T00:36:13.580Z
Answers.UserDisplayName: johnwbyrd
Answers.Body: <p>First, the definition in the question doesn't make much sense. @johnwbyrd is correct, the 'most efficient' chess engine chess engine should be the best performing engine at any time control.</p>
  
  <p>In general, the stronger the engine is the more efficient the computing resources are utilised. This is expected because a chess engine is really a fast calculator of chess moves. The more (and accurate) moves it can think, the better it becomes.</p>
  
  <p>A strong chess engine such as Stockfish is a brilliant example of applying computer optimisation. For example, let's take a look at how the hash table is implemented in Stockfish: </p>
  
  <pre><code>class TranspositionTable
  
    static const int CacheLineSize = 64;
    static const int ClusterSize = 3;
  </code></pre>
  
  <p>This definition is telling us the size of a cluster in the hash table should be evenly divided by the size of a cache line. It is a very clever optimization because it ensures no extra CPU cycle would be needed as each data transfer can only be done for each line block.</p>
  
  <p>There're many other optimisation examples, such as lazy evaluation in a loop, making sure the threads have work to do etc etc.</p>
  
  <p>So, you see, a popular engine like Stockfish is highly optimised. The source code has been studied thoughtfully. I have every reason to believe Stockfish is the most optimised and efficient chess engine. </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2016-01-06T07:49:53.703Z
Answers.LastActivityDate: 2019-07-20T18:24:18.570Z
Answers.LastEditDate: 2019-07-20T18:24:18.570Z
Answers.UserDisplayName: SmallChess
Body: <p>I am learning artificial intelligence and chess programming. I want to analyze the architecture and read the code of existing chess engines. But I am confused between multiple choices. There are several free chess engines available, for example: </p>
  
  <ul>
  <li>Crafty </li>
  <li>GNU Chess</li>
  <li>Stockfish</li>
  <li>IPPOLIT</li>
  <li>Fruit 2.1</li>
  <li>(Add your chess engine here)</li>
  </ul>
  
  <p>I am wondering which chess engine is most efficient in terms of CPU cycles used.
  For example, if Crafty achieves 3300 ELO by thinking for 30 seconds on each move, and GNU chess achieves 2500 ELO by thinking 1 second on each move, I would consider GNU Chess to be more efficient.</p>
  
  <p>So which engine is most efficient? What would lead me to choose one over another?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2012-06-16T13:18:26.047Z
Comments.Text: I'm not too sure about your definition of efficiency.  In your example, an 800 point difference is _huge_. It may be an amazing display of efficiency to get 800 additional Elo points in only 29 additional seconds.
Comments.UserDisplayName: Tony Ennis
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2012-06-16T13:21:36.370Z
Comments.Text: Second, why are you concerned with 'efficiency' and not the types of AI algorithms being used, if your goal is to learn AI programming?  Third, I believe any of these programs will be sufficiently challenging for someone to learn.
Comments.UserDisplayName: Tony Ennis
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2012-06-16T14:46:45.033Z
Comments.Text: @TonyEnnis I'm concerned with efficiency because I need to write my own code in Java that will run on mobile devices. An algorithm that runs in 30 seconds on my Core Quad machine will take forever on a mobile.
Comments.UserDisplayName: Monika Michael
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2012-06-16T14:49:04.953Z
Comments.Text: @TonyEnnis "It may be an amazing display of efficiency to get 800 additional Elo points". Agreed. But it's a waste of computation anyway. I am yet to see a player that could beat 2500. The highest rated player in the world is 2835. So I don't see the sense of trying to optimize your code for 3300.
Comments.UserDisplayName: Monika Michael
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2012-06-16T17:27:22.180Z
Comments.Text: First, computer ELO ratings are pretty dicey - computers don't play in top tournaments and thus their ELOs are less than reliable.  Further, the published ratings tend to be on custom hardware.  On common hardware they are somewhat lower.  Finally, your desire to have it play 'well enough' is logical, but that's a different thing.  You aren't looking for an 'efficient' program, you're looking for one that rates at 2500 (or whatever), takes X seconds per move on average, and can be written in Java.  That's a lot more concrete than some debatable 'efficiency.'
Comments.UserDisplayName: Tony Ennis
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2012-06-16T17:29:28.807Z
Comments.Text: Back to your example, it would be possible for a program to spit out a great move in 1 second, but this could require a HUGE opening book, or a HUGE set of end-game tables.  So there are other constraints you might want to consider also.  This is where study of the programs themselves will shed some light.
Comments.UserDisplayName: Tony Ennis
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2012-06-16T18:06:38.887Z
Comments.Text: By the way, I admire your ambition.  However, if you wrote a program from scratch, for a mobile device, in Java (not the speediest of languages), that was rated USCF 1800 or more, and played quickly enough (average 15 seconds a move?), I'd be super-impressed.
Comments.UserDisplayName: Tony Ennis
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2012-06-17T17:36:13.330Z
Comments.Text: Hey, try this link; it's about writing chess playing programs.  http://chessprogramming.wikispaces.com/Getting+Started
Comments.UserDisplayName: Tony Ennis
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2012-06-18T03:15:05.883Z
Comments.Text: 1800+ should be easy in Java.
Comments.UserDisplayName: Eve Freeman
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-02-17T09:16:42.993Z
Comments.Text: ELO is essentially a logarithmic scale.
Comments.UserDisplayName: Thorbjørn Ravn Andersen
Tags: <engines><software><programming>
Title: Which is the most CPU efficient chess engine?
ThreadText: # Which is the most CPU efficient chess engine?
  
  (Asked by: username_0 on 2012-06-16)
  
  I am learning artificial intelligence and chess programming. I want to analyze the architecture and read the code of existing chess engines. But I am confused between multiple choices. There are several free chess engines available, for example:
  
  * Crafty
  * GNU Chess
  * Stockfish
  * IPPOLIT
  * Fruit 2.1
  * (Add your chess engine here)
  
  I am wondering which chess engine is most efficient in terms of CPU cycles used.
  For example, if Crafty achieves 3300 ELO by thinking for 30 seconds on each move, and GNU chess achieves 2500 ELO by thinking 1 second on each move, I would consider GNU Chess to be more efficient.
  
  So which engine is most efficient? What would lead me to choose one over another?
  
  **Tags:** engines, software, programming
  
  > **Comments:**
  > **username_1**: I'm not too sure about your definition of efficiency.  In your example, an 800 point difference is _huge_. It may be an amazing display of efficiency to get 800 additional Elo points in only 29 additional seconds.  
  > **username_1**: Second, why are you concerned with 'efficiency' and not the types of AI algorithms being used, if your goal is to learn AI programming?  Third, I believe any of these programs will be sufficiently challenging for someone to learn.  
  > **username_0**: @username_1 I'm concerned with efficiency because I need to write my own code in Java that will run on mobile devices. An algorithm that runs in 30 seconds on my Core Quad machine will take forever on a mobile.  
  > **username_0**: @username_1 "It may be an amazing display of efficiency to get 800 additional Elo points". Agreed. But it's a waste of computation anyway. I am yet to see a player that could beat 2500. The highest rated player in the world is 2835. So I don't see the sense of trying to optimize your code for 3300.  
  > **username_1**: First, computer ELO ratings are pretty dicey - computers don't play in top tournaments and thus their ELOs are less than reliable.  Further, the published ratings tend to be on custom hardware.  On common hardware they are somewhat lower.  Finally, your desire to have it play 'well enough' is logical, but that's a different thing.  You aren't looking for an 'efficient' program, you're looking for one that rates at 2500 (or whatever), takes X seconds per move on average, and can be written in Java.  That's a lot more concrete than some debatable 'efficiency.'  
  > **username_1**: Back to your example, it would be possible for a program to spit out a great move in 1 second, but this could require a HUGE opening book, or a HUGE set of end-game tables.  So there are other constraints you might want to consider also.  This is where study of the programs themselves will shed some light.  
  > **username_1**: By the way, I admire your ambition.  However, if you wrote a program from scratch, for a mobile device, in Java (not the speediest of languages), that was rated USCF 1800 or more, and played quickly enough (average 15 seconds a move?), I'd be super-impressed.  
  > **username_1**: Hey, try this link; it's about writing chess playing programs.  http://chessprogramming.wikispaces.com/Getting+Started  
  > **username_2**: 1800+ should be easy in Java.  
  > **username_3**: ELO is essentially a logarithmic scale.  
  
  ---
  
  ## 4 answers
  
  ### Answer by username_1 on 2012-06-16. Score: 6
  
  If I were going to do this, I'd choose Stockfish, Fruit 2.1, and Crafty for no reason other than their high quality is proven. Then I'd compare and contrast the techniques, algorithms, and choices made by each.
  
  These aren't easy programs; it would be a lot of work to gain a true understanding.
  
  > **Comments:**
  > **username_4**: +1 on this, your first priority should not be efficiency but understanding the theory, which is way easier if the framework has a proven high quality standard.  Performance comes later, after you understand what the hell is going on!  
  > **username_5**: The Stockfish code is exceptionally clear, which is a rarity for chess engines.  
  
  ---
  
  ### Answer by username_2 on 2012-06-18. Score: 6
  
  This is not a direct answer to your question — but because you're interested in Java, check out [this link](http://code.google.com/p/magnumchess/), which has a UCI compatible engine written in Java. Browsing through the code it looked quite readable. It loses to Crafty and Stockfish regularly, but that is to be expected — they usually looked ~4 ply deeper because of the speed difference.
  
  I think it will suit your needs as a fairly strong engine that runs on Java, if only to review the code.
  
  
  ---
  
  ### Answer by username_6 on 2016-01-05. Score: 4
  
  For many years, nearly all professional chess programmers have tested code changes [by running many blitz games](https://chessprogramming.wikispaces.com/Texel%27s+Tuning+Method) to see whether their changes have improved engine performance. [Here's a paper](http://www.genetic-programming.org/hc2014/David-Paper.pdf) describing a genetic programming technique across many blitz games. Stockfish programmers follow this same method in conjunction with [Fishtest](http://tests.stockfishchess.org/tests).
  
  Stockfish programmers typically test proposed changes by running many fast games with tight time controls. If the proposed changes show a benefit, then the change is submitted for testing at tournament time controls.
  
  Stockfish is not unique in this regard. Nearly all professional or semi-professional engines were tuned at blitz time controls first, and then at tournament controls.
  
  So, in short, because of the way that most chess engines are tuned, I personally feel your supposition is incorrect -- I feel it is more likely that the "most efficient" chess engine will be the best performing engine at any time control.
  
  tl:dr; [use Stockfish](https://stockfishchess.org/)
  
  EDIT: Not sure why my answer is getting downvoted here. As further evidence that what I'm saying is correct, please check out the [CCRL 40/4](http://www.computerchess.org.uk/ccrl/404/) and the [CCRL 40/40](http://www.computerchess.org.uk/ccrl/4040/) automated ratings lists. If you compare the two lists you will see that the strongest performers in the 40/40 list are almost exactly the same strongest performers in the 40/4 list. And there is no engine that has an incredible performance jump at tournament vs. blitz controls -- they all typically remain within about 50 ELO of their blitz ratings at long time controls. To me, that is clear evidence of a critical connection between blitz engine "efficiency" and tournament engine "efficiency".
  
  If you want a toy engine to hack on, here is my [Superpawn](http://chess.johnbyrd.org) engine.
  
  > **Comments:**
  > **username_7**: You may be right, John, but the devil's advocate in me suggests that the engines are similarly rated at Blitz and Standard time controls because _they were engineered the same way_.  If a change was discarded because it showed no improvement under blitz timing, no one would ever know if that change would have resulted in a substantial improvement _but only at standard time controls_, because it's never been tested. For example, any tweak that might have helped overcome the Horizon Problem would probably not budge the ELO at blitz, but might be invaluable at STC.  
  > **username_6**: If you're correct, then you should be able to point out a top-100 chess engine that has a significantly different ranking on the CCRL 40/4 from the CCRL 40/40 ratings lists.  HINT: You can't  
  
  ---
  
  ### Answer by username_8 on 2016-01-06. Score: 1
  
  First, the definition in the question doesn't make much sense. @username_6 is correct, the 'most efficient' chess engine chess engine should be the best performing engine at any time control.
  
  In general, the stronger the engine is the more efficient the computing resources are utilised. This is expected because a chess engine is really a fast calculator of chess moves. The more (and accurate) moves it can think, the better it becomes.
  
  A strong chess engine such as Stockfish is a brilliant example of applying computer optimisation. For example, let's take a look at how the hash table is implemented in Stockfish:
  
  ```
  class TranspositionTable
  
    static const int CacheLineSize = 64;
    static const int ClusterSize = 3;
  
  ```
  
  This definition is telling us the size of a cluster in the hash table should be evenly divided by the size of a cache line. It is a very clever optimization because it ensures no extra CPU cycle would be needed as each data transfer can only be done for each line block.
  
  There're many other optimisation examples, such as lazy evaluation in a loop, making sure the threads have work to do etc etc.
  
  So, you see, a popular engine like Stockfish is highly optimised. The source code has been studied thoughtfully. I have every reason to believe Stockfish is the most optimised and efficient chess engine.
  
  
  ---
  
  