Solving “Knight Moves 6” (Jane Street Puzzle, October 2024)
A Random Search for Two Knight Trips Worth 2024 Points


The Puzzle
This puzzle is straightforward. As explained on the webpage, a 6x6 chessboard has squares labeled from A to C, corresponding to positive integers. The puzzle is solved by assigning values to A, B, and C and creating two corner-to-corner trips using knight’s moves so that each trip scores 2024. The method to calculate the score is: a trip starts with A points; then (a) moving between two different integers multiplies the score by the value the knight is moving to, and (b) moving between two identical integers increments the score by the value the knight is moving to. Last constraint: a square can only be visited once per trip (but a square does not necessarily have to be visited).
The official webpage distinguishes between optimal trips and trips which, while not optimal, are qualifying (i.e., A + B + C < 50).
The Solver
To solve the puzzle, I developed a solver that generates random legal knight moves for each trip. The solver also produces combinations of ABC values that satisfy the constraint A + B + C < 50. It calculates the score corresponding to each combination of values for each path. When a score equals 2024, the solver verifies whether an opposing trip exists with the same values and score. If not, the trip is retained in memory until an opposing trip is found with the same values. However, if an opposing trip does exist, the two trips are evaluated against the global best score. If the total score is the lowest recorded, the combination of possible values is updated to ensure that their sum cannot exceed the best sum during the next exploration, thereby facilitating a rapid convergence toward the optimal solution.
Results
The best values give the minimal sum, 6 (A: 1, B: 3, C: 2): A, B and C are distinct positive integers, so their sum cannot be lower than 1 + 2 + 3. For these values, the shortest pair of trips that the solver found visits 30 squares, 15 per trip, as in this example, rendered by the solver:
Play a trip, move by move
Moving to a different value multiplies the score by it; moving to the same value adds it. Solid line, round marks: a1 → f6. Dashed line, square marks: a6 → f1.
The solver has also identified several other solutions, with larger sums or longer trips, as depicted below:
| A | B | C | Sum | Squares of the two trips | What it shows |
|---|---|---|---|---|---|
| 1 | 3 | 2 | 6 | 15 + 15 = 30 | Minimal sum, shortest pair found (above) |
| 3 | 1 | 2 | 6 | 21 + 27 = 48 | Minimal sum with other values, longer trips |
| 6 | 1 | 2 | 9 | 15 + 15 = 30 | Same length, larger sum |
| 2 | 1 | 8 | 11 | 19 + 23 = 42 | |
| 2 | 1 | 22 | 25 | 9 + 11 = 20 | Short trips need a large C |
| 3 | 2 | 44 | 49 | 11 + 9 = 20 | Just under the limit of 50 |











