2 pointsby patrickdaveya month ago2 comments
  • gus_massaa month ago
    After a few tries I won, but the computer made mistakes. What is the AI doing?
    • patrickdaveya month 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_massaa month 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.

        • patrickdaveya month 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_massa25 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!

            :)

  • zippyman55a month ago
    Way cool game! Great job, easy to understand.
    • patrickdaveya month ago
      Thanks :). Did you manage to beat it (first time?) ;)
      • zippyman5525 days ago
        I lost the first game and won the second.