Live data from Hacker News

Ain't it funny how the knight moves?

funnyhowtheknightmoves.com

111–120 of 211 posts

Re: Ain't it funny how the knight moves?

#112
post #79

I mapped out the structure of the board as a graph of which squares you can get to from which other squares. It's surprisingly stringy without all the squares forbidden by the queen placement. https://i.imgur.com/8OuQcu8.png

This is a good advertisement for the approach I came up with eventually: if you don't see a trivial way to the next square, find a sequence that will lead to it that starts in the lower right quadrant, then go to that quadrant and get to that square. (The lower right quadrant is the center ring in this diagram.)

I'm used to a version with pawns that involves less backtracking, so it took me a little while to stop trying to be "smarter" and just be okay with continually returning to home base.

Re: Ain't it funny how the knight moves?

#114

Love it. Anyone found a strategy better than “choose a path that will get you there that has a square in the largest quadrant, and jump from there”?

Yes, start with the end square and work your way backwards. It is often only a single path that leads you there for the final steps. Once you develop the path close enough back to where you are then it’s easier to see how you can get onto it. Then just follow it.

Incidentally, this is also a good strategy for planning and breaking down goals in real life: begin with the end goal, then work your way backwards.

Re: Ain't it funny how the knight moves?

#115
post #45

I think the instructions should be: Move to the square indicated below the board without moving to a square the queen can capture and without capturing the queen. Once accomplished a new square will be indicated. Repeat until all possible squares are done.

A short note about how the coordinates work would also be helpful, or just highlight the target square, because not everyone knows chess notation by heart. I tried two different interpretations (both wrong) before finally resolving to google for it.

It asked me to move to e8...but that's a move where the Queen takes Knight. I don't get it.

Re: Ain't it funny how the knight moves?

#117
post #31

Earlier quoted context omitted.

Judging by this thread every single person did the same thing and became equally frustrated (myself included).

Well, it's the one thing the directions didn't actually say: The goal of the game. I'd be shocked if anyone went to that site and could figure out what to do.

The game tells you what square to move to.

Re: Ain't it funny how the knight moves?

#118

I think the instructions should be: Move to the square indicated below the board without moving to a square the queen can capture and without capturing the queen. Once accomplished a new square will be indicated. Repeat until all possible squares are done.

here's a script that will highlight previously visited squares as red. as a nice bonus it replaces the instructions with more accurate ones

  // Get all square elements
  squareElements = [...document.querySelectorAll("[data-testid='white-square']"), ...document.querySelectorAll("[data-testid='black-square']")];
  
  // create array of elements that have been landed on
  // these need to be set to red every time because the board resets every move
  let modifiedElements = [];
  observer = new MutationObserver(function (mutations) {
    mutations.forEach(function (mutation) {
      if (mutation.addedNodes.length > 0) {
        mutation.addedNodes.forEach(function(addedNode) {
          key = addedNode.getAttribute('data-testid').split('-')[1];
          if (!modifiedElements.includes(key)) {
            modifiedElements.push(key);
          }
          for (let i = 0; i  {
              return e.getAttribute('data-squareid') === modifiedElements[i]
            })
            el.style.backgroundColor = 'red';
          }
        });
      }
    });
  });
  
  // observe all square elements
  for (let i = 0; i 

Re: Ain't it funny how the knight moves?

#119
post #39

As a teenager I had a chess lesson with Ben Finegold and I practiced this puzzle for weeks on a physical board. He also mentioned this riddle off hand which I had a ton of fun solving. https://fivethirtyeight.com/features/how-about-a-nice-game-o...

That is fun! It's interesting, the solution is presented here[1], but I'm pretty sure it's wrong (off by 19) due to not taking into account the possibility for the pawn to move two squares on its first move.

[1] https://fivethirtyeight.com/features/can-you-survive-this-de...

Re: Ain't it funny how the knight moves?

#120

I think the instructions should be: Move to the square indicated below the board without moving to a square the queen can capture and without capturing the queen. Once accomplished a new square will be indicated. Repeat until all possible squares are done.

here's a script that will highlight previously visited squares as red. as a nice bonus it replaces the instructions with more accurate ones // Get all square elements squareElements = [...document.querySelectorAll("[data-testid='white-square']"), ...document.querySelectorAll("[data-testid='black-square']")]; // create array of elements that have been landed on // these need to be set to red every time because the boa…

very clever little hack -- had to fix the first couple of lines to remove extra newlines and "...."
Post reply on HN