+
+
Knights Exchange Puzzle
+ Classic
+
+
+ Can the black and white knights swap places using legal chess moves? Move knights by clicking on them, then clicking on a valid destination.
+
+
-
-
Game Status
-
-
Moves: {moveCount}
-
Status: {isComplete ? "🎉 Solved!" : "🎯 In Progress"}
-
-
+ {/* Blue: Number of moves */}
+
+ Moves:
+ {moveCount}
+
-
-
How to Play
-
- - • Click on a knight to select it
- - • Valid moves will be highlighted
- - • Click on a highlighted square to move
- - • Goal: Swap white and black knights
- - • Knights move in an L-shape (like in chess)
-
-
+ {/* Orange: Status (without heading) */}
+
+
+ {isComplete ? "🎉 Puzzle Solved!" : "🎯 In Progress"}
+
+
-
-
Initial Position
-
- {initialBoard.map((row, rowIndex) =>
- row.map((piece, colIndex) => (
-
- {piece === 'white' ? '♘' : piece === 'black' ? '♞' : ''}
-
- ))
- )}
-
-
-
-
-
Target Position
-
- {targetBoard.map((row, rowIndex) =>
- row.map((piece, colIndex) => (
-
- {piece === 'white' ? '♘' : piece === 'black' ? '♞' : ''}
-
- ))
- )}
-
-
-
- {/* Attribution */}
-
+
+ {/* Purple: Initial and Target positions side by side */}
+
+
+
+ Initial Position
+
+
+
+ {initialBoard.map((row, rowIndex) =>
+ row.map((piece, colIndex) => (
+
+ {piece === 'white' ? '♘' : piece === 'black' ? '♞' : ''}
+
+ ))
+ )}
+
+
+
+
+
+
+ Target Position
+
+
+
+ {targetBoard.map((row, rowIndex) =>
+ row.map((piece, colIndex) => (
+
+ {piece === 'white' ? '♘' : piece === 'black' ? '♞' : ''}
+
+ ))
+ )}
+
+
+
+
+
+ {/* Red: Game rules */}
+
+
+ How to Play
+
+
+
+ - • Click on a knight to select it
+ - • Valid moves will be highlighted
+ - • Click on a highlighted square to move
+ - • Goal: Swap white and black knights
+ - • Knights move in an L-shape (like in chess)
+
+
+
+
+ {/* Attribution */}
+