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.
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.
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.
// 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.';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.
Maybe throw a little highlight on the square on the board as well.
"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.
Yeah I spent a lot of time trying to hit every square.
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.
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)
It should definitely have some visual tutorial for people to understand how it works though.
The history of a pieces moves is irrelevant to chess, except in extreme corner cases of repetition.
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.
Based on the graph, I also found an optimal route through the whole board: https://gist.github.com/unflxw/b4d21c55c137a9a42fba75bd0cf98...
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.
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
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.
https://www.reddit.com/r/chess/comments/1x7t58/visual_repres...
((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(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-tele...
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
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...
[1] https://fivethirtyeight.com/features/can-you-survive-this-de...
> 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.
When you just don't seem to have as much to lose?
Strange how the night moves.
With autumn closin' in.
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."
abs(x - 4) != abs(y - 3)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?
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.
“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.
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:
Was much, much easier to complete once I could see a map of the board.
Edit: ... or maybe not: https://news.ycombinator.com/item?id=34461415
ha ha I’m not doing that
Once you can visualize the knights graph in your head, you just have to run Dijsktra in your head.
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.
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.
https://youtu.be/fPByLdCYPpo?t=33989
(spoiler alert, it's the last part)
Tryin' to make some front page hacker news.
Workin' on our knight moves.
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 :)
It's not meant to be easy, I'm 1800 bullet on lichess and struggling
Here is a video of me solving the puzzle: https://www.youtube.com/watch?v=ZrCxZkZDskc
I love it.