Hacker News new | ask | show | jobs
by gus_massa 164 days ago
Nice! We made some mathematical games for adults, and we also had the problem to make the computar not play optimal.

I guess when I played your game IIRC in a case the computer could have trapped me but it didn't. Perhaps I had an escape route that I didn't see.

(How is the maximal theoretical length of a game?)

My 9 y.o. daughter likes it, but she wants to play as the Kings too.

1 comments

Yup, I'm going to build out the reverse play when I find time in the next few weeks hopefully! I'll try to remember to comment here :)

Quite probably you did just run up against a bug in it! I'd have to see the position though.

Great question on the maximal theoretical length. Being pedantic I'd imagine infinite if I just move a knight back and forth and you move a king back and forth. (Though I disallow repeat moves for interests sake)

I mean the maximal length if both players play perfectly.

If the Kings advance in the 1)"b", 2) "d" or "e", 3) "g" column in a synchronized way, they form an horizontal wall of 3 ranks that will trap the Knight at the bottom of the board. This takes 5 * 3 to go from "7" to "2" plus 1 movements to take the Knight, so in 5 * 3 +1 = 16 they should win, and the maximal amount of movements for the Knight is also 16.

This use a little of hand waving, so I may be missing some corner case or brilliant strategy for the Knight. I also may be missing some obvious strategy for the Kings to win earlier. So add a few question marks here and there in the provious paragraph.

> I'm going to build out the reverse play when I find time in the next few weeks hopefully!

:)

May well have bugs as I just finished it (and really it should be baked into the UI so you can easily reverse)... however... here is the reverse play:

https://minichessgames.com/#/play/kings-vs-knight

Hope your daughter likes it.