18
1
Y'know, we've had a lot of "alphabet" challenges recently. (one two three four five.) While I love a good challenge, and those challenges were very fun, I think it's time for a change of pace. We need to exclude such challenges in the future. It's time for automation!
You're going to find some alphabets for me, and for automation (and for glory!) Alphabets are tricky and like to disguise themselves.[citation-needed] You'll need to account for the following factors:
- Alphabets can be uppercase or lowercase (but not both). So, you need to look for
ABCDEFGHIJKLMNOPQRSTUVWXYZ
andabcdefghijklmnopqrstuvwxyz
, but notAbCdeFGhIJkLmNOpQRsTuvwxyZ
. That is, only look for alphabets that are composed of entirely one case. - Alphabets can shift around. they may not always start with
A
, but instead may start withG
orU
. So you'll have to look for things likeOPQRSTUVWXYZABCDEFGHIJKLMN
. - Alphabets may not always read forwards. They can also read backwards, up, and down. E.g.,
ZYXWVUTSRQPONMLKJIHGFEDCBA
is also a valid alphabet.
Here's an example of a string that has an alphabet:
JIHGFEDCBAZYXWVUTSRQPONMLK
This is a backwards-oriented, shifted alphabet:
JIHGFEDCBAZYXWVUTSRQPONMLK
<--------|<---------------
This also contains an alphabet:
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
A
B
C
D
E
it's a down-oriented alphabet:
F |
G |
H |
I |
J |
K |
L |
M |
N |
O |
P |
Q |
R |
S |
T |
U |
V |
W |
X |
Y |
Z V
A===
B |
C |
D |
E V
Your challenge is to write a program, function, etc. that, given a string, outputs/returns a truthy value if the string contains at least one alphabet, or a falsey value otherwise. This is a code-golf, so the shortest program in bytes wins.
Test cases
Truthy
ABCDEFGHIJKLMNOPQRSTUVWXYZ
abcdefghijklmnopqrstuvwxyz
ABCDEFGHIJKLMNOPQRSTUVWXYabcdefghijklmnopqrstuvwxyz
ZABCDEFGHIJKLMNOPQRSTUVWXYghijklmnopqrstuvwxyzabcdef
ZBCDEFGHIJghijklmnopqrstuvwxyzabcdef
AAAAAAAA
BBBBBBBB
CCCCCCCC
DDDDDDDD
EEEEEEEE
FFFFFFFF
GGGGGGGG
HHHHHHHH
IIIIIIII
JJJJJJJJ
KKKKKKKK
LLLLLLLL
MMMMMMMM
NNNNNNNN
OOOOOOOO
PPPPPPPP
QQQQQQQQ
RRRRRRRR
SSSSSSSS
TTTTTTTT
UUUUUUUU
VVVVVVVV
WWWWWWWW
XXXXXXXX
YYYYYYYY
ZZZZZZZZ
J54
Igeh
H
G
Fzx6
E
Dv
Cvzxc
Bs
Adf
Z
@Yascvf
Xsf
W
Vfas
Uw
Te
~S
R
Qasdfasdf
P
O
N
M
LMNOPQR
K
Falsey
Hello, World!
KLMNOPQRSTUVWXYZABCDEF
K ZYXW
L V
M U
N T
O S
P R
Q
A
BCDEFGHIJKLMNOPQRSTUVWXYZ
ABCDEFGHIJKLmnopqrstuvwxyz
16"I'm sick of alphabet challenges. Here's an alphabet challenge." lol +1 – AdmBorkBork – 2016-08-09T20:26:35.470
Can we have the input be padded with spaces to form a rectangle? :3 – Downgoat – 2016-08-09T21:18:01.790
@Downgoat Yes, you can. – Conor O'Brien – 2016-08-09T21:20:26.070
Another challenge to add to your collection. – Leaky Nun – 2016-08-09T23:29:47.650
1Can we take a 2D array of strings? Each row would be a line, right-padded with spaces to form a rectangle – Luis Mendo – 2016-08-10T00:43:18.670
@LuisMendo Sure. – Conor O'Brien – 2016-08-10T00:59:56.040