Interview with Edsel Apostol (Philippines)
Programmer of Twisted Logic / Hannibal

February 25th, 2010
by Edsel Apostol & Frank Quisinsky

edsel-apostol Edsel Apostol (Philippines)

Hannibal is on the way ...

Twisted Logic:

16 CCT-12-Hannibal games
Games from the blitz-tournament too, *.pgn download file.
Sam Hamilton set different comments!

CCT-12 tournament site by Peter Skinner

Before I start the interview, Edsel Apostol sent a nice text with many information.

Edsel Apostol

I am 25 years old. I was born in 1984. I am a graduate of Computer Engineering and I am working now as a Software Engineer/Game Programmer. I've previously worked as a College Instructor for two semesters.

I used to be a chess player in College. I represent my school on various tournaments. My first experience with computer chess was, when I discovered a program named Ziggurat in the year 2001. I was 17 years old then. After that I became fascinated by how computers play chess.

It was the time of Ruffian when I became addicted with computer chess. I've researched about chess programming theory and studied it. I think I have through the years more than 1000 pages of paper printed with articles about computer chess programming and entire source codes of open source engines to study.

My first engine was written around February 2004. It was using an 0x88 move generation scheme. I have rewritten it about twice and it was still buggy so I scrapped them. I remembered Dann Corbit helping me fixed some bugs with one of those engines before. One can still find one of my early versions on the archives of the yahoo chess engines group.

My first successful engine was based from a bitboard move generation of an open source alpha version of Olithink (it was called pre alpha 5 then). It took me months before I managed to make my engine as strong as TSCP.

I worked with my engine through College making it stronger gradually. The engine that has the biggest impact on my engine then was Fruit. Then I spent countless hours by studying the Fruit/TOGA code. After I graduated in College on 2007, I decided to rewrite my engine from scratch as it was very Fruity (the 0.099x versions and earlier) and I wanted it to be more unique. The new engine was around 100 elo weaker than the old engine. It was more than a year before I managed to make it stronger. The new engine was influenced by Glaurung.

On June 2008, I released a new version (20080620) that is around 150 elo stronger than the previous version. Then I discovered a very nasty bug with my hash table implementation that gives a big boost in strength when fixed. I've also spent around two months working on it almost full time (from 20080404 version to 20080620 version). I didn't have work then for two months as it's school break and there are no classes (I was a College Instructor that time).

A new job and relocation to a new place has slowed me down in working with the engine and it was more than a year before I could release again a new version.

After that version release (20090922, the 64 bit version is already rated around 2800 in CEGT), there is a very strong controversial open source engine that has been released and it almost had me lost my interest in computer chess. It was a while before I started working with my engine again. This was also the time when I was acquainted with Sam Hamilton and we've started working with Hannibal. Then we are inspired by the Stockfish team.

I thought that two minds are better than one so I decided just to work with Hannibal and stop developing Twisted Logic anymore. I've enjoyed working with Sam as our skills are somewhat complementary. He is good at programming knowledge while my focal point is  the search and making sure that the program is well structured and bug free.

Sam and I share a common goal to make Hannibal as strong as possible, to be the strongest in the world. As of now, we are working on the tactical weakness of our engine (due to my non-conventional aggressive pruning method), and the holes in the evaluation function. After that I will be working with SMP while Sam will be in charge of writing code to tune the parameters automatically. We hope to have a working SMP implementation around April or May.

Spark - Hannibal, 1/2 : 1/2
Download all 16 CCT-12-Hannibal games


After move 29. ... Lxe5

Sam Hamilton:
A great position out of openings. Computers do not understand how out of play the white bishop is.

Grafic created with ChessBase 10.

You sent a lot of very helping information. Now I have to think about good and interesting question :-) Such a situation is really rarely. Means, that a programmer sent basic information before I start an interview! I like that, have many thanks!


Frank Quisinsky

It's interesting that more and more programmers are building teams. You mentioned briefly "Stockfish". It's indeed a good example. Other examples are the German programs Spike or Anaconda. A very good example is Don Dailey and GM Larry Kaufmann. How do you come in contact with Sam Hamilton?

Edsel Apostol
Sam was looking before for programmers to implement SMP on his engine. I showed some interest that time but since my own engine also has no SMP yet, I said that I will just volunteer when I've already implemented it in my own engine. Then the Stockfish team has shown that working with a team can be a success. Sam then advertised again looking for teammates. I've responded once more and it was the beginning of our collaboration.


Frank Quisinsky

I worked a long time with Martin Blume (Arena) in team. More than 3 years without any personal meetings just by mail only. This is possible, but often not easy to do. To phone is an other possibility. A big advantage is to work hand in hand, each day in the same office or living in the near of your partner. This is an advantage that companies have, like ChessBase for an example. On the other hand, today everything is possible in www. Let us speak about the future! How many commercials will be in the TOP 10 in the coming three years? What's your prognosis?

Edsel Apostol
In three years, there will still be a lot of commercial engines in the Top 10. Those commercial ones that has lagged behind will be replaced by the new ones. Those strong free engines will surely go commercial once they are strong enough to beat the strongest open source engine. I think that in the future when there will already be a lot of very strong free chess engines, there will be no more commercial market for standalone engines. The commercial aspects of computer chess will then focus on giving better features. They will compete on which complete program with GUI gives the best set of features that caters for teaching chess, analysing games, etc.


Frank Quisinsky

Do you think that stronger freeware will make the situation for commercials more difficult in the near future?

I will give you an example:

Fritz is a very interesting chess program with a long time development. If Fritz has a bad position, the engine tries to get a draw. No other program has such a high draw quote in SWCR. Now most are thinking Fritz plays passive chess. This isn’t right, because if Fritz has an advantage, the engine opens the position and tries to win very fast with very aggressive moves. A much clarified engine which comes near to human playing style. For such an engine, I am sure; a freeware programmer needs a lot of development time. Your opinion?

Edsel Apostol
Yes, stronger freeware will limit the selling potential of the commercial engines especially if the freeware are as strong or stronger than the commercial ones. I think that there are a lot of talented programmers that could make an engine better than Fritz or Rybka if they just work on it full time. It's just that there seems to be not much money in computer chess nowadays so they are reluctant to give up their jobs.


Frank Quisinsky

Do you and Sam have any commercial intentions with Hannibal? Or can we await a free available Hannibal in the future ... in the near future, perhaps tomorrow, in the next hours, minutes :-)

I will have it, no doubt about it.

Edsel Apostol
We haven't talked about going commercial yet. This is just a hobby for us that we enjoyed so much and we like to keep it that way for now. Our first version will surely be free. Maybe if we manage to make it stronger than any open source engines then we might go commercial also so as not to hurt the sales of other commercial engines. Currently we are still having problems with Hannibal's tactics and some holes in the evaluation like pawn shelter/storm. We need to address those issues first before considering to release a version. I think you could expect it mid-March or early April.

Hannibal - Crafty, 1:0
Download all 16 CCT-12-Hannibal games


After move 36. ... Qe5?

Sam Hamilton:
I am not sure why Crafty allowed 37. Qh5 given this time control and 8 Cores. It clearly leads to a win for Hannibal.

Grafic created with ChessBase 10.


Frank Quisinsky

The strongest engine in the world? A good motivation to do that with Stockfish as model. To have the strongest one is the dream of many other programmers. Hannibal will have a lot of opponents. So far we have a nice situation. The free engines Stockfish, Komodo, Critter, Spark gets bigger steps. I am sure that Rybka was number 1 for the longest time. Also other commercials, like Shredder, Fritz, come with clearly stronger versions. How long do you and Sam need to get Rybka 3 level?

Edsel Apostol
We don't have an estimate yet on how long we're going to reach the Rybka 3 level but we will surely give our best to achieve that in the shortest time possible considering our busy schedule with work and family. Stronger oppositions just add to our motivation to make our engine stronger.


Frank Quisinsky

With GM Eugenio Tore the Filipinos had a super star. Thinking on the great games Tore played vs. Anatoly Karpow. I am sure chess is very popular in your country. Is computerchess popular too? Do you play chess in a chess club? How much Filipinos chess club players using chess software. Do you have any information about it? It's possible to buy chess software in stores in your country? Which chess software is most popular?

Edsel Apostol
Computerchess is not that popular yet due to the country being still a developing country and having a PC at home is a luxury and can be afforded only by the well to do. Chess though is popular. I think there are a lot of potential players here. It's just that they lack exposure and training. I am not that active anymore in playing over the board games since work has been a priority in the past couple of years. Chess club players I think are already aware of Rybka though the most popular chess software is still Chessmaster then next is Fritz. Chess software is somewhat rare here.


Frank Quisinsky

Back to Hannibal. On the last weekend I followed the CCT-12 tournament. With a normally hardware the results of Hannibal are very impressive. Do you were quite satisfied with the results of Hannibal?

Edsel Apostol
I am contented with the results considering that we are only running on single processor. Sam is the one very satisfied. He is the operator also so I can only imagine how tense/excited he is every game. On our blitz tests Hannibal is a little bit worse than Spark and Thinker, that is on single core. Our excellent opening book and a longer time control I think helped Hannibal. The 64 bit platform Hannibal was running has helped also. Twisted Logic/Hannibal is performing around 35 to 50 elo better if running on 64 bit. That loss against Scorpio was devastating for me. I was hoping to improve our score for the last round for us to get in the top 5.

Hannibal - Scorpio, 0:1
Download all 16 CCT-12-Hannibal games


After move 19. ... 0-0

Sam Hamilton:
I am not sure I like the position for white. Very complicated and hard for a human to judge though.


After move 24. ... Bxc8

Sam Hamilton:
I am not sure I approve of whites last series of moves. The extra piece is better in this position because whites queenside passed pawns are not mobile.


After move 35. c4

Sam Hamilton:
35. Re1 maybe keeps white in the game ... but even where blacks more advanced pawns escorted by the two pieces ensure black has the better chances.


After move 40. Rh1

Sam Hamilton:
A shocking waste of time. 40. Re1 looks necessary, but still probably loses.
40. ... g4 clearly lost now.

Grafic created with ChessBase 10.


Frank Quisinsky

How many ELO points won the actual development version of Hannibal comparing to the latest available Twisted Logic 20103101x version?

Edsel Apostol
My estimate is at least 50 elo. In a direct match up, the latest Hannibal will surely crush that version due to superior search and endgame knowledge. The pruning in the 20103101x version is somewhat experimental. It is better tactically (based on solving test suites) than my old pruning method that was used in Hannibal but it is not that strong in real games. The parameter for reduction is also not optimal. I've just released it as I've agreed with Sam to just work with Hannibal in preparation to CCT. We are actually having some last minute bugfixes and testing to Hannibal before CCT starts.


Frank Quisinsky

Very interesting are the CCT-12 results against Crafty. Crafty played on clearly stronger hardware. Which game of CCT-12 does you like and which one you dislike? Could you give me short comments to CCT-12 games?

Edsel Apostol
I have only watched a few games live. My favorite game is the blitz game against Crafty. Hannibal was simply dominating in that game. Maybe we are just lucky to have a position at the start that Hannibal is good at. The lost game against Scorpio in the last round is the one that has the biggest impact on me. I think our engine miscalculated some material imbalance or just overvalued passed pawns that are immobile. We have lost against Spark due to time forfeit but we are having positive eval when we played out the game. It was not finished. Sam thinks that only Komodo outperforms us that is also using a single core. We have a good position out of the book in most of the games. For that we thanked Audy for providing the book. A good book helps a lot against stronger opponents.

CCT-12, Blitz
Hannibal - Crafty, 1:0
Download all 16 CCT-12-Hannibal games

[Event "ICS rated blitz match"]
[Site ""]
[Date "2010.02.21"]
[Round "-"]
[White "Hannibal"]
[Black "crafty"]
[Result "1-0"]
[WhiteElo "2504"]
[BlackElo "2518"]
[TimeControl "300+3"]
[Annotator "17. +0.21"]

1. e4 e5 2. Nf3 Nc6 3. Bb5 a6 4. Ba4 Nf6 5. O-O Be7 6. Re1 b5 7. Bb3 d6 8. c3 O-O 9. h3 Na5 10. Bc2 c5 11. d4 Qc7 12. Nbd2 cxd4 13. cxd4 Nc6 14. a3 Bd7 15. d5 Na5 16. Nf1 Rfc8 17. Bd3 {+0.21/18 20} Bd8 18. Ng3 {+0.18/16 13} Qa7 19. Re2 {+0.20/17 31} Rc7 20. Be3 {+0.35/17 12} Qb7 21. Bd2 {+0.48/19} Qb6 22. b3 {+0.48/17 11} Rac8 23. Be3 {+0.70/18 11} Qb8 24. Rb2 {+0.68/18 11} Kh8 25. Rbb1 {+0.75/18 21} Qb7 26. Bd2 {+0.93/17 10} Qb6 27. Qf1 {+1.03/18 17} Ra8 28. Qe1 {+0.98/19 0.1} Rcc8 29. a4 {+0.98/18 0.1} Nb7 30. a5 {+1.24/18 10} Qa7 31. b4 {+1.16/18 9} Rab8 32. Rd1 {+1.10/18 9} Qa8 33. Be3 {+1.10/19} Be7 34. Bb6 {+1.15/18 14} Bd8 35. Qe3 {+1.19/18 17} Bxb6 36. axb6 {+1.54/18 8} Nd8 37. Nh4 {+1.36/18 8} Qb7 38. Ngf5 {+1.12/18 8} Ne8 39. Ne7 {+1.76/17 8} Bg4 40. Nxc8 {+1.70/19 8} Bxd1 41. Na7 {+1.83/20 7} Ba4 42. Rc1 {+2.19/17 4} Ra8 43. Be2 {+2.34/18 7} Qe7 44. Nf5 {+2.32/18} Qf8 45. g4 {+2.30/18} g6 46. Nh6 {+2.28/17 0.3} Kg7 47. h4 {+2.47/16 9} f6 48. h5 {+3.09/17 8} Nb7 49. hxg6 {+3.32/18 9} hxg6 50. Kg2 {+3.97/18 0.1} Qh8 51. Rh1 {+3.56/18 0.1} Kf8 52. g5 {+3.64/19 0.1} Qg7 53. Nc6 {+3.84/18} Bc2 54. Rc1 {+4.36/16 5} Ba4 55. f4 {+5.43/17} exf4 56. Qxf4 {+5.83/16} Bc2 57. Rxc2 {+9.19/14 2.8} Nd8 58. Bg4 {+9.65/13 2.5} a5 59. bxa5 {+12.91/15} b4 60. Rf2 {+15.62/11 2.5} Qh7 61. gxf6 {+18.72/11} {crafty resigns} 1-0


Frank Quisinsky

I am collecting playing style descriptions of the TOP-20 programs and the attached statements of their programmers. It's very informative to have such descriptions. Could you write a little bit about Twisted Logic strengths and weaknesses?

Edsel Apostol
Twisted Logic has a non-conventional pruning method (I have not found this implemented on any open source engines yet) that works well in games but very weak in tactics especially the obscure lines. This leads to a strategic playing style that has a tendency to miss deep tactics. It's more humanlike that way but it's sometimes frustrating that it can't find the best tactical shot in a position no matter how much time it spends on thinking. One of Twisted Logic's long time beta tester (Tobias Lagemann, Germany) describes its playing style as that of an anaconda. It simply strangles the opponent slowly until it collapses. The major evaluation criteria being calculated in Twisted Logic are Mobility, Pawn Structure, King Safety and Passed Pawns. There is almost zero endgame knowledge (contrary to Hannibal that has a much much better endgame knowledge courtesy of Sam). The entire Twisted Logic eval is only 600 lines long including the 100 lines of constant declarations of weights. It doesn't mean though that it is lacking in knowledge. I just tried to implement things in the shortest and most simple way.


Frank Quisinsky

What's your opinion about free sources and clones? Today we can find a lot of clone-code opinions in chess fora. Do you follow such discussions?

Edsel Apostol
I've been reading about those issues since the Strelka days. The problem I think is that most of those that participates in the discussions have no idea themselves about the technical side of the issue. This only muddle the issue. Add to that the people with biases and various interests. It's a mess. I tried to stay away from those topics and focus only on improving my engine. I have nothing against open source engines. I have learned computer chess programming through reading source code of open source engines. Though I would prefer strong open source engines to be closed source. This way the authors of weaker programs would innovate on new ideas instead of using those that they can find in the open source engines. Actually there are only a few programmers who I think benefits from strong open source engines, those who are clever enough to understand the ideas implemented and adapt it successfully to its own engine, and the commercial programmers. My opinion about the Ippo/Robbo/Ivanhoe family is that it is not an exact clone (exact clone = same program output). I would agree though that it uses a lot of ideas from Rybka and may have improved upon them. The question now is if it's legal/moral to use those ideas from a closed source Rybka. The dilemma of this on the computer chess programmers is that one can choose not to use the ideas from there and be left behind or swallow one's pride and use it to keep up with the others that have used the ideas as well.


Frank Quisinsky

How do you and Sam are testing development versions of Hannibal? Very interesting to collect the procedures of the programmers. Please tell us more about it!

Edsel Apostol
We are still in the process of developing a good testing method in Hannibal. In Twisted Logic I used to do my testing on very fast time controls using a set of positions against a set of opponents using a specific time control. Beta testers has helped me a lot in testing and finding the best parameters. I couldn't make TL as strong as it is without their help. Lately I've decided that in order to really determine if some changes in the search helps especially those features that are triggered on higher depths, it is essential to use a time control that could reach those depths. You can't reach them if you are just using 10"+0.1" time control. So most of my tests right now are using 60"+1" time control.


Frank Quisinsky

Do you have interest in writing a chess program for other platforms in the future? Perhaps you have also the intention to program a graphical user interface?

Edsel Apostol
I think if there is motivation enough for me and time allows and I couldn't make some improvements anymore with my engine then I will give it a try.


Frank Quisinsky

What about the testing of Hannibal? I think, many people would like to help you. Do you need any beta testers with strong hardware or for example strong chess players, like GM Larry Kaufmann?

Edsel Apostol
We would surely welcome as a team member someone who observes scientific method in testing, is excellent in statistical data analysis and a strong chess player. The likes of GM Larry Kaufman is a big help in a computer chess programming team.

Have thanks for your time Edsel.
SCHACHWELT wish you and Sam much success with Hannibal in the future.

Copyrights and Sources by & Frank Quisinsky

Further publication of this interview is allowed and wished,
but with the permission of only.
One condition is the complete casting (e.g. imprinted media).

Frank Quisinsky, February 25th, 2010