### Communities

tag:snake search within a tag
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
created:<1w created < 1 week ago
post_type:xxxx type of post
Challenges

# Pinwheel ​words

+2
−0

Given a word that can be rotated by 180 degrees (a half turn) about at least one of its 3 axes and continue to be composed of English alphabet letters, output one of its rotated forms.

The 3 rotation types will be given the challenge-specific names clock, mirror, and lake rotations. They have more elaborate names and variations on the Ambigram Wikipedia page but those will not be used here.

# Terminology

The result of a given rotation type will not necessarily be an English word, but the letters always remain English alphabet letters. If a rotation type on a letter does not give an English alphabet letter result, that rotation type cannot be applied to a word containing that letter.

A clock rotation is a half turn about the z axis (the line of sight into the page). This can be seen by rotating a printed page (or a screen) by 180 degrees without changing which side is facing you.

• pod becomes pod (it is unchanged)
• pow becomes mod

A mirror rotation is a half turn about the y axis (the vertical). This looks equivalent to the reflection seen by holding a mirror to the left or right of the word.

• dob becomes dob (it is unchanged)
• mod becomes bom

A lake rotation is a half turn about the x axis (the horizontal). This looks equivalent to the reflection seen by holding a mirror above or below the word.

• DOB becomes DOB (it is unchanged)
• Wolf becomes Molt

Since we are looking at a 2 dimensional page, these last 2 look like reflections, hence the chosen names.

# Letter rotations

The decision on which letters can be rotated in which ways is fairly arbitrary and font-dependent. For this challenge only the rotations listed are valid. Any letter not listed under a given rotation type cannot be rotated in that way.

Rotations are shown in the format before : after.

### Clock rotations

H : H
I : I
M : W
N : N
O : O
S : S
W : M
X : X
Z : Z
b : q
d : p
h : y
l : l
m : w
n : u
o : o
p : d
q : b
s : s
u : n
w : m
x : x
y : h
z : z


### Mirror rotations

A : A
H : H
I : I
M : M
O : O
T : T
U : U
V : V
W : W
X : X
Y : Y
b : d
d : b
i : i
l : l
m : m
o : o
p : q
q : p
v : v
w : w
x : x


### Lake rotations

B : B
C : C
D : D
E : E
H : H
I : I
K : K
M : W
O : O
W : M
X : X
b : p
c : c
d : q
f : t
l : l
m : w
o : o
p : b
q : d
t : f
w : m
x : x


# Input

• A sequence of letters, referred to as a word
• This may be a string or any ordered data structure of characters
• The word may contain both upper and lower case letters
• The word will contain at least 1 letter (it will not be empty)
• The word will be rotatable by at least 1 of the 3 rotation types
• It will never contain a letter that is not one of the "before" letters listed under "Letter rotations" above. For example, the word will never contain a lower case "a"
• It will never be a combination of letters that are individually rotatable, but not all rotatable by a single rotation type. For example, the word will never be "HABIT", because "A" is not clock or lake rotatable, and "B" is not mirror rotatable

# Output

• A sequence of letters, referred to as a rotated word
• This may be a string or any ordered data structure of characters. It does not need to match the input format (provided it is consistent between inputs)
• For example, you may take input as an array of characters, and output as a string, provided this format does not change for different inputs
• The rotated word must be a valid rotation of the input word
• If more than one of the rotation types is valid for the input word, any 1 of them gives a valid output (but you must output only a single word, not all valid words)
• More than 1 rotation type may be applied provided each is valid, but no more than 1 is required - you may choose how many different rotations to apply to reach the output
• Each rotation type may be applied a maximum of once
• For example, you may apply a clock rotation followed by a lake rotation, but you must not apply a clock rotation twice
• The output may be identical to the input provided there is a rotation type or combination of rotation types that gives a rotated word that is identical to the input word
• It is not just the individual letters that must be modified:
• For a clock or mirror rotation, the individual letters will each be modified and their order will be reversed
• For a lake rotation, the individual letters will each be modified but their order will remain unchanged

# Test cases

You must only output a single rotated word for a given input word. Where more than one valid rotated word is listed, you may choose any one of them to output.

Test cases are in the format "input word" : ["valid", "rotated", "words"]

"HIDE" : ["HIDE"]
"CHEM" : ["CHEW"]
"COM" : ["COW"]
"DEWI" : ["DEMI"]
"MAY" : ["YAM"]
"MEEK" : ["WEEK"]
"MICK" : ["WICK"]
"MIT" : ["TIM"]
"MON" : ["NOW"]
"MONS" : ["SNOW"]
"MOOD" : ["WOOD"]
"NIM" : ["WIN"]
"OAT" : ["TAO"]
"OHM" : ["WHO", "MHO", "OHW", "OHM"]
"OWT" : ["TWO"]
"SNOW" : ["MONS"]
"TAO" : ["OAT"]
"TIM" : ["MIT"]
"TWO" : ["OWT"]
"WAY" : ["YAW"]
"WEEK" : ["MEEK"]
"WHO" : ["OHM", "OHW", "MHO", "WHO"]
"WICK" : ["MICK"]
"WIN" : ["NIM"]
"WOE" : ["MOE"]
"WOOD" : ["MOOD"]
"YAW" : ["WAY"]
"bib" : ["did"]
"blob" : ["qolq", "dold", "plop", "blob"]
"blow" : ["molq", "wold", "plom", "blow"]
"Bob" : ["Bop"]
"bom" : ["woq", "mod", "pow", "bom"]
"bool" : ["looq", "lood", "pool", "bool"]
"boom" : ["wooq", "mood", "poow", "boom"]
"Bop" : ["Bob"]
"box" : ["xoq", "xod", "pox", "box"]
"Cob" : ["Cop"]
"cob" : ["cop"]
"did" : ["bib"]
"dooms" : ["swoop"]
"fob" : ["top"]
"fool" : ["tool"]
"HEM" : ["HEW"]
"HEW" : ["HEM"]
"hold" : ["ploy"]
"loom" : ["wool", "mool", "loow", "loom"]
"MIA" : ["AIM"]
"mod" : ["pow", "bom", "woq", "mod"]
"mold" : ["plow", "blom", "wolq", "mold"]
"molt" : ["wolf"]
"mood" : ["poow", "boom", "wooq", "mood"]
"moot" : ["woof"]
"owns" : ["sumo"]
"plop" : ["dold", "qolq", "blob", "plop"]
"plow" : ["mold", "wolq", "blom", "plow"]
"ploy" : ["hold"]
"pow" : ["mod", "woq", "bom", "pow"]
"pox" : ["xod", "xoq", "box", "pox"]
"sumo" : ["owns"]
"swoop" : ["dooms"]
"tool" : ["fool"]
"top" : ["fob"]
"wold" : ["plom", "blow", "molq", "wold"]
"wolf" : ["molt"]
"woof" : ["moot"]
"wool" : ["loom", "loow", "mool", "wool"]
"HIMNOSWXZbdhlmnopqsuwxyz" : ["zhxmnsbdouwlypqZXMSONWIH"]
"AHIMOTUVWXYbdilmopqvwx" : ["xwvpqomlibdYXWVUTOMIHA"]
"BCDEHIKMOWXbcdflmopqtwx" : ["BCDEHIKWOMXpcqtlwobdfmx"]
"pmXWbMwdoHIlqOx" : ["xOblIHopmWqMXwd", "xOplIHobwMdWXmq", "bwXMpWmqoHIldOx", "pmXWbMwdoHIlqOx"]


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

Why does this post require moderator attention?
Why should this post be closed?