The technical write up is worth perusing but I played a game before reading and accidentally found a winning strategy immediately. I'm not sure if this is a result of the 2-ply nature of the engine or if the mentioned deficiencies account for this but the computer did not act to prevent checkmate in 1 (without any intervening check); the game I played was (in algebraic notation): 1. e4 e5 2. kf3 kf6 3. kxe5 kxe4 4. d…
Regex Chess: A 2-ply minimax chess engine in 84,688 regular expressions
31–40 of 56 posts
Re: Regex Chess: A 2-ply minimax chess engine in 84,688 regular expressions
#32Re: Regex Chess: A 2-ply minimax chess engine in 84,688 regular expressions
#33 *Illegal Move*
You Lose.
Game over.
A little disappointed, since it's of course a valid move.Re: Regex Chess: A 2-ply minimax chess engine in 84,688 regular expressions
#34It would be different, if somehow all those 84688 regexes were coded by hand. Then it would be a piece of art. It would be different, if the number of regexes was maybe below 300, and it still plays acceptably. The sheer number of regexes kind of defeats the purpose. At that code size, a much better engine can be written, or other kind of code for an engine be generated. Regexes themselves are not really something we…
Meanwhile, 1K ZX Chess takes fewer bytes of memory than the first four paragraphs from the post.
Re: Regex Chess: A 2-ply minimax chess engine in 84,688 regular expressions
#35It would be different, if somehow all those 84688 regexes were coded by hand. Then it would be a piece of art. It would be different, if the number of regexes was maybe below 300, and it still plays acceptably. The sheer number of regexes kind of defeats the purpose. At that code size, a much better engine can be written, or other kind of code for an engine be generated. Regexes themselves are not really something we…
I wish more submissions began with, “This might be a bit wild, but I wanted to see if it could actually work.”
Re: Regex Chess: A 2-ply minimax chess engine in 84,688 regular expressions
#36It would be different, if somehow all those 84688 regexes were coded by hand. Then it would be a piece of art. It would be different, if the number of regexes was maybe below 300, and it still plays acceptably. The sheer number of regexes kind of defeats the purpose. At that code size, a much better engine can be written, or other kind of code for an engine be generated. Regexes themselves are not really something we…
This is a quintessential, crazy idea that used to be adored on HN. The author, obviously, didn't intend this to be a serious engine. I wish more submissions began with, “This might be a bit wild, but I wanted to see if it could actually work.”
Re: Regex Chess: A 2-ply minimax chess engine in 84,688 regular expressions
#37Earlier quoted context omitted.
Depends on what you mean by that. You can convert every NFA into a DFA. That's a NP complete (IIRC), but running the DFA is O(n). Running the NFA without converting it is also NP complete. One isn't better than the other, but the costs vary for different expressions and usages.
Running NFA is O(nm) not NP.
Re: Regex Chess: A 2-ply minimax chess engine in 84,688 regular expressions
#38Earlier quoted context omitted.
It’s turing complete so you could compile almost any language to regex. You might have to build a vm for some languages, also in regex. The point is, it’s regex all the way down.
Regular expressions are not Turing-complete.
Re: Regex Chess: A 2-ply minimax chess engine in 84,688 regular expressions
#39Earlier quoted context omitted.
This is a quintessential, crazy idea that used to be adored on HN. The author, obviously, didn't intend this to be a serious engine. I wish more submissions began with, “This might be a bit wild, but I wanted to see if it could actually work.”
Out of curiosity, why wouldn't it work?
Some of the best things I've ever created started from, "I wonder what would happen if I tried this crazy approach..."
Re: Regex Chess: A 2-ply minimax chess engine in 84,688 regular expressions
#40Not sure it's completely accurate. I played a standard queen's gambit accepted, took black's queen which it immediately blundered, then tried to move my queen from c5 -> e5 and the game ended immediately showing: *Illegal Move* You Lose. Game over. A little disappointed, since it's of course a valid move.