Live data from Hacker News

A minimax chess engine in regular expressions

nicholas.carlini.com

11–20 of 103 posts

Re: A minimax chess engine in regular expressions

#14

a2a3 gives me illegal move game over. What am I missing here?

Somewhat surprisingly (given the creator's regex chops) capital letters are not accepted. My guess is that your autocorrect changed the move to A2a3.

Bad news if you're almost done with a game and enter a move with the wrong case.

Re: A minimax chess engine in regular expressions

#15

a2a3 gives me illegal move game over. What am I missing here?

Somewhat surprisingly (given the creator's regex chops) capital letters are not accepted. My guess is that your autocorrect changed the move to A2a3. Bad news if you're almost done with a game and enter a move with the wrong case.

I'm on PC (firefox) and can reproduce it, no capital letters in my input

Re: A minimax chess engine in regular expressions

#17
There's a bug somewhere it seems like, as it ends the following game with "Illegal move, you lose", even though it's not an illegal move:

1. e2e4, e7e5 2. d2d4, e5d4 3. d1d4, a7a5 4. g1f3, b7b5 5. b1c3, a5a4 6. c3b5, a4a3 7. b5a3, a8a3 8. b2a3 --> Illegal Move You Lose. Game over.

FEN of game above: 1nbqkbnr/2pp1ppp/8/8/3QP3/P4N2/P1P2PPP/R1B1KB1R b KQk - 0 8

Re: A minimax chess engine in regular expressions

#19

There's a bug somewhere it seems like, as it ends the following game with "Illegal move, you lose", even though it's not an illegal move: 1. e2e4, e7e5 2. d2d4, e5d4 3. d1d4, a7a5 4. g1f3, b7b5 5. b1c3, a5a4 6. c3b5, a4a3 7. b5a3, a8a3 8. b2a3 --> Illegal Move You Lose. Game over. FEN of game above: 1nbqkbnr/2pp1ppp/8/8/3QP3/P4N2/P1P2PPP/R1B1KB1R b KQk - 0 8

Simply using a2a4 as the first move does that too.

Re: A minimax chess engine in regular expressions

#20
post #13

Compare also https://codegolf.stackexchange.com/q/3503/32575

That shouldn't be really surprising, as all divisibility rules are necessarily regular because anything more complex wouldn't be human-executable "rules".

Humans are able to check whether a string of parens, like ()(()()), is matched but finite state machines can't.

In any case, if you know how the regex is constructed, it's not surprising. But I found it fun to actually do the construction, instead of just being theoretically aware of the possibility.

Post reply on HN