Create new engines by mixing existing ones

Probably you have heard some discussions that engine A is good at opening but not at other game periods when B is good at middle and C is good at endgames. Sometimes people wish to use all those engines to play in different periods: A plays for opening, B plays for middle and C plays for endgames. Some people wonder how good if we run some engines together and let them “vote” for the best moves (moves which most engines agree). Someone is curious about possibleness and results to mix between opposite-style engines such as aggressive and defensive, quick/fast, NNUE/GPU… ones. By mixing engines people hope they can take all advantages from different engines and/or simply they want some differences and changes.

In the real-life, we may see some kinds of engine mix: 1) One of my friends usually participates in some top engine tournaments using their own home computers. Instead of taking an engine to play automatically whole games (take whole hardware), he runs some engines at the same time (share his hardware) then verifies all moves and takes a move to make manually. He is usually in the top groups even his computer is much weaker than other participants. 2) We may know that Stockfish recently runs somewhat like two versions of Stockfish together: one with the classical and one with the new NNUE evaluation and it automatically switches between them when scoring in different ranges.

Creating a new engine by mixing/combining several engines is a new feature of Banksia GUI which we have never seen on other software. Instead of using only one engine now, the best moves may be selected from different engines depending on the selection method. BSG has installed already several methods such as totally random, sequence, most voted, lest voted, most nodes, score ranges, piece count ranges, move order ranges…

Frankly speaking, we haven’t known yet if the new feature could create some super combinations which are better than any individual engines. (I created some tools but didn’t use them seriously yet. Furthermore, finding a good combination of engines may not easy, a kind of art, and take time.) However, I guarantee it can bring some changes, new playing styles, including craziness 😀

I just imagine some useful uses, here is listed a few:

  • Create some “new” engines just for fun, especially for testers/enthusiasts who usually play with, have a deep understanding of multi engines, and want to mix some good ones together to create a totally new engine. Perhaps mixing is the only way to create a new engine without any coding.
  • Answer many curious/fun questions about combinations of engines
  • Help developers to find if their engines are weak/strong in some periods or conditions. For example, someone maybe not sure how good his engine to play endgame and wonder if he should invest time and labor to improve the middle game evaluation or endgame one. He may create a new combination between his engine and another one that is good at endgame and let that engine play endgame and his one to play the rest. Now he can test to find the answer to his question

Some notes about techniques:

  • ranges are half-open. It means for a range a, b, denoted as [ab), checking condition is a <= x < b. Thus, to set the range for an engine to play opening until two pieces captured, we use the range 30, 33, not 30, 32
  • for the current version/implement, regardless of the selection method, all engines in a mix may compute concurrently. Thus they take resources (computing power, memory) as multi engines but not only one
  • BSG will wait for all engines in the mix to complete their computing before selecting the best move from their results. That means each time the move time is as long as the longest one
  • To select the best move, BSG verifies the conditions of the selection method, from the first to the last engine, if any engine satisfies the condition, BSG stops immediately and takes the result (the best move) from that engine. If all fails, BSG takes the result of the first engine. Users should take care about overlap ranges/ambiguities when setting selection conditions
  • A mix of engines can be used as a normal engine anywhere: in normal games (human vs engine, engine vs engine), in tournaments, Lichess bots, network games…