Image

Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Sandbox

Shortest knight's sightseeing tour

+0
−0

Find a closed knight's sightseeing tour[1] of a 61 by 61 board. Shortest wins.

Definitions

  • A square is visible from another square if it is a knight's move away from it.
  • A closed knight's sightseeing tour is a sequence of distinct squares on a chequerboard that satisfies all of the following:
    • Each consecutive pair of squares is a knight's move apart. That is, the pair of squares is one of:
      • Differing by 1 row and 2 columns.
      • Differing by 2 rows and 1 column.
    • The first and last squares are also a knight's move apart (the tour is closed).
    • To be a sightseeing tour, every square on the board must be visible from the tour. So every square on the board must be a knight's move away from at least 1 square in the tour.

Input

  • There is no input for this challenge.

Output

  • A closed knight's sightseeing tour of a 61 by 61 chequerboard.
  • You may hardcode some or all of your output if you wish.
  • To keep tour descriptions short, the following format is used:
    • Each square is represented by 2 characters, 1 for the horizontal position and 1 for the vertical position.
    • Positions are labelled using 61 characters (non-zero numbers and upper and lower case letters) in the following order:
      123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
      
    • The squares are listed with no punctuation or whitespace between their characters or between the squares.
    • The tour is displayed in a code block so that it stays on one line and can be easily copied and pasted for validation.

Scoring

Your score is the number of squares in the shortest tour your code finds. Lowest score wins.

Validation

You can paste your tour, or the tour from another answer, into the [validator webpage]( TODO ). This will either confirm that it is valid, and give the score and a visualisation, or indicate why it is not valid (a break in the tour, a revisited square, or a square not visible from the tour).

Answer format

The automated leaderboard will pick up the name of the programming language used and the score from the heading of your answer. It will also show the beginning of the first code block in your answer. You can show previous scores as you make improvements. The last score listed in the heading will be shown in the leaderboard.

Example answer format

Note the comma between the language name and the scores.

## Python, ~~3720~~ ~~3718~~ 3716 squares

### Code
```python
def find_short_tour():
    pass
```

### Tour
```txt
11325374...
```

[![Image from the validator](http://example.com)](http://example.com)
(Image can be opened full size for ease of zooming.)

### Explanation
Python is ideal for finding snaking paths because...

Explanations are optional, but I'm more likely to upvote answers that have one.

Sandbox questions

  • Is there a trivial modular or constructive approach to generating a minimal sightseeing tour that would make this challenge uninteresting?
  • Is 61 by 61 too big or too small?
  • An alternative notation would be a number from 1 to 8 to indicate the direction of the move, rather than specifying the coordinates of every square in the tour. This would allow expressing a tour in half the characters (plus the coordinates of the initial square). This would also remove the dependency on letters for notation, allowing the decision on board size to be independent of that. Would this be better?
    • The specification of the initial square is not strictly necessary. Given a string of digits 1 to 8, the path can be constructed, and it can then be tested at all the positions it can fit on the board, of which there will be at most 15 (if the path is a valid sightseeing tour). The validator can check all of these and output the appropriate image if valid, or the problems with the position with fewest problems otherwise.

  1. I previously defined this term in a puzzle called A knight's sightseeing tour. This contains hidden spoilers in the answers showing examples on an 8 by 8 board. This challenge is self contained so it is not required to read the puzzle before attempting it. ↩︎

History

1 comment thread

I think this would be more interesting as an asymptotic rather than on a fixed size. However, asking ... (2 comments)