Upgrade to Chess.com Premium!

Building ones own chess engine


  • 10 months ago · Quote · #1

    rich

    How do you go about making your own chess engine/programme? I've heard it's a difficult process. But there's this guy who I know who has made his own chess engine he calls it "Deep Yellow". It's playing strength is about 2700 elo.

  • 10 months ago · Quote · #2

    Skwerly

    with zero programming behind me it'd be all but impossible.  however, if you are already decent in C++ or something i say go for it.  i wouldn't know the first thing.

  • 10 months ago · Quote · #3

    HGMuller

    Making a Chess engine is not very difficult; a program of ~100 lines can already play decent Chess (micro-Max, Toledo nanoChess). In another thread on this forum someone shows off a Chess program he wrote in 48 hours.

    But making an engine playing at 2700 Elo is quite another matter. It requires experience, and several tries. I don't want to make any direct accusations against "Deep Yellow", since I had never heard of it at all, but virtually all engines newly 'made' in that strength range are slightly modified clones of other engines.

    It goes about like this: you download the source code of one of the famous open-source engines, such as Toga, Strelka, Robbolito, Firebird. Now you take NotePad, open the file that contains the evaluation function, and change the value of a Bishop from 325 to 327 (centi-Pawn), or something insignificant like that. And you open the file that contains the part that prints the name, and change that name to "New SuperDuper Engine", or whatever. Then you recompile the stuff, and tada!: with less than 10 minutes work you are now the proud author of an entirely new top engine, second to perhaps only one or two...

  • 10 months ago · Quote · #4

    HGMuller

    Well, that was just an example. All these Chess programs have a lot of evaluation parameters, like the piece values, and bonuses for Bishop pairs, passed pawns, rooks on open files, semi-open  files, the 7th rank. And penalties for doubled pawns, isolated pawns, holes in the pawn shield in front of your king. To show an example, this is part of the Fruit 2.1 code from the file eval.cpp (copyrighted under the GPL):

    ____________________________

    static const int KnightUnit = 4;
    static const int BishopUnit = 6;
    static const int RookUnit = 7;
    static const int QueenUnit = 13;

    static const int MobMove = 1;
    static const int MobAttack = 1;
    static const int MobDefense = 0;

    static const int KnightMobOpening = 4;
    static const int KnightMobEndgame = 4;
    static const int BishopMobOpening = 5;
    static const int BishopMobEndgame = 5;
    static const int RookMobOpening = 2;
    static const int RookMobEndgame = 4;
    static const int QueenMobOpening = 1;
    static const int QueenMobEndgame = 2;
    static const int KingMobOpening = 0;
    static const int KingMobEndgame = 0;

    static const bool UseOpenFile = true;
    static const int RookSemiOpenFileOpening = 10;
    static const int RookSemiOpenFileEndgame = 10;
    static const int RookOpenFileOpening = 20;
    static const int RookOpenFileEndgame = 20;
    static const int RookSemiKingFileOpening = 10;
    static const int RookKingFileOpening = 20;

    static const bool UseKingAttack = true;
    static const int KingAttackOpening = 20;
    ______________

    You can play a bit with values that you think you understand. Like if you would change RookOpenFileOpening from 20 to 40, you would get an engine that more aggressively tries to put Rooks on open files early in the game (and be correspondingly more afraid for the opponent to do this). Similarly, increasing BishopMobOpening from 5 to 7 would make it try to develop its Bishop better (giving it a larger number of possible moves, i.e. 'mobility').

  • 10 months ago · Quote · #5

    HGMuller

    I see you get the idea! Smile

  • 10 months ago · Quote · #6

    PhilipSaponaro

    Just use some sort of mini-max algorithm. And you could use machine learning, maybe a genetic algorithm or somethin else if you prefer, to learn those paramaters listed above.

    Its not that hard to do, the most work with this is setting up so it can understand all possible legal moves on the board, and pruning so that you can see deeper without dealing with irrelevent moves.

  • 10 months ago · Quote · #7

    HGMuller

    Get what? Source code of top engines? Just Google for Fruit, Toga, Stockfish, Robbolito, Firebird, Ivanhoe + engine + download.

    http://wbec-ridderkerk.nl/ is a website that gives an overview of engines, and where they can be downloaded.


Back to Top

Post your reply: