Settings

Theme

Ain't it funny how the knight moves?

funnyhowtheknightmoves.com

312 points by mpnagle · 210 comments

Reader

52 threads
quickthrower2

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.

  • addandsubtract

    Holy... is that what you're supposed to do?!? No wonder the bar wasn't growing even though I jumped to every possible square -.-

    • Kiro

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

      • ryandrake

        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.

        • charcircuit

          The game tells you what square to move to.

          • Dalewyn

            You need to have /some/ experience playing chess to realize and understand chess notation.

            And no, vague and indirect "move to every square in order" located separately from the chess notation is not good information. Also, no, tiny nomenclature for ants on the board is not good information.

            • IanCal

              Also on a phone/thin browser window the goal shrinks from "huge text under the header" to "small text at the bottom of the screen" and the instructional text disappears.

        • throwbadubadu

          Have to raise my hand then to shock you.. what else should the coordinate that is also indicated on the axes mean?

          > to every square in order, right to left, top to bottom

          Added to that immediately.

          shrug But yeah as the title says, one realizes quickly that knight moves pretty strange so got bored after 5 targets and did something more exciting: wrote a Python script that prints me the moves from and to any coordinate (:

          • TuringTest

            Have to raise my hand then to shock you.. what else should the coordinate that is also indicated on the axes mean?

            Yeah, but it's not clear that the instructions text is talking about that symbol, *because it doesn't say so* explicitly.

            Sometimes a small level of information redundancy is good for communicating with humans, instead of forcing them to make the correct inferences in place.

            • antifa

              It wouldn't technically be redundant, the help instructions are ambiguous.

      • rkagerer

        How is this #3 on my HN today? Is it supposed to be a lesson on how NOT to write?

      • danuker

        something something programmer found dead in the shower

        • II2II

          Maybe we were pushing the programmer a little too hard for changes if they felt compelled to continue working on their project while showering. (Remember folks: using a computer, or any other electric appliance, in the shower is a bad idea!)

          • OJFord

            ...unless it's an electric shower?

            (Much as I'm tempted to agree they were a bad idea, we're kind of past that point and it's sort of fine... A bad idea well-executed?)

          • dylan604

            no, you just have to use your brain implant's wireless connection to make changes. what kind of 21st century lame-os are you that have to worry about electric connections to the computer?

        • dylan604

          ohmuhgawd, that's gotta be the darkest thing i read all day and caused me to literally lol (so that device would let me type it) so hard i spilled a bit of my old fashioned.

      • dopidopHN

        I was like, ok neat but too bad that bar is broken.

      • xiande04

        Wow, I thought it was just cus I was drunk

      • abliefern

        I'm confused. What "same thing" did everyone try? The instructions in the help section in the game seemed perfectly clear?

        • riffraff

          No, they say to move in every place, while you're expected to to move to a specific place in every step. f8 is the first for me, but I did not understand that was supposed to be the target, since it seems arbitrary.

          • abliefern

            But it says "every square in order right to left, top to bottom"?

            • TuringTest

              I understood that to mean that 'each single move' should aim to move to the left and below the previous position if possible (presumably to reach the bottom left square as the game goal?); taking 'every square' to imply 'every square you move to'; and being further complicated by having a complex subordinate clause with restrictions to movement.

              It's not a clear, unambiguous instruction.

    • jbverschoor

      "It's a user error".. "Users are stupid".. "Why can't they just understand something so simple"

    • hot_gril

      I was thinking, dude I can just move the knight between the same two squares, this game is easy.

    • mort96

      Just curious, what exactly did you think "in order, right to left, top to bottom" was supposed to mean?

      • antifa

        I thought it meant "goto the bottom left corner" or "goto the top left corner then goto the bottom left corner." or "mark all legal tiles visited".

        There's no hint in the help that you're suppose to goto the tile coordinate specified by the little box in the bottom left corner. I'm not even technically sure that's what the "f8" at the beginning is for since the help doesn't mention it.

      • jayknight

        Like move the Knight to every square on the board, in a certain order, but skipping some. I didn't notice the "f8" at the bottom until I read the comments.

    • froh

      so they only now added a help button? that's what it says there.

  • pmontra

    Thanks.

    They wouldn't have to write any instruction nor add letters and numbers around the board (they are missing) if they marked the goal square. Even after I read your instructions I equivocated where f8 is. I actually moved to f1, then realized that's a long time since I looked at a chess diagram.

    A demonstration of how a little detail can ruin a project.

  • alexb_

    Honestly I read this the first time and thought you were making a suggestion as to how the game should be changed. I love the idea but the design and explanation is just awful.

  • raldi

    Or just put a target on each goal square in turn.

    • bigdict

      Yeah I don't think text instructions are even necessary here if you make enough visual suggestions.

      • II2II

        I think the text is useful for describing the ultimate goal, but agree that visual suggestions would make it easier to figure out what the problem is about.

        For example, I read this as a variation of the knight's tour but was confused as to why they didn't highlight the visited squares. (Answer: it isn't a knight's tour since each square will be visited more than once.)

        Another example, the description itself didn't quite make sense since it mentioned a sequence but didn't really say that certain squares must be skipped. (In retrospect, the answer is obvious. The queen makes certain squares invalid destinations, along with being invalid intermediate steps to that destination. But it won't be obvious to some people upon initially reading the instructions.)

        Finally, the purpose of the square shown in the completion gauge isn't explained at all. Since it is not explained, I did not link it to the description of the goal.

        • lelanthran

          > I think the text is useful for describing the ultimate goal

          No, text is not needed if the next target block is marked - after the first three acquisitions of the first three target blocks, the game is very clear.

      • dylan604

        so says every primary math student learning word problems

  • ineptech

    Thank you! Once I saw this comment, very satisfying puzzle. At first I was fumbling my way through randomly, but around halfway I started to visualize the board as two "sets" of connected paths and grokked how to switch between them using the lower-right quadrant.

    • lelanthran

      > Thank you! Once I saw this comment, very satisfying puzzle. At first I was fumbling my way through randomly, but around halfway I started to visualize the board as two "sets" of connected paths and grokked how to switch between them using the lower-right quadrant.

      Exactly this - I used the upper right quadrant to switch lanes, but the idea is the same: if you cannot reach the target in the current lane, switch lanes and try again.

  • chasil

    In any case, this is a variant of the "knight's tour."

    https://en.m.wikipedia.org/wiki/Knight%27s_tour

  • seanwessmith

    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 < modifiedElements.length; i++) {
                el = squareElements.find(e => {
                  return e.getAttribute('data-squareid') === modifiedElements[i]
                })
                el.style.backgroundColor = 'red';
              }
            });
          }
        });
      });
      
      // observe all square elements
      for (let i = 0; i < squareElements.length; i++) {
        observer.observe(squareElements[i], { childList: true, subtree: true });
      }
      
      // replace instructions with more accurate instructions
      instructions = document.querySelector('section p')
      instructions.innerHTML = '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.';
  • layer8

    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.

    • II2II

      > not everyone knows chess notation by heart.

      I am going to agree, and hopefully clarify the point with a slightly different example. While I know how the notation works, I cannot figure out where a particular square is at a glance. This meant a lot of time squinting at the tiny, low contrast labels at the edges of the board. It made the problem a lot harder to solve since my concentration was constantly being disrupted by figuring out where the next destination is, rather than focusing upon the pattern of the knight's moves.

    • andai

      They are written on the board..?

      • layer8

        Wow, I totally didn’t see those. Much too small and low-contrast, they are basically invisible on a smartphone.

      • msrenee

        I'm not seeing the letters. I see the numbers and vaguely knew enough about chess to know which way the numbers go. Honestly, I really only know about the board location designations because of the puzzle under the word scramble in the paper that asked you to accomplish something on the example chess board. The answers to the previous challenge were written (upside down to prevent accidental spoilers) in the standard(?) chess notation.

      • marssaxman

        I did not see those markings at all - nor did I see the label indicating the square to jump to, until quickthrower2's explanation cued me to look for it!

        (I see now that the target-square notation is much more prominent if you stretch the window horizontally, but I habitually use portrait-mode windows, where it's very small.)

    • wyclif

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

  • DrewADesign

    Kind of makes you appreciate the amount of work most games put into UI design. This game mechanic is very simple and it still needed documentation... And the documentation wasn't enough! Immensely complex games these days are so good at providing hints and player feedback that many often don't need their tutorial levels.

    • antifa

      IMO the documentation says to do something completely different than what the apparent goal actually is.

      • DrewADesign

        Sure. It's a different facet of the same problem. There's a damn good reason that professional software development organizations hire designers and technical writers, and while many developers like to think so, it's not merely to save them time. Developers often suck at making docs for other developers; reasoning about communicating to people one step removed from that gets even dicier. As a developer before I learned good design principles, I often fell into the trap of assuming my being able to assemble something in code gave me sufficient understanding of why it was designed that way. Ah, the hubris of inexperience.

  • idopmstuff

    Wow. Thanks. Totally missed that.

    Maybe throw a little highlight on the square on the board as well.

  • muthuh

    Perhaps it's me but had absolutely no trouble interpreting the 'help' meassage. Before I did though, for at least some time, was trying to capture the queen :)

  • Terretta

    Better instruction from alt implementation of game linked below:

    "Objective: Get to every square of the board that is not attacked by the queen (without capturing it either), right to left, top to bottom."

    Clarifies the square indicator tip isn't necessary for the instructions.

    https://news.ycombinator.com/item?id=34462855

  • cush

    And move the bar to the top with a bit of text - "Next square: F8"

    Yeah I spent a lot of time trying to hit every square.

  • balaji1

    another hidden UX: clicking a square will move the knight there (if valid move). do not have to drag and drop.

    • iforgotpassword

      Man, I was losing it on mobile since a) I didn't get that it tells you the next field below the board, then b) the labels in the squares are too low contrast to be visible on my phone, and c) 9 out of 10 times the browser would start scrolling instead of starting to drag the knight.

    • quickthrower2

      Thank rook for that

  • arc-in-space

    I suppose you win the 10000 IQ award for being the only person on the website to realize?

  • hluska

    Thank you! This was a really fun puzzle once I read your comment. It’s much appreciated!

  • 6c696e7578

    Target square in middle of circle, don't get captured or capture.

  • nvdrx

    Where was this comment 5 minutes in?

naet

The fact that it doesn't highlight where you've moved already makes it no fun.

Edit: the directions weren't super clear. I see that you're actually supposed to go to every square in a specific order (first G8, then F8, E8, etc), not just visit them all in any order. That means you have to do a bunch of laborious trips around the queen to go to certain squares since you won't have enough room to maneuver directly there.

  • spicybright

    I agree, but I wonder if it's on purpose.

    I found the repo[1] and it's very small readme says it's a "Chess visualization exercise"

    So I'm wondering if it's an extreme exercise in memorization to help you visualize games better.

    (I'm just talking out my butt here, I know nothing about chess puzzles)

    [1]: https://github.com/jairtrejo/knight-moves

    • b4je7d7wb

      That's how I took it as well. Everyone talks about highlighting stuff but you don't get highlights in real games. I got more comfortable with knight manouvers and chess notation thanks to this puzzle.

      It should definitely have some visual tutorial for people to understand how it works though.

    • soperj

      It is, because you need to get to the square that's indicated, not any random square.

      • gus_massa

        They should highlight the target square in the board instead of only writing it in the "clock".

        • JumpCrisscross

          > should highlight the target square in the board instead of only writing it in the "clock".

          If it's a visualization exercise, they should not. Gaining intuition for notation is strangely enabling, particularly if you have an algebraic mind.

          • II2II

            It depends upon what you are trying to visualize. If you are trying to visualize the pattern of the knight's moves, e.g. how to reach a specific square using a sequence of moves, then highlighting the target would be more valuable. The displacement matters, not the absolute positions. The absolute positions are more of a hindrance since it makes it more difficult to generalize the sequence of moves.

            • bonzini

              The point is learning to generalize the sequence of moves, and that's why it doesn't give any visual cue.

              • gus_massa

                In a real chess position, where the knight must go is the easy part because there something interesting to do there (like capturing a piece). The problem here is that the chessboard is empty, so it's difficult to remember where you should go.

                The interesting part is finding the knight trajectory, reading the notation is boring and easy.

                (If the point of the exercise was to read the notation, it should be a different game, like clicking that square as fast as possible.)

                • JumpCrisscross

                  > where the knight must go is the easy part because there something interesting to do there (like capturing a piece)

                  The aim is to build an intuition for where the knight can traverse without getting captured in N moves. If you can see further into the future than your opponent, you may notice a pattern before they have a chance to stop it. This intuition isn’t fundamentally tied to notation. But having intuition for the notation facilitates it since that’s how discussion and literature will interface with you.

          • fsckboy

            yes, i have an algebraic mind, and I find it easy to visual where the squares are, and if you say "N-KP4", I'm Johnny-on-the-spot! now, what's this a-b-c stuff?

    • xg15

      Ah ok! If this is part of some sort of chess training course, this would make sense. Sadly, HN is really bad at presenting context for a submission.

    • ak_111

      Still doesn't make it sense from a UX perspective. You can make it an option to highlight the square or just show coordinates and cater for both crowds.

    • hgsgm

      why would I practice visualizing not-chess information about chess pieces, when I could visualize actual chess information?

      The history of a pieces moves is irrelevant to chess, except in extreme corner cases of repetition.

      • trfzx

        The history is irrelevant here as well, you just need to know the next goal, which is always indicated.

        • hgsgm

          I see that now. The UI has poor discover ability of the goal, especially on mobile.

  • nighthawk454

    Turns out you're supposed to do them one at a time, in order. Tracking the visited squares doesn't add much for that

mckeed

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

  • graphenjoyer

    Same but with the original board as part of the visualization, and with different parts of the structure highlighted:

    https://ibb.co/JFY3jm4

    It made a lot more sense after doing that, as I'm nowhere near proficient enough at chess to see the board and all its moves in my mind's eye.

  • mckeed

    Interestingly, you can hit all of the top 3 rows without going below the queen except for needing g4 to get to and from h6.

  • v64

    Thanks for generating this! I struggled quite a bit getting to a few squares, and the graph shows they were indeed far apart from each other and that I wasn't missing something obvious.

  • dfan

    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.

  • hot_gril

    Was hoping someone had done this already, thanks.

  • jonas-w

    How did you do this? Or was this done manually?

  • cyclotron3k

    I'm not sure what I was expecting but 8t wasn't that. Very interesting!

  • maxcan

    This is the way.

Trufa

Ok, shameless plug. I did a pretty “popular” version of this.

https://knight-queen-game.netlify.app/

  • bonzini

    It's really cool (quite a bit harder) but on the phone it's frustrating that a fat finger can result in a diagonal move (e.g. b6 to a7 instead of a8) and instantly lose the progress.

  • ec109685

    Yours is nice. I think the behavior of clicking where the night goes is a bit better.

    • Trufa

      Thank you :)

      I really had fun making it and speed running it.

      It is also one of the few things I’ve made outside of work that got kind of popular for a little while and the ride was really fun.

      It gives me disproportionate pride and joy :)

      I also love chess

  • peepee1982

    Man, your's is a lot more fun.

dragontamer

Hmm, a weird version of a Knight's Tour.

https://en.wikipedia.org/wiki/Knight%27s_tour

It seems like in this version / webpage, you're allowed to revisit squares however. It'd be nice if it highlighted what squares "Counted", because the words are quite ambiguous. A graphical representation of what is being counted / not counted would be very helpful.

----------------

EDIT: Ah, I got it. The location on the left is the next spot you're supposed to go to. The puzzle is quite easy once I understood the interface.

The interface needs a "Next square: h5" or something. I really didn't get it for the longest time.

gre

Here's how many moves it takes to get everywhere from a middle square as the knight.

https://www.reddit.com/r/chess/comments/1x7t58/visual_repres...

cf100clunk

https://www.azlyrics.com/lyrics/bobseger/nightmoves.html

mdaniel

If you'd like "easy mode," such that the queen's squares are highlighted:

  ((sq) => { let board = document.querySelector('div.m-auto'); sq.forEach(s => board.querySelector('[data-squareid="'+s+'"]').style.backgroundColor='red'); })(["d8", "d7", "d6", "d4", "d3", "d2", "d1", "e6", "f7", "g8", "c6", "b7", "a8", "c5", "b5", "a5", "e5", "f5", "g5", "h5", "c4", "b3", "a2", "e4", "f3", "g2", "h1"])
I found that to be the middle ground between "you still have to plan" versus the amount of energy I was spending trying keep track of the forbidden squares
nick0garvey

This took me 14:02 on the first try. Definitely got faster as time went on but I found myself getting stuck on a few squares for no good reason. Starting from the destination and working toward the source helped.

vore

I wish it could keep track of where the knight has already been.

  • jrumbut

    That and some explanatory text as to what the game actually is. My first thought was to try to capture the queen.

    • rjh29

      It has text now? "Move the knight to every square, right to left, top to bottom. Don’t land anywhere the queen can take you, and don’t take the queen."

      • joeframbach

        Except, it's not accurate. It says "move the knight to every square" but the game is actually "move the knight to the next square specified".

        • eterm

          It might not be obvious, but the specified squares are "all the squares in the order right to left, top to bottom without those the queen can attack" as the text instructs.

      • jrumbut

        I'm on a phone, I think that's the difference.

    • Waterluvian

      I tried and it wouldn’t let me. :(

  • darepublic

    Yes I agree. They do have a square coordinate at the bottom which is the next square to go to following that will get you all the chess squares

  • jpmoral

    How does that help you get to the indicated square?

    • vore

      I didn't actually realize the goal of the game was to do it all in order! The help text just says "Move the knight to every square, right to left, top to bottom."

      • abliefern

        I'm having difficulty understanding your difficulty in understanding. What did you think "right to left, top to bottom" meant?

        • TuringTest

          I got the same problem, I thought it meant 'relative to the current position', until you hit bottom left.

      • jpmoral

        It may have been updated after you started.

darepublic

The play on the Seger lyrics "night moves" with a chess knight was done earlier in an old ytmnd I remember

y-curious

I love the amount of chess nerds on Hacker News. If anyone is in the East Bay of SF and likes chess, I run a chess club in Walnut Creek, hit me up!

xiphias2

How does the knight move?

https://youtu.be/5lZEt6oz5MQ

https://youtu.be/wfDCLEAU9hE

kjgkjhfkjf

The knight move in chess seems a bit strange at first, but it makes sense when you realize that the knight can move to squares that lie on a circle around it.

hughdbrown

Shortest path solution using breadth-first search

https://gist.github.com/hughdbrown/5c14ec41c30532807afaeba9c...

Same result as the solver below:

https://github.com/rubenvannieuwpoort/funnyhowtheknightmoves...

except for this path:

a3 c2 e3 g4 h2

a3 c2 e3 f1 h2

4by4by4

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...

  • oakashes

    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...

    • 0x0000000

      That post says,

      > Note: If you counted the pawn moving forward two squares with its initial move as distinct from its moving two individual squares, then there are 160 paths. Feeling generous, I gave full credit for either approach.

      • oakashes

        I guess I didn't read far enough. Seems pretty obvious you'd need to count that as a separate path, to me the 141 answer is plain incorrect.

sebzim4500

7:31, I found the UI kind of annoying. I kept accidentally selecting the text on the edge and then wasted time trying to deselect it.

TheRealPomax

This has terrible instructions.

Scubabear68

..

When you just don't seem to have as much to lose?

Strange how the night moves.

With autumn closin' in.

  • Nifty3929

    We were gettin' our shaaaare....

    My first thought as well. I wonder if it was an intentional reference.

    Edit: Duh - it's right on the page "Inspired by Ben Finegold and Bob Seger."

salvipeter

If you drop the sequential restriction, this becomes a pretty neat shortest path problem, essentially the same as LeetCode 847, but the simple dynamic programming approach does not work here (too much memory needed). It can be transformed to TSP, though, which gives an optimal solution (using Concorde) of just 46 moves: http://directory.iit.bme.hu/~salvi/archive/snippets/knight/k...

rustybolt

Felt like writing a solver for it: https://github.com/rubenvannieuwpoort/funnyhowtheknightmoves...

logicallee

For me the instructions are pretty clear: every square "right to left, top to bottom" - except don’t land anywhere the queen can take you, and don’t take the queen. (i.e. somehow move to the upper-right, then one to the left and so forth going through the rows and columns backards and down, like reading right to left down a page.)

I gave up after 4 minutes. It's really tough and I only got partway through the second row. I play OK chess (slightly above average on lichess) but it is a really tough visualization exercise.

for anyone who did it to completion, how long did it take? did you speed up by the end?

  • heleninboodler

    Took me a few minutes to understand what exactly I was supposed to do but once I figured it out I reset and did it in 13:15. Pretty neat game. I'm not sure I could do it faster a second time, just because my approach is a bit trial-and-error. Some patterns were surprisingly elusive this way.

    I actually think I would enjoy it more if the UI helped a bit more, like by marking the squares that were forbidden because of the queen.

    • logicallee

      Thanks. Regarding marking forbidden squares, apparently the whole point of the game is to develop visualization skills for chess (under Help, it references a grandmaster who recommends this exercise), so if it marked forbidden squares it would defeat the purpose a bit, I think!

monroewalker

So many unnecessarily negative comments.. I enjoyed this, thank you for making it

raydiatian

The design for this app is atrocious for anybody who has played online chess.

“This is a valid move. This is a valid move.”

reads rules.

“They couldn’t paint one measly Queen black? Exit”

You know if you know. The queen is white. I’m going to occupy the diagonal.

hardwaregeek

After a couple tries got it done in 16 minutes or so. Probably laughably bad for anyone good at chess but it was a fun and enlightening challenge. About midway through I had a sudden click and figured out the pattern to hit the right squares. I don’t know how to put it into words but I believe there’s a three move combo that helps you move off of one set of squares and onto the other set. And my intuition got a lot better towards the end, even getting the last squares almost by accident. Funny how that happens

  • graphenjoyer

    That sort of clicked for me too, then I decided to take a break from fumbling through it and draw out the graph.

    I ended up visualizing as two sets of loops connected to each other in the bottom-right, top-right and bottom-left quadrants, with some dead ends branching out:

    https://ibb.co/JFY3jm4

    Was much, much easier to complete once I could see a map of the board.

xg15

Instead of just giving the next square you're supposed to jump to, how about just highlighting all the squares on the board that you already visited? I think that would make the game both easier to understand and give the player an incentive to complete it (the "gotta catch em all" effect)

Edit: ... or maybe not: https://news.ycombinator.com/item?id=34461415

  • TuringTest

    That would be missing the 'in order' part (not that it's much relevant, since you should already know how to backtrack to any visited square).

luxuryballs

clicks help

ha ha I’m not doing that

  • Kaibeezy

    Right? Where’s the fun in that? I blame YouTube for explaining the bejeezus out of everything and spoilering everything else. Don’t get me wrong, it has its value. I’ve saved hundreds on refrigerator repairs.

GistNoesis

Inspired by some other comments here, I added a way to help visualize the graph (see screenshot and code) : https://gist.github.com/unrealwill/07069676a577f6dfbc3555369...

Once you can visualize the knights graph in your head, you just have to run Dijsktra in your head.

curiousllama

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”?

  • redbar0n

    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.

  • Enginerrrd

    I think this is basically the same strategy I stumbled onto. It feels binary in nature, like you're either on circuit or off circuit within the target areas, and there's only that one degree of freedom within the small quadrants. If off circuit it seems like you have to go to one of the larger quadrants to get on the right circuit again and hit the target.

    • sebastos

      Same here. By the end, I was just reflexively moving back to the bottom right hand quarter, doing my 3 point turn, and then taking the circuit back to the destination.

jpmoral

Nice challenge. Can someone help me understand why other posters want highlighting for visited squares?

sireat

Good exercise! 5:29 on the first try (FM),

3:27 on 2nd try once I realized we have to move the knight to non attacked squares from top right to left bottom

At first I thought I had to implement the knights walk by myself so wasted about 30 seconds on understanding the instructions.

tmtvl

Instructions unclear, reread Through the Looking-Glass, and What Alice Found There.

whstl

This reminds me of one of the final puzzles in the 90s aventure game Gabriel Knight:

https://youtu.be/fPByLdCYPpo?t=33989

(spoiler alert, it's the last part)

thenerdhead

Workin' on our knight moves.

Tryin' to make some front page hacker news.

Workin' on our knight moves.

travisjungroth

In case anyone else goes nuts trying to write a program for a knight's tour with the additional queen constraint from this game: you can't get to B7. Obvious if you actually look at the board.

  • jessaustin

    How is B7 more noteworthy than anywhere else that is under attack from the queen?

    • unkulunkulu

      It’s double unreachable: you cannot go to any of its neighbours either. Really hidden square for the knight.

      while trying to solve this by hand this square also came to my attention and I didn’t notice that it is forbidden by the queen directly :)

    • travisjungroth

      Cause I made a mistake and coded the queen as a rook. Jeez I should just go to bed.

heroiccocoa

https://www.youtube.com/watch?v=SrQlpY_eGYU

It's not meant to be easy, I'm 1800 bullet on lichess and struggling

TurkishPoptart

How to get it to C8? Gah!

  • jpmoral

    Took me ages. What finally helped me was to work backwards from c8. What squares can get to c8? Which of those squares can I eliminate (e.g. because to get there I'd have to be on a square covered by the queen) and so on.

    • mabbo

      That's how I had to do almost every move. It's really a graph search!

  • aidenn0

    from e7?

bfung

Tangent, but more meme marketing name suggestion: how does the knight move?

https://youtu.be/wfDCLEAU9hE

cochleari_major

Here is one possible solution using fewest moves (I think) https://tinyurl.com/noitaint

dan-robertson

Took me ~25 minutes which was annoying. As I type this, my brain is worried that the individual keys I type are not knight’s moves away from each other.

chedoku

if you like this chess puzzle, you may be interested in https://chedoku.com/#dailypuzzle

Here is a video of me solving the puzzle: https://www.youtube.com/watch?v=ZrCxZkZDskc

amriksohata

All taken from the original Indian game of chess, where the Knight was the Elephant and had certain moves it could make.

chadlavi

I didn't read the instructions at first and was confused why it wouldn't let me take the queen

bjt2n3904

A really clever puzzle, UI issues aside. Reminds me of programming the knights tour back in college.

jslakro

Knight movements on chess always makes me think in the glider on Conway's game of life

phnofive

High score: 2:44 to scroll down and realize what in the heck I was supposed to be doing

aoeusnth1

I did this and now my brain is humming and my blood pumping. Thanks.

soperj

I feel like I wasted 18:40 seconds.

moglito

No leaderboard? Finished in 8:41.

mabbo

Well that took me 28 minutes.

I love it.

antihero

This is the most boring game ever and I’m not sure why anyone would play it.

etothepii

22:04

Keyboard Shortcuts

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