TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ain't it funny how the knight moves?

312 pointsby mpnagleover 2 years ago

52 comments

quickthrower2over 2 years ago
I think the instructions should be:<p>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.
评论 #34461648 未加载
评论 #34464417 未加载
评论 #34462361 未加载
评论 #34461737 未加载
评论 #34462418 未加载
评论 #34461832 未加载
评论 #34463971 未加载
评论 #34461848 未加载
评论 #34464234 未加载
评论 #34461659 未加载
评论 #34464147 未加载
评论 #34468488 未加载
评论 #34463459 未加载
评论 #34464235 未加载
评论 #34464997 未加载
评论 #34462987 未加载
评论 #34464786 未加载
评论 #34486324 未加载
naetover 2 years ago
The fact that it doesn&#x27;t highlight where you&#x27;ve moved already makes it no fun.<p>Edit: the directions weren&#x27;t super clear. I see that you&#x27;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&#x27;t have enough room to maneuver directly there.
评论 #34461415 未加载
评论 #34461644 未加载
mckeedover 2 years ago
I mapped out the structure of the board as a graph of which squares you can get to from which other squares. It&#x27;s surprisingly stringy without all the squares forbidden by the queen placement.<p><a href="https:&#x2F;&#x2F;i.imgur.com&#x2F;8OuQcu8.png" rel="nofollow">https:&#x2F;&#x2F;i.imgur.com&#x2F;8OuQcu8.png</a>
评论 #34464240 未加载
评论 #34462950 未加载
评论 #34464202 未加载
评论 #34463643 未加载
评论 #34462905 未加载
评论 #34463096 未加载
评论 #34464638 未加载
评论 #34463496 未加载
Trufaover 2 years ago
Ok, shameless plug. I did a pretty “popular” version of this.<p><a href="https:&#x2F;&#x2F;knight-queen-game.netlify.app&#x2F;" rel="nofollow">https:&#x2F;&#x2F;knight-queen-game.netlify.app&#x2F;</a>
评论 #34464622 未加载
评论 #34463284 未加载
评论 #34466724 未加载
评论 #34463915 未加载
dragontamerover 2 years ago
Hmm, a weird version of a Knight&#x27;s Tour.<p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Knight%27s_tour" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Knight%27s_tour</a><p>It seems like in this version &#x2F; webpage, you&#x27;re allowed to revisit squares however. It&#x27;d be nice if it highlighted what squares &quot;Counted&quot;, because the words are quite ambiguous. A graphical representation of what is being counted &#x2F; not counted would be very helpful.<p>----------------<p>EDIT: Ah, I got it. The location on the left is the next spot you&#x27;re supposed to go to. The puzzle is quite easy once I understood the interface.<p>The interface needs a &quot;Next square: h5&quot; or something. I really didn&#x27;t get it for the longest time.
greover 2 years ago
Here&#x27;s how many moves it takes to get everywhere from a middle square as the knight.<p><a href="https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;chess&#x2F;comments&#x2F;1x7t58&#x2F;visual_representation_of_the_number_of_moves_it&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;chess&#x2F;comments&#x2F;1x7t58&#x2F;visual_repres...</a>
cf100clunkover 2 years ago
<a href="https:&#x2F;&#x2F;www.azlyrics.com&#x2F;lyrics&#x2F;bobseger&#x2F;nightmoves.html" rel="nofollow">https:&#x2F;&#x2F;www.azlyrics.com&#x2F;lyrics&#x2F;bobseger&#x2F;nightmoves.html</a>
mdanielover 2 years ago
If you&#x27;d like &quot;easy mode,&quot; such that the queen&#x27;s squares are highlighted:<p><pre><code> ((sq) =&gt; { let board = document.querySelector(&#x27;div.m-auto&#x27;); sq.forEach(s =&gt; board.querySelector(&#x27;[data-squareid=&quot;&#x27;+s+&#x27;&quot;]&#x27;).style.backgroundColor=&#x27;red&#x27;); })([&quot;d8&quot;, &quot;d7&quot;, &quot;d6&quot;, &quot;d4&quot;, &quot;d3&quot;, &quot;d2&quot;, &quot;d1&quot;, &quot;e6&quot;, &quot;f7&quot;, &quot;g8&quot;, &quot;c6&quot;, &quot;b7&quot;, &quot;a8&quot;, &quot;c5&quot;, &quot;b5&quot;, &quot;a5&quot;, &quot;e5&quot;, &quot;f5&quot;, &quot;g5&quot;, &quot;h5&quot;, &quot;c4&quot;, &quot;b3&quot;, &quot;a2&quot;, &quot;e4&quot;, &quot;f3&quot;, &quot;g2&quot;, &quot;h1&quot;]) </code></pre> I found that to be the middle ground between &quot;you still have to plan&quot; versus the amount of energy I was spending trying keep track of the forbidden squares
评论 #34466087 未加载
评论 #34466031 未加载
nick0garveyover 2 years ago
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.
voreover 2 years ago
I wish it could keep track of where the knight has already been.
评论 #34461334 未加载
评论 #34461509 未加载
评论 #34461965 未加载
darepublicover 2 years ago
The play on the Seger lyrics &quot;night moves&quot; with a chess knight was done earlier in an old ytmnd I remember
y-curiousover 2 years ago
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!
评论 #34462532 未加载
评论 #34461422 未加载
xiphias2over 2 years ago
How does the knight move?<p><a href="https:&#x2F;&#x2F;youtu.be&#x2F;5lZEt6oz5MQ" rel="nofollow">https:&#x2F;&#x2F;youtu.be&#x2F;5lZEt6oz5MQ</a><p><a href="https:&#x2F;&#x2F;youtu.be&#x2F;wfDCLEAU9hE" rel="nofollow">https:&#x2F;&#x2F;youtu.be&#x2F;wfDCLEAU9hE</a>
kjgkjhfkjfover 2 years ago
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.
hughdbrownover 2 years ago
Shortest path solution using breadth-first search<p><a href="https:&#x2F;&#x2F;gist.github.com&#x2F;hughdbrown&#x2F;5c14ec41c30532807afaeba9c16789a8" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;hughdbrown&#x2F;5c14ec41c30532807afaeba9c...</a><p>Same result as the solver below:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;rubenvannieuwpoort&#x2F;funnyhowtheknightmoves_solver">https:&#x2F;&#x2F;github.com&#x2F;rubenvannieuwpoort&#x2F;funnyhowtheknightmoves...</a><p>except for this path:<p>a3 c2 e3 g4 h2<p>a3 c2 e3 f1 h2
4by4by4over 2 years ago
As a teenager I had a chess lesson with Ben Finegold and I practiced this puzzle for weeks on a physical board.<p>He also mentioned this riddle off hand which I had a ton of fun solving. <a href="https:&#x2F;&#x2F;fivethirtyeight.com&#x2F;features&#x2F;how-about-a-nice-game-of-chess&#x2F;" rel="nofollow">https:&#x2F;&#x2F;fivethirtyeight.com&#x2F;features&#x2F;how-about-a-nice-game-o...</a>
评论 #34464003 未加载
sebzim4500over 2 years ago
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.
TheRealPomaxover 2 years ago
This has terrible instructions.
Scubabear68over 2 years ago
..<p>When you just don&#x27;t seem to have as much to lose?<p>Strange how the night moves.<p>With autumn closin&#x27; in.
评论 #34462079 未加载
salvipeterover 2 years ago
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: <a href="http:&#x2F;&#x2F;directory.iit.bme.hu&#x2F;~salvi&#x2F;archive&#x2F;snippets&#x2F;knight&#x2F;knight-46.pdf" rel="nofollow">http:&#x2F;&#x2F;directory.iit.bme.hu&#x2F;~salvi&#x2F;archive&#x2F;snippets&#x2F;knight&#x2F;k...</a>
rustyboltover 2 years ago
Felt like writing a solver for it: <a href="https:&#x2F;&#x2F;github.com&#x2F;rubenvannieuwpoort&#x2F;funnyhowtheknightmoves_solver">https:&#x2F;&#x2F;github.com&#x2F;rubenvannieuwpoort&#x2F;funnyhowtheknightmoves...</a>
评论 #34469853 未加载
logicalleeover 2 years ago
For me the instructions are pretty clear: every square &quot;right to left, top to bottom&quot; - 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.)<p>I gave up after 4 minutes. It&#x27;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.<p>for anyone who did it to completion, how long did it take? did you speed up by the end?
评论 #34462571 未加载
monroewalkerover 2 years ago
So many unnecessarily negative comments.. I enjoyed this, thank you for making it
raydiatianover 2 years ago
The design for this app is atrocious for anybody who has played online chess.<p>“This is a valid move. This is a valid move.”<p><i>reads rules</i>.<p>“They couldn’t paint one measly Queen black? Exit”<p>You know if you know. The queen is white. I’m going to occupy the diagonal.
hardwaregeekover 2 years ago
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
评论 #34464220 未加载
xg15over 2 years ago
Instead of just giving the next square you&#x27;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 &quot;gotta catch em all&quot; effect)<p>Edit: ... or maybe not: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=34461415" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=34461415</a>
评论 #34465772 未加载
luxuryballsover 2 years ago
<i>clicks help</i><p>ha ha I’m not doing that
评论 #34465136 未加载
GistNoesisover 2 years ago
Inspired by some other comments here, I added a way to help visualize the graph (see screenshot and code) : <a href="https:&#x2F;&#x2F;gist.github.com&#x2F;unrealwill&#x2F;07069676a577f6dfbc35553696869798" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;unrealwill&#x2F;07069676a577f6dfbc3555369...</a><p>Once you can visualize the knights graph in your head, you just have to run Dijsktra in your head.
curiousllamaover 2 years ago
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”?
评论 #34463896 未加载
评论 #34461898 未加载
jpmoralover 2 years ago
Nice challenge. Can someone help me understand why other posters want highlighting for visited squares?
评论 #34461811 未加载
sireatover 2 years ago
Good exercise! 5:29 on the first try (FM),<p>3:27 on 2nd try once I realized we have to move the knight to non attacked squares from top right to left bottom<p>At first I thought I had to implement the knights walk by myself so wasted about 30 seconds on understanding the instructions.
tmtvlover 2 years ago
Instructions unclear, reread <i>Through the Looking-Glass, and What Alice Found There</i>.
whstlover 2 years ago
This reminds me of one of the final puzzles in the 90s aventure game Gabriel Knight:<p><a href="https:&#x2F;&#x2F;youtu.be&#x2F;fPByLdCYPpo?t=33989" rel="nofollow">https:&#x2F;&#x2F;youtu.be&#x2F;fPByLdCYPpo?t=33989</a><p>(spoiler alert, it&#x27;s the last part)
thenerdheadover 2 years ago
Workin&#x27; on our knight moves.<p>Tryin&#x27; to make some front page hacker news.<p>Workin&#x27; on our knight moves.
travisjungrothover 2 years ago
In case anyone else goes nuts trying to write a program for a knight&#x27;s tour with the additional queen constraint from this game: you can&#x27;t get to B7. Obvious if you actually look at the board.
评论 #34464401 未加载
heroiccocoaover 2 years ago
<a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=SrQlpY_eGYU">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=SrQlpY_eGYU</a><p>It&#x27;s not meant to be easy, I&#x27;m 1800 bullet on lichess and struggling
TurkishPoptartover 2 years ago
How to get it to C8? Gah!
评论 #34461725 未加载
评论 #34461371 未加载
bfungover 2 years ago
Tangent, but more meme marketing name suggestion: how does the knight move?<p><a href="https:&#x2F;&#x2F;youtu.be&#x2F;wfDCLEAU9hE" rel="nofollow">https:&#x2F;&#x2F;youtu.be&#x2F;wfDCLEAU9hE</a>
cochleari_majorover 2 years ago
Here is one possible solution using fewest moves (I think) <a href="https:&#x2F;&#x2F;tinyurl.com&#x2F;noitaint" rel="nofollow">https:&#x2F;&#x2F;tinyurl.com&#x2F;noitaint</a>
dan-robertsonover 2 years ago
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.
chedokuover 2 years ago
if you like this chess puzzle, you may be interested in <a href="https:&#x2F;&#x2F;chedoku.com&#x2F;#dailypuzzle" rel="nofollow">https:&#x2F;&#x2F;chedoku.com&#x2F;#dailypuzzle</a><p>Here is a video of me solving the puzzle: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=ZrCxZkZDskc">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=ZrCxZkZDskc</a>
amriksohataover 2 years ago
All taken from the original Indian game of chess, where the Knight was the Elephant and had certain moves it could make.
chadlaviover 2 years ago
I didn&#x27;t read the instructions at first and was confused why it wouldn&#x27;t let me take the queen
bjt2n3904over 2 years ago
A really clever puzzle, UI issues aside. Reminds me of programming the knights tour back in college.
jslakroover 2 years ago
Knight movements on chess always makes me think in the glider on Conway&#x27;s game of life
phnofiveover 2 years ago
High score: 2:44 to scroll down and realize what in the heck I was supposed to be doing
aoeusnth1over 2 years ago
I did this and now my brain is humming and my blood pumping. Thanks.
soperjover 2 years ago
I feel like I wasted 18:40 seconds.
moglitoover 2 years ago
No leaderboard? Finished in 8:41.
mabboover 2 years ago
Well that took me 28 minutes.<p>I love it.
antiheroover 2 years ago
This is the most boring game ever and I’m not sure why anyone would play it.
评论 #34463206 未加载
etothepiiover 2 years ago
22:04