Settings

Theme

Show HN: Kings vs. Knight

minichessgames.com

2 points by patrickdavey 20 days ago · 9 comments · 1 min read

Reader

This is a play website I built out with my 6 year old to show her that you can also build for the web (not just consume!). The idea was to make a bunch of small mini games (more coming) where you can learn some basic chess strategy. In this game you play a knight vs 3 kings who try to trap you. Try to survive for 15 moves.

Once you get bored of that, there's the classic radioactive pooping knights [1] ;). It's also wrapped up into an app [2] if that's better :)

Very keen for feedback :)

1. https://minichessgames.com/#/play/pooping-knights 2. https://play.google.com/store/apps/details?id=com.minichessg...

gus_massa 20 days ago

After a few tries I won, but the computer made mistakes. What is the AI doing?

  • patrickdaveyOP 19 days ago

    It's just a basic minmax. The main mistake it makes is that if it can find an assured path to getting you it doesn't care how many moves in the future it is (even if it could win this turn).

    That said, the audience is 6 year olds so I don't really want it to play perfectly!

    • gus_massa 19 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.

      • patrickdaveyOP 19 days ago

        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)

        • gus_massa 18 days ago

          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!

          :)

zippyman55 20 days ago

Way cool game! Great job, easy to understand.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection