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 »
Challenges

Post History

60%
+1 −0
Challenges 5 by 5 knight's tour string validator

Uiua, 27 bytes* Function definition. Takes string as argument, returns 0/1 for false/true. ≍♭1◴⧈(≍⇡₁2⍆⌵-)⍉⊟⊃◿₅(⌊÷₅)-@A Uiua pad this online *: assuming a single-byte coding scheme (SBCS) is a...

posted 4mo ago by ojdo‭

Answer
#1: Initial revision by user avatar ojdo‭ · 2026-06-01T11:00:27Z (4 months ago)
# [Uiua][uiua], 27 bytes*

Function definition. Takes string as argument, returns 0/1 for false/true.

```uiua
≍♭1◴⧈(≍⇡₁2⍆⌵-)⍉⊟⊃◿₅(⌊÷₅)-@A
```

[Uiua pad this online][pad]

*: assuming a single-byte coding scheme (SBCS) is acceptable.


## Explanation

```uiua
≍♭1◴⧈(≍⇡₁2⍆⌵-)⍉⊟⊃◿₅(⌊÷₅)-@A
                         -@A subtract letter 'A' to yield numeric
                             alphabet positions [0-24]
                 ⊃           fork both
                  ◿₅          x and
                    (⌊÷₅)     y coordinate calculations
                             which yields two 1-dimensional arrays
                ⊟            coupled to a wide 2xN array and
               ⍉            transposed to a tall Nx2 array of [x y] rows
    ⧈(       )               stencil to operate on row pairs
            -                 calculate differences
           ⌵                  drop any negative signs
          ⍆                   sort coordinate pair ascending
      ≍⇡₁2                    compare against the only good [1 2] pair
                             which yields an array of matches
   ◴                         deduplicate the matches
≍♭1                          and compare against the array [1]
```

[uiua]: https://uiua.org/
[pad]: https://uiua.org/pad?src=0_19_0-dev_4__eJx1zT1OwzAYxvG9p4gytUMlyglw_JX4K3biJPZxCGohUSOxVZ0QUiUmNhAjAzd5T4K6tUSMj_TT_2EJ7J4TGCY4vm_g8AFvT8vzenyF_v4Wph3sP9crmAYYX2B8gMM39Nsl7MefL-i3q_UdWsB0gtMRhinZJCxJtcDMhZJw2_kik22dUxOrRqH0r0SqqaKhed3KrPCd5aQMjmGhL-XNWV51Lg9m8p8iUjOpikzYzmDm2zpHZVNxooOLks6kYYRXUdLcBSuw6nyByqZudTaTVZnLlvhCNTgabrOgRU075NhM5rRDqhYhk1VJWuYMjoXXljfp4hdNEZzO