A good way to learn: Lose a game

In real life, we learn from our mistakes. It’s truth in suicidechess too.

In a suicide game, we often lose on a single move. You need to know which one. Sometime it’s obvious, you can see it in a second after your move, but it’s not the case, you need to know. In regular chess, the one who make the last mistake loss the game, in a suicide game, the one who make the first one usually lost the game.

To spot your mistake, you can use several tools: a opening book, a suicide chess engine or end game table. You can also ask someone to help you, most of suicide player are willing to help / analyze game.

You have spot your mistake, now you can do two things:

  • Just remember it, to not do it again
  • or learn how to win the game if your opponent does this mistake
  • The first one it’s easier, and you can continue playing game. The second one may take a lot more time. Example 1.e3 b5 2.Bxb5 Bb7 is lost for black, learning to not play it as black it’s easy, but learning how to win this as white, it’s very hard : only suicide engine can play it perfectly. So you may ask : »When should I learn to win a lost position? » There’s no perfect answer. Just try, if after a amount of time / asking other suicide player , you don’t see the win, just pass over and go play some game.

    In the last few week, I have learned a lot mostly by losing a lot of games against Nilatac and StayAlive. Against them, you can know right a way when you made a mistake: Nilatac is telling you, and StayAlive start to play very fast.

    Analyze one game can help you more than a hundred games…


    How to win against (part4)

    Today, it’s Nilatac turn.

    Nilatac is a strong suicide chess engine, it’s the big brother of Catnail(cover in part 2).

    I prefer to tell you right now:
    « It’s very tough to beat him, you will need a lot of practice« .

    Nilatac have a big opening book, that you can explore on his website. When I mean big, I mean more than 4 millions different lines. Just to compare Sjeng engine have only 25 lines in his default opening book.

    In middle game, Nilatac use several algorithms mainly: Alpha-Beta , Proof-number and Pn^2.
    In endgame, Nilatac have all 4 pieces tablebase.

    So where can you take advantage on Nilatac?

    Probably in middle game. To beat Nilatac, you’ll not just need to play good in middle game. First you’ll need to learn a lot of openings, because Nilatac use a lot of them. I think that Nilatac won most of his game in the opening. Nilatac is fair enough to tell you as soon as you are in a lost positions. So you’ll see a lot of « I got lucky« . If you survive after the opening, congrats! Now the important part of the game is coming. As soon the game « quit » the nilatac opening book, you must do the best move, but I know it’s hard to know which one is the best.

    Some rules that you must follow:

  • Do not engage any Queen race. With the proof-number search algorithm, it’s sure that Nilatac will win.
  • Do not sacrifice your piece too quickly. This a general rule for any suicide game.
  • Push your pawn forward. Chess engine have bit difficulty to plan all promotion, but do it safely.
  • Take your time. You will probably loss in the next few move, so think carefully.
  • Avoid the endgame as long you can. I don’t know any human that remember all endgame positions with 4 pieces, but Nilatac does.
  • Even with those tips, you can’t manage to beat him? It’s normal, Nilatac have a higher ELO than any human on FICS. I suggest to play a lot against him in rated or unrated game, you’ll learn a lot. It may be take more than 250 games before a single win. To beat any high computer, I suggest longer time control, even if Nilatac propose only 3 0 games, you can challenge him with a longer time control, to give you time to think about your move.

    Java or: How I learned to stop worrying and love the code

    Any fool can write code that a computer can understand. Good programmers write code that humans can understand.

    -Martin Fowler

    In college I learn Java, I like the idea of « code once , run everywhere ». After college when I start to program in Java some personal project, I knew that my code was awful / smelly. Bad design, not optimize, near zero comments, and with a lot of duplicate code. My first thought was who care, nobody else will see my code. One big problem, my code base start to grow larger and larger, so a lot of time, I screw up my own productivity because bad design.

    I started to look online to learn good practice, started to code in respect Sun Java convention (about indentation, method/class naming, etc). I did a lot of refactoring, creating new class, to improving general quality of my code. But at that time I was not yet fully proud of my code. In some open-source API ( like Trident and ICTK), the code is very clear, it wasn’t always the case in my code.

    Nobody can write a « perfect » code, but all programmers can at least try to write better code. In enterprise environment, a good way to increase code quality can be done with code review session and with pair programming. In a solo programming environment like I do for SuicideChess project is quite more difficult.

    How to increase code quality in a solo project?

    Here, few idea:
    First, release your code as open-source, even if nobody look at your code, knowing that people can do it, you’ll try write better code.

    Second, be sure that your code contain any error or warning message.

    Third, find some tools to help you. I’m using Eclipse to develop all java code of SuicideChess. With Eclipse ( and probably most of IDE ), you can add plug-in. Some plug-in can give you a direct feedback on your code quality. Just to name few that I use : FindBug , Eclipse Metric and UCDetector.

    Fourth, read a lot about it. There’s many website about best-practice , design, etc.

    To push this even farther, I will release soon, a web-page to see the progress, on monthly base. Why may you ask? Because when you solo-program, sometimes it’s hard to motivate itself, so by publishing these kind of info, I’ll be able to see progress over time.

    In computer science, you can always learn new things, and there’s always some limit to break. So let’s go push farther !
    When I start the opening book , my first goal was to create a good opening book for nessegrev. I was dreaming about the day that the opening book will reach the size of the nilatac’s one. Now I look at it, and I said : » wow in February, the opening book will be 10 time bigger than nilatac’s one ».

    Few month ago, I read a good article : Party of one: Surviving the solo open source project. This article was the reason I started this blog.

    when I started to code SuicideChess project, I didn’t have a lot of experience, so I code a lot before think about design. Adding new features was fun, so at the time, I was push debugging time to later. Humm.. a very bad idea. That’s why recently (since about 2 month) I start to refactoring my code, debug, rename Methods/Class, etc. With all those refactoring, the number of line of code (LOC) start to drop. This can seem stranger for new programmer, but senior programmer know this: Less LOC = less bug. To quote Richard Pattis:
    « When debugging, novices insert corrective code; experts remove defective code. »

    That explain why you see less new features recently, even I still work a lot on this project. I know that I still have a lot to do, but working with a better code will make my life easier

    I’m not a java expert, at least I don’t think so, when I compare myself to others Java Blogger like ( Kirillcool and Jonathan Giles). I wish I could blog like them, but I know that new programmer still need a lot, because in school, they never learn know about code quality, debug, etc.
    Telling them my experience, I hope that they’ll learn something.

    I most tell that one of the hardest part of solo-programming a project is to have enough motivation. Just a quick look on Sourceforge or on Kenai, you’ll see a lot of abandoned (dead) project. That’s kind of sad, because many of them are great idea. There’s many things that will de-motivated any solo-programmer: Lack of user feedback, debugging to do, lack of time, and a lot of learning to do. If you can manage those facts, and still able to continue your project: good and go ahead!

    Programming is a art, maybe a technical art, but you must like your code! My code isn’t perfect but I love it

    A major line have been prove

    This morning, a major line have been prove :
    the 1.e3 c6

    Since few week I was working on it, and yesterday I was working hard on it, it was near to be complete. I wanted to see it prove, but when you fall asleep in front of your computer it’s time to go to sleep. And when I wake up, the line was complete.

    This line is the biggest line proved as Lost in the book of Nilatac

    I’ll like to thanks again the Nilatac opening book, the wizard engine that help for some position, and all Azor owners.

    A special mention to Yannos, since I think that he’s the one who complete the last part of this line!

    34 millions mark have been reach !

    Tonight, we have reach the mark of 34 millions positions have been calculated in the opening book.

    Even if the opening book is the largest, we still have some lines that they are known as lost that they are incomplete in our book.

    Amount all of them there’s 3 major one :
    1.e3 c6 proved lost by Nilatac program by Catalin Francu and by the engine ascp program by Angrim.
    1.h3 proved lost by ascp .
    1.b4 proved lost by ascp too.

    For the last two, the proof isn’t available on the net, so it’ll be bit harder to check / complete it.

    I still working on the first one, I hope to complete it soon.

    Thanks to anyone who run or ran an Azor. To give you a idea, the mark that we have reach, on a single computer would take about 5 years to reach.