15 ms·
Ain't it funny how the knight moves?
- monroewalker 4y agoSo many unnecessarily negative comments.. I enjoyed this, thank you for making it
- hughdbrown 4y agoShortest path solution using breadth-first search https://gist.github.com/hughdbrown/5c14ec41c30532807afaeba9c16789a8 https://gist.github.com/hughdbrown/5c14ec41c30532807afaeba9c... Same result as the solver below: https://github.com/rubenvannieuwpoort/funnyhowtheknightmoves_solver https://github.com/rubenvannieuwpoort/funnyhowtheknightmoves... except for this path: a3 c2 e3 g4 h2 a3 c2 e3 f1 h2
- cf100clunk 4y agohttps://www.azlyrics.com/lyrics/bobseger/nightmoves.html https://www.azlyrics.com/lyrics/bobseger/nightmoves.html
- vore 4y agoI wish it could keep track of where the knight has already been.
- darepublic 4y agoYes 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
- jrumbut 4y agoThat and some explanatory text as to what the game actually is. My first thought was to try to capture the queen.
- Waterluvian 4y agoI tried and it wouldn’t let me. :(
- jrumbut 4y agoYeah the goal is actually to avoid the queen while visiting every space. Eventually I clicked "Help" and learned that.
- bee_rider 4y agoHow do you visit the squares that the queen is covering?
- Waterluvian 4y agoYou don’t. They’re not counted I think.
- rjh29 4y agoIt 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."
- jrumbut 4y agoI'm on a phone, I think that's the difference.
- joeframbach 4y agoExcept, 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 4y agoIt 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.
- joeframbach 4y agoThe text changed since my comment was posted.
- jpmoral 4y agoHow does that help you get to the indicated square?
- vore 4y agoI 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."
- jpmoral 4y agoIt may have been updated after you started.
- abliefern 4y agoI'm having difficulty understanding your difficulty in understanding. What did you think "right to left, top to bottom" meant?
- TuringTest 4y agoI got the same problem, I thought it meant 'relative to the current position', until you hit bottom left.
- Lapsa 4y ago[flagged]
- naet 4y agoThe 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 4y agoI 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 https://github.com/jairtrejo/knight-moves
- hgsgm 4y agowhy 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.
- soperj 4y agoIt is, because you need to get to the square that's indicated, not any random square.
- TurkishPoptart 4y agoHow to get it to C8? Gah!
- aidenn0 4y agofrom e7?
- jpmoral 4y agoTook 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 4y agoThat's how I had to do almost every move. It's really a graph search!
- y-curious 4y agoI 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!
- a_t48 4y agoI'm in the East Bay, but just a little bit too far West for that to work out for me. :(
- zetazzed 4y agoBerkeley Chess School does lots of casual tournaments (and classes): https://www.berkeleychessschool.org/programs/adult-chess-tournaments/ https://www.berkeleychessschool.org/programs/adult-chess-tou... (One of my kids does a lot with BCS and loves them) There's also a small sidewalk chess scene on Telegraph: https://www.berkeleyside.org/2022/01/30/community-chess-telegraph-avenue https://www.berkeleyside.org/2022/01/30/community-chess-tele...
- gurovich 4y agoSmall world! Is this the one at La Scala I've been hearing about?
- y-curious 4y agoYes! Come by tonight, 7p! There's actually a former YC guy that shows up sometimes, too.
- dragontamer 4y agoHmm, a weird version of a Knight's Tour. https://en.wikipedia.org/wiki/Knight%27s_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.
- darepublic 4y agoThe play on the Seger lyrics "night moves" with a chess knight was done earlier in an old ytmnd I remember
- quickthrower2 4y agoI 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 4y agoHoly... is that what you're supposed to do?!? No wonder the bar wasn't growing even though I jumped to every possible square -.-
- Kiro 4y agoJudging by this thread every single person did the same thing and became equally frustrated (myself included).
- danuker 4y agosomething something programmer found dead in the shower
- II2II 4y agoMaybe 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 4y ago...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 4y agono, 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?
- chadlavi 4y agoI didn't read the instructions at first and was confused why it wouldn't let me take the queen
- luxuryballs 4y agoclicks help ha ha I’m not doing that
- Kaibeezy 4y agoRight? 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.
- soperj 4y agoI feel like I wasted 18:40 seconds.
- Scubabear68 4y ago.. When you just don't seem to have as much to lose? Strange how the night moves. With autumn closin' in.
- Nifty3929 4y agoWe 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."
- curiousllama 4y agoLove 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”?
- Enginerrrd 4y agoI 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 4y agoSame 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.
- redbar0n 4y agoYes, 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.
- jpmoral 4y agoNice challenge. Can someone help me understand why other posters want highlighting for visited squares?
- thomasahle 4y agoBecause they think you just have to visit all the squares in no particular order.
- gre 4y agoHere'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_representation_of_the_number_of_moves_it/ https://www.reddit.com/r/chess/comments/1x7t58/visual_repres...
- 4by4by4 4y agoAs 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-of-chess/ https://fivethirtyeight.com/features/how-about-a-nice-game-o...
- oakashes 4y agoThat 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-deadly-board-game/ https://fivethirtyeight.com/features/can-you-survive-this-de...
- 0x0000000 4y agoThat 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 4y agoI 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.
- nick0garvey 4y agoThis 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.
- logicallee 4y agoFor 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 4y agoTook 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 4y agoThanks. 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!
- xiphias2 4y agoHow does the knight move? https://youtu.be/5lZEt6oz5MQ https://youtu.be/5lZEt6oz5MQ https://youtu.be/wfDCLEAU9hE https://youtu.be/wfDCLEAU9hE
- mabbo 4y agoWell that took me 28 minutes. I love it.
- sebzim4500 4y ago7: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.
- antihero 4y agoThis is the most boring game ever and I’m not sure why anyone would play it.
- TheRealPomax 4y agoThis has terrible instructions.
- dan-robertson 4y agoTook 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.
- etothepii 4y ago22:04
- moglito 4y agoNo leaderboard? Finished in 8:41.
- deleted 4y ago[deleted]
- mckeed 4y agoI 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 https://i.imgur.com/8OuQcu8.png
- hot_gril 4y agoWas hoping someone had done this already, thanks.
- mckeed 4y agoInterestingly, you can hit all of the top 3 rows without going below the queen except for needing g4 to get to and from h6.
- jonas-w 4y agoHow did you do this? Or was this done manually?
- mckeed 4y agoI wrote a ruby script to map out the graph and fed it into graphviz to make the image. https://graphviz.org https://graphviz.org
- maxcan 4y agoThis is the way.
- dfan 4y agoThis 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.
- v64 4y ago
- Trufa 4y agoOk, shameless plug. I did a pretty “popular” version of this. https://knight-queen-game.netlify.app/ https://knight-queen-game.netlify.app/
- ec109685 4y agoYours is nice. I think the behavior of clicking where the night goes is a bit better.
- Trufa 4y agoThank 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
- deleted 4y ago[deleted]
- bonzini 4y agoIt'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.
- peepee1982 4y agoMan, your's is a lot more fun.
- whstl 4y agoThis reminds me of one of the final puzzles in the 90s aventure game Gabriel Knight: https://youtu.be/fPByLdCYPpo?t=33989 https://youtu.be/fPByLdCYPpo?t=33989 (spoiler alert, it's the last part)
- heroiccocoa 4y agohttps://www.youtube.com/watch?v=SrQlpY_eGYU https://www.youtube.com/watch?v=SrQlpY_eGYU It's not meant to be easy, I'm 1800 bullet on lichess and struggling
- tmtvl 4y agoInstructions unclear, reread Through the Looking-Glass, and What Alice Found There.
- mdaniel 4y agoIf 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
- deleted 4y ago[deleted]
- GistNoesis 4y agoI added a graph and a screenshot : https://gist.github.com/unrealwill/07069676a577f6dfbc35553696869798 https://gist.github.com/unrealwill/07069676a577f6dfbc3555369...
- bjt2n3904 4y agoA really clever puzzle, UI issues aside. Reminds me of programming the knights tour back in college.
- thenerdhead 4y agoWorkin' on our knight moves. Tryin' to make some front page hacker news. Workin' on our knight moves.
- hardwaregeek 4y agoAfter 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 4y agoThat 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 https://ibb.co/JFY3jm4 Was much, much easier to complete once I could see a map of the board.
- cochleari_major 4y agoHere is one possible solution using fewest moves (I think) https://tinyurl.com/noitaint https://tinyurl.com/noitaint
- aoeusnth1 4y agoI did this and now my brain is humming and my blood pumping. Thanks.
- travisjungroth 4y agoIn 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 4y agoHow is B7 more noteworthy than anywhere else that is under attack from the queen?
- unkulunkulu 4y agoIt’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 4y agoCause I made a mistake and coded the queen as a rook. Jeez I should just go to bed.
- kjgkjhfkjf 4y agoThe 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.
- bfung 4y agoTangent, but more meme marketing name suggestion: how does the knight move? https://youtu.be/wfDCLEAU9hE https://youtu.be/wfDCLEAU9hE
- raydiatian 4y agoThe 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.
- phnofive 4y agoHigh score: 2:44 to scroll down and realize what in the heck I was supposed to be doing
- amriksohata 4y agoAll taken from the original Indian game of chess, where the Knight was the Elephant and had certain moves it could make.
- chedoku 4y agoif you like this chess puzzle, you may be interested in https://chedoku.com/#dailypuzzle https://chedoku.com/#dailypuzzle Here is a video of me solving the puzzle: https://www.youtube.com/watch?v=ZrCxZkZDskc https://www.youtube.com/watch?v=ZrCxZkZDskc
- xg15 4y agoInstead 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 https://news.ycombinator.com/item?id=34461415
- TuringTest 4y agoThat 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).
- GistNoesis 4y agoInspired by some other comments here, I added a way to help visualize the graph (see screenshot and code) : https://gist.github.com/unrealwill/07069676a577f6dfbc35553696869798 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.
- rustybolt 4y agoFelt like writing a solver for it: https://github.com/rubenvannieuwpoort/funnyhowtheknightmoves_solver https://github.com/rubenvannieuwpoort/funnyhowtheknightmoves...
- kubanczyk 4y agoHow elegant: abs(x - 4) != abs(y - 3)
- sireat 4y agoGood 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.
- jslakro 4y agoKnight movements on chess always makes me think in the glider on Conway's game of life
- salvipeter 4y agoIf 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/knight-46.pdf http://directory.iit.bme.hu/~salvi/archive/snippets/knight/k...