HUGE ANNOUNCEMENT -- "LAS TORRES" NEW ENGINE THAT OBLITERATES STOCKFISH

Discussion of chess software programming and technical issues.

Moderator: Ras

dangi12012
Posts: 1062
Joined: Tue Apr 28, 2020 10:03 pm
Full name: Daniel Infuehr

Re: HUGE ANNOUNCEMENT -- "LAS TORRES" NEW ENGINE THAT OBLITERATES STOCKFISH

Post by dangi12012 »

tcusr wrote: Sun Oct 03, 2021 10:59 pm you still didn't answer the question, if this everything is used as a template parameter how is it possible to pass the fen string as a command line argument?
i don't understand your example, i too use a special function for castling (by passing the king square, rook square and color as template arguments) but i still need to do a runtime check of the castling rights
const bool WhiteMove;
const bool HasEPPawn;

const bool WCastleL;
const bool WCastleR;

const bool BCastleL;
const bool BCastleR;

Since you seem to be interested I will PM you URL for the codeproject article once its out.
These fields live outside of the runtime. When you enter FEN - you have to a lookup which of the 64 possible template configurations to use.

For example a pawn push only affects the HasEPPPawn flag. The others are copied. Thats the beauty. You can "call" a constexpr function inside a template argument:

Code: Select all

constexpr BoardStatus PawnPush() const {
        return BoardStatus(!WhiteMove, true, WCastleL, WCastleR, BCastleL, BCastleR);
    }
Like that: Move<status.PawnPush()>(brd);
Notice how that constexpr is used as a template argument which returns the boardstatus. itself. Since you always call one of the 64 configurations the compiler has everything it needs to know :)

This is a compiletime statemachine which makes it so that if you move the king - no castling is possible anymore - the C++ code does not even contain an if for it for the calls after that. It is constexpr pruned away.
The lookup if (Color == White) Pawn >> 8 else Pawn << 8 -> becomes a simple shift without the condition etc.
This is applicable for CUDA too since templates are just part of the function signature and nothing more!

This is not new in hight perf c++ - but i didnt see it used much in chess. Only for color so far.
Worlds-fastest-Bitboard-Chess-Movegenerator
Daniel Inführ - Software Developer
Mergi
Posts: 127
Joined: Sat Aug 21, 2021 9:55 pm
Full name: Jen

Re: HUGE ANNOUNCEMENT -- "LAS TORRES" NEW ENGINE THAT OBLITERATES STOCKFISH

Post by Mergi »

dangi12012 wrote: Sun Oct 03, 2021 11:35 pm This is not new in hight perf c++ - but i didnt see it used much in chess. Only for color so far.
The most popular engine of them all, Stockfish, uses templates extensively for pawn pushes, and I'd imagine most c++ engines do the same.

https://github.com/official-stockfish/S ... ard.h#L162

https://github.com/official-stockfish/S ... en.cpp#L45
dangi12012
Posts: 1062
Joined: Tue Apr 28, 2020 10:03 pm
Full name: Daniel Infuehr

Re: HUGE ANNOUNCEMENT -- "LAS TORRES" NEW ENGINE THAT OBLITERATES STOCKFISH

Post by dangi12012 »

Mergi wrote: Mon Oct 04, 2021 12:26 am
dangi12012 wrote: Sun Oct 03, 2021 11:35 pm This is not new in hight perf c++ - but i didnt see it used much in chess. Only for color so far.
The most popular engine of them all, Stockfish, uses templates extensively for pawn pushes, and I'd imagine most c++ engines do the same.

https://github.com/official-stockfish/S ... ard.h#L162

https://github.com/official-stockfish/S ... en.cpp#L45
Exactly - thats what i mean. Most Movegens: template<Color Us, GenType Type>
Mine: Color + Enpassant + Castling Status.

My movegen isnt faster by copying what everyone else is doing... Also that alone is only one of 12 or so things that are done differently to everyone else's code to achieve 2 billion moves/s per thread. Multithreading is also coming. 2 * 16 = .... This will be so great! Hashtable is also missing for now.
Worlds-fastest-Bitboard-Chess-Movegenerator
Daniel Inführ - Software Developer
klx
Posts: 179
Joined: Tue Jun 15, 2021 8:11 pm
Full name: Emanuel Torres

Re: HUGE ANNOUNCEMENT -- "LAS TORRES" NEW ENGINE THAT OBLITERATES STOCKFISH

Post by klx »

Alright, I'm ready to share my invention now. Note that this is released under GPLv3 license! Meaning I retain ownership if you end up implementing this method.

So, without further ado, here it is.

Idea
Let's say that we are supposed to play a 3 minute game against Stockfish. Before the game starts, we start up Stockfish (same version) locally and configure it for 3 minutes. Then for each move that it produces, we start a separate Stockfish search for a much longer period of time, say 1 minute / move, and record the response. We make sure that the longer-thinking version wins. (If not, we just repeat with a longer think time.) Then, during the actual game, we can just play these prepared responses instantly, since we know what the moves will be. BOOM! We just beat Stockfish! We can apply this same idea to any engine that we can access to play against. There you have it. Amazingly simple. Amazingly clever. It is... ¡LAS TORRES!

Emanuelific Convergence
One crux is if there is some non-determinism in the engine. Let's say that the think time is 10 seconds, and depending on the speed of the host system, it may produce either move A or B. If this only occurs once, it's not a big deal, since we can evaluate both paths, but over the course of the game this can lead to a combinatorial explosion. Las Torres deals with this in a truly ingenious way, called Emanuelific Convergence (yeah, add that word to your dictionary). In short, when it detects that there are two possible opponent moves, it will produce response moves that both 1) seek to converge the game tree and 2) still guarantee a win. While it may not always be possible to converge the game tree to a single branch, it will achieve the goal of avoiding combinatorial explosion. In practice, up to a few hundred branches have been observed. This step can be quite time consuming, but is only run once, and is highly parallalizable.

Undefeatability
One of the most unexpected properties of Las Torres is that its technique can not be used against itself, since that would lead to the engine forwarding to itself over and over in infinite recursion which will crash the computer. The implication of this is quite remarkable -- it means that Las Torres is undefeatable.

It is of course trivial (and recommended) to prepare Las Torres against multiple engines, versions, and time settings at the same time. So in a tournament against multiple opponents, each and every one will be conquered with ease.

Cheating?
There may be those that consider this method "cheating". That is a completely understandable reaction; folks who have invested years into building an engine might think it unfair that I produce a superior product in the span of a few days. However, while unconventional, it can be understood that this method is not "cheating" in any way. In fact, all major chess players prepare this way against their opponents before big games.

Conclusion
I have yet to decide what I'll do with Las Torres. I am new to chess and chess programming, so I don't know what the process is, but it'd be fun to submit it to some tournaments and see what Elo it'd end up with. Can it break the 4000 Elo barrier? Presumably! Until then, feel free to share your thoughts and congratulatory notes in this thread.
[Moderation warning] This signature violated the rule against commercial exhortations.
amanjpro
Posts: 883
Joined: Sat Mar 13, 2021 1:47 am
Full name: Amanj Sherwany

Re: HUGE ANNOUNCEMENT -- "LAS TORRES" NEW ENGINE THAT OBLITERATES STOCKFISH

Post by amanjpro »

klx wrote: Mon Oct 04, 2021 2:37 am Alright, I'm ready to share my invention now. Note that this is released under GPLv3 license! Meaning I retain ownership if you end up implementing this method.

So, without further ado, here it is.

Idea
Let's say that we are supposed to play a 3 minute game against Stockfish. Before the game starts, we start up Stockfish (same version) locally and configure it for 3 minutes. Then for each move that it produces, we start a separate Stockfish search for a much longer period of time, say 1 minute / move, and record the response. We make sure that the longer-thinking version wins. (If not, we just repeat with a longer think time.) Then, during the actual game, we can just play these prepared responses instantly, since we know what the moves will be. BOOM! We just beat Stockfish! We can apply this same idea to any engine that we can access to play against. There you have it. Amazingly simple. Amazingly clever. It is... ¡LAS TORRES!

Emanuelific Convergence
One crux is if there is some non-determinism in the engine. Let's say that the think time is 10 seconds, and depending on the speed of the host system, it may produce either move A or B. If this only occurs once, it's not a big deal, since we can evaluate both paths, but over the course of the game this can lead to a combinatorial explosion. Las Torres deals with this in a truly ingenious way, called Emanuelific Convergence (yeah, add that word to your dictionary). In short, when it detects that there are two possible opponent moves, it will produce response moves that both 1) seek to converge the game tree and 2) still guarantee a win. While it may not always be possible to converge the game tree to a single branch, it will achieve the goal of avoiding combinatorial explosion. In practice, up to a few hundred branches have been observed. This step can be quite time consuming, but is only run once, and is highly parallalizable.

Undefeatability
One of the most unexpected properties of Las Torres is that its technique can not be used against itself, since that would lead to the engine forwarding to itself over and over in infinite recursion which will crash the computer. The implication of this is quite remarkable -- it means that Las Torres is undefeatable.

It is of course trivial (and recommended) to prepare Las Torres against multiple engines, versions, and time settings at the same time. So in a tournament against multiple opponents, each and every one will be conquered with ease.

Cheating?
There may be those that consider this method "cheating". That is a completely understandable reaction; folks who have invested years into building an engine might think it unfair that I produce a superior product in the span of a few days. However, while unconventional, it can be understood that this method is not "cheating" in any way. In fact, all major chess players prepare this way against their opponents before big games.

Conclusion
I have yet to decide what I'll do with Las Torres. I am new to chess and chess programming, so I don't know what the process is, but it'd be fun to submit it to some tournaments and see what Elo it'd end up with. Can it break the 4000 Elo barrier? Presumably! Until then, feel free to share your thoughts and congratulatory notes in this thread.
Disappointed where is emanNNUEl?
gaard
Posts: 463
Joined: Mon Jun 07, 2010 3:13 am
Location: Holland, MI
Full name: Martin W

Re: HUGE ANNOUNCEMENT -- "LAS TORRES" NEW ENGINE THAT OBLITERATES STOCKFISH

Post by gaard »

klx wrote: Mon Oct 04, 2021 2:37 am Alright, I'm ready to share my invention now. Note that this is released under GPLv3 license! Meaning I retain ownership if you end up implementing this method.

So, without further ado, here it is.

Idea
Let's say that we are supposed to play a 3 minute game against Stockfish. Before the game starts, we start up Stockfish (same version) locally and configure it for 3 minutes. Then for each move that it produces, we start a separate Stockfish search for a much longer period of time, say 1 minute / move, and record the response. We make sure that the longer-thinking version wins. (If not, we just repeat with a longer think time.) Then, during the actual game, we can just play these prepared responses instantly, since we know what the moves will be. BOOM! We just beat Stockfish! We can apply this same idea to any engine that we can access to play against. There you have it. Amazingly simple. Amazingly clever. It is... ¡LAS TORRES!

Emanuelific Convergence
One crux is if there is some non-determinism in the engine. Let's say that the think time is 10 seconds, and depending on the speed of the host system, it may produce either move A or B. If this only occurs once, it's not a big deal, since we can evaluate both paths, but over the course of the game this can lead to a combinatorial explosion. Las Torres deals with this in a truly ingenious way, called Emanuelific Convergence (yeah, add that word to your dictionary). In short, when it detects that there are two possible opponent moves, it will produce response moves that both 1) seek to converge the game tree and 2) still guarantee a win. While it may not always be possible to converge the game tree to a single branch, it will achieve the goal of avoiding combinatorial explosion. In practice, up to a few hundred branches have been observed. This step can be quite time consuming, but is only run once, and is highly parallalizable.

Undefeatability
One of the most unexpected properties of Las Torres is that its technique can not be used against itself, since that would lead to the engine forwarding to itself over and over in infinite recursion which will crash the computer. The implication of this is quite remarkable -- it means that Las Torres is undefeatable.

It is of course trivial (and recommended) to prepare Las Torres against multiple engines, versions, and time settings at the same time. So in a tournament against multiple opponents, each and every one will be conquered with ease.

Cheating?
There may be those that consider this method "cheating". That is a completely understandable reaction; folks who have invested years into building an engine might think it unfair that I produce a superior product in the span of a few days. However, while unconventional, it can be understood that this method is not "cheating" in any way. In fact, all major chess players prepare this way against their opponents before big games.

Conclusion
I have yet to decide what I'll do with Las Torres. I am new to chess and chess programming, so I don't know what the process is, but it'd be fun to submit it to some tournaments and see what Elo it'd end up with. Can it break the 4000 Elo barrier? Presumably! Until then, feel free to share your thoughts and congratulatory notes in this thread.
What you're describing is basically an opening book. I wouldn't call it cheating, but I would call it woefully inefficient. It definitely doesn't qualify as a "new engine", more like a low effort troll.
Uri Blass
Posts: 10905
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: HUGE ANNOUNCEMENT -- "LAS TORRES" NEW ENGINE THAT OBLITERATES STOCKFISH

Post by Uri Blass »

klx wrote: Mon Oct 04, 2021 2:37 am Alright, I'm ready to share my invention now. Note that this is released under GPLv3 license! Meaning I retain ownership if you end up implementing this method.

So, without further ado, here it is.

Idea
Let's say that we are supposed to play a 3 minute game against Stockfish. Before the game starts, we start up Stockfish (same version) locally and configure it for 3 minutes. Then for each move that it produces, we start a separate Stockfish search for a much longer period of time, say 1 minute / move, and record the response. We make sure that the longer-thinking version wins. (If not, we just repeat with a longer think time.) Then, during the actual game, we can just play these prepared responses instantly, since we know what the moves will be. BOOM! We just beat Stockfish! We can apply this same idea to any engine that we can access to play against. There you have it. Amazingly simple. Amazingly clever. It is... ¡LAS TORRES!

Emanuelific Convergence
One crux is if there is some non-determinism in the engine. Let's say that the think time is 10 seconds, and depending on the speed of the host system, it may produce either move A or B. If this only occurs once, it's not a big deal, since we can evaluate both paths, but over the course of the game this can lead to a combinatorial explosion. Las Torres deals with this in a truly ingenious way, called Emanuelific Convergence (yeah, add that word to your dictionary). In short, when it detects that there are two possible opponent moves, it will produce response moves that both 1) seek to converge the game tree and 2) still guarantee a win. While it may not always be possible to converge the game tree to a single branch, it will achieve the goal of avoiding combinatorial explosion. In practice, up to a few hundred branches have been observed. This step can be quite time consuming, but is only run once, and is highly parallalizable.

Undefeatability
One of the most unexpected properties of Las Torres is that its technique can not be used against itself, since that would lead to the engine forwarding to itself over and over in infinite recursion which will crash the computer. The implication of this is quite remarkable -- it means that Las Torres is undefeatable.

It is of course trivial (and recommended) to prepare Las Torres against multiple engines, versions, and time settings at the same time. So in a tournament against multiple opponents, each and every one will be conquered with ease.

Cheating?
There may be those that consider this method "cheating". That is a completely understandable reaction; folks who have invested years into building an engine might think it unfair that I produce a superior product in the span of a few days. However, while unconventional, it can be understood that this method is not "cheating" in any way. In fact, all major chess players prepare this way against their opponents before big games.

Conclusion
I have yet to decide what I'll do with Las Torres. I am new to chess and chess programming, so I don't know what the process is, but it'd be fun to submit it to some tournaments and see what Elo it'd end up with. Can it break the 4000 Elo barrier? Presumably! Until then, feel free to share your thoughts and congratulatory notes in this thread.
It is practically impossible because there are too many lines and engines to prepare against them.

Engines with many cores are not deterministic so even preparing for one engine with no book is going to take you a lot of time and in games engines comes with a book that you do not know.

The system is also practically impossible against stockfish at long time control because I believe that you will get today usually draws even if you play 3+3 against 300+300 time control.

I do not claim that stockfish is perfect but I believe that it has not the knowledge to beat itself even at infinite time control and does not choose lines that cause stockfish at 3+3 time control to blunder.
amanjpro
Posts: 883
Joined: Sat Mar 13, 2021 1:47 am
Full name: Amanj Sherwany

Re: HUGE ANNOUNCEMENT -- "LAS TORRES" NEW ENGINE THAT OBLITERATES STOCKFISH

Post by amanjpro »

@Klx, I tried running your engine, it segfaulted :( said no emaNNUEl for you

could you season it for me :P
klx
Posts: 179
Joined: Tue Jun 15, 2021 8:11 pm
Full name: Emanuel Torres

Re: HUGE ANNOUNCEMENT -- "LAS TORRES" NEW ENGINE THAT OBLITERATES STOCKFISH

Post by klx »

amanjpro wrote: Mon Oct 04, 2021 3:54 am @Klx, I tried running your engine, it segfaulted :( said no emaNNUEl for you
I have never given any thought to evaluation functions nor read up on what NNUE is (apart from somehow related to evaluation), but if I were I most certainly would come up with something better. That's how it usually works. And EmaNNUEl is a great name for that.
[Moderation warning] This signature violated the rule against commercial exhortations.
klx
Posts: 179
Joined: Tue Jun 15, 2021 8:11 pm
Full name: Emanuel Torres

Re: HUGE ANNOUNCEMENT -- "LAS TORRES" NEW ENGINE THAT OBLITERATES STOCKFISH

Post by klx »

Uri Blass wrote: Mon Oct 04, 2021 3:53 am It is practically impossible because there are too many lines and engines to prepare against them.

Engines with many cores are not deterministic so even preparing for one engine with no book is going to take you a lot of time and in games engines comes with a book that you do not know.

The system is also practically impossible against stockfish at long time control because I believe that you will get today usually draws even if you play 3+3 against 300+300 time control.

I do not claim that stockfish is perfect but I believe that it has not the knowledge to beat itself even at infinite time control and does not choose lines that cause stockfish at 3+3 time control to blunder.
Well aren't you the pessimist.

Are you saying that when Stockfish plays a tournament, they will use a "secret" opening book not available on Github? Stockfish claims to be open source.

Las Torres should still be able to handle this though, for example playing an unexpected move early on would throw a wrench into that opening book, after which Las Torres can take over and dominate.

Also, just making sure you read the Emanuelific part? It ensures there aren't too many lines.
[Moderation warning] This signature violated the rule against commercial exhortations.