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

Post History

50%
+0 −0
Sandbox Pinwheel ​words [FINALIZED]

posted 2y ago by trichoplax‭  ·  edited 2y ago by trichoplax‭

#14: Post edited by user avatar trichoplax‭ · 2022-10-23T05:03:44Z (about 2 years ago)
Mark as finalized
  • Pinwheel ​words
  • Pinwheel ​words [FINALIZED]
  • 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](https://en.wikipedia.org/wiki/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.
  • </details>
  • # 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
  • ```text
  • 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
  • ```text
  • 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
  • ```text
  • 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
  • </details>
  • # 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"]`
  • ```text
  • "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.
  • # Now posted: [Pinwheel words](https://codegolf.codidact.com/posts/287299)
  • ---
  • 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](https://en.wikipedia.org/wiki/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.
  • </details>
  • # 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
  • ```text
  • 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
  • ```text
  • 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
  • ```text
  • 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
  • </details>
  • # 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"]`
  • ```text
  • "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.
#13: Post edited by user avatar trichoplax‭ · 2022-10-23T05:00:37Z (about 2 years ago)
Finalise test cases
  • 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](https://en.wikipedia.org/wiki/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.
  • </details>
  • # 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
  • ```text
  • 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
  • ```text
  • 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
  • ```text
  • 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
  • </details>
  • # 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"]`
  • ```text
  • "HI" : ["HI", "IH"]
  • "HIDE" : ["HIDE"]
  • "SNOW" : ["MONS"]
  • "WAIT" : ["TIAW"]
  • "loft" : ["lotf"]
  • "MOW" : ["WOM", "MOW"]
  • "Moody" : ["hpooW"]
  • "loud" : ["pnol"]
  • "shoWy" : ["hMoys"]
  • ```
  • > Explanations are optional, but I'm more likely to upvote answers that have one.
  • 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](https://en.wikipedia.org/wiki/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.
  • </details>
  • # 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
  • ```text
  • 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
  • ```text
  • 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
  • ```text
  • 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
  • </details>
  • # 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"]`
  • ```text
  • "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.
#12: Post edited by user avatar trichoplax‭ · 2022-10-23T02:18:35Z (about 2 years ago)
Add extra rotation types for m and w to avoid inconsistency
  • 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](https://en.wikipedia.org/wiki/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.
  • </details>
  • # 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
  • ```text
  • 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
  • ```text
  • 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
  • o : o
  • p : q
  • q : p
  • v : v
  • w : w
  • x : x
  • ```
  • ### Lake rotations
  • ```text
  • 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
  • o : o
  • p : b
  • q : d
  • t : f
  • 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
  • </details>
  • # 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"]`
  • ```text
  • "HI" : ["HI", "IH"]
  • "HIDE" : ["HIDE"]
  • "SNOW" : ["MONS"]
  • "WAIT" : ["TIAW"]
  • "loft" : ["lotf"]
  • "MOW" : ["WOM", "MOW"]
  • "Moody" : ["hpooW"]
  • "loud" : ["pnol"]
  • "shoWy" : ["hMoys"]
  • ```
  • > Explanations are optional, but I'm more likely to upvote answers that have one.
  • 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](https://en.wikipedia.org/wiki/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.
  • </details>
  • # 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
  • ```text
  • 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
  • ```text
  • 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
  • ```text
  • 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
  • </details>
  • # 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"]`
  • ```text
  • "HI" : ["HI", "IH"]
  • "HIDE" : ["HIDE"]
  • "SNOW" : ["MONS"]
  • "WAIT" : ["TIAW"]
  • "loft" : ["lotf"]
  • "MOW" : ["WOM", "MOW"]
  • "Moody" : ["hpooW"]
  • "loud" : ["pnol"]
  • "shoWy" : ["hMoys"]
  • ```
  • > Explanations are optional, but I'm more likely to upvote answers that have one.
#11: Post edited by user avatar trichoplax‭ · 2022-10-22T10:08:42Z (about 2 years ago)
Mention that terms are challenge-specific
  • 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.
  • For this challenge, the 3 types will be called ***clock***, ***mirror***, and ***lake*** rotations. They have more elaborate names and variations on the [Ambigram](https://en.wikipedia.org/wiki/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.
  • </details>
  • # 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
  • ```text
  • 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
  • ```text
  • 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
  • o : o
  • p : q
  • q : p
  • v : v
  • w : w
  • x : x
  • ```
  • ### Lake rotations
  • ```text
  • 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
  • o : o
  • p : b
  • q : d
  • t : f
  • 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
  • </details>
  • # 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"]`
  • ```text
  • "HI" : ["HI", "IH"]
  • "HIDE" : ["HIDE"]
  • "SNOW" : ["MONS"]
  • "WAIT" : ["TIAW"]
  • "loft" : ["lotf"]
  • "MOW" : ["WOM", "MOW"]
  • "Moody" : ["hpooW"]
  • "loud" : ["pnol"]
  • "shoWy" : ["hMoys"]
  • ```
  • > Explanations are optional, but I'm more likely to upvote answers that have one.
  • 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](https://en.wikipedia.org/wiki/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.
  • </details>
  • # 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
  • ```text
  • 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
  • ```text
  • 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
  • o : o
  • p : q
  • q : p
  • v : v
  • w : w
  • x : x
  • ```
  • ### Lake rotations
  • ```text
  • 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
  • o : o
  • p : b
  • q : d
  • t : f
  • 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
  • </details>
  • # 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"]`
  • ```text
  • "HI" : ["HI", "IH"]
  • "HIDE" : ["HIDE"]
  • "SNOW" : ["MONS"]
  • "WAIT" : ["TIAW"]
  • "loft" : ["lotf"]
  • "MOW" : ["WOM", "MOW"]
  • "Moody" : ["hpooW"]
  • "loud" : ["pnol"]
  • "shoWy" : ["hMoys"]
  • ```
  • > Explanations are optional, but I'm more likely to upvote answers that have one.
#10: Post edited by user avatar trichoplax‭ · 2022-10-22T10:03:41Z (about 2 years ago)
Remove hidden sections
  • 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.
  • For this challenge, the 3 types will be called ***clock***, ***mirror***, and ***lake*** rotations. They have more elaborate names and variations on the [Ambigram](https://en.wikipedia.org/wiki/Ambigram) Wikipedia page but those will not be used here.
  • <details><summary>Terminology</summary>
  • 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.
  • </details>
  • <details><summary>Letter rotations</summary>
  • 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
  • ```text
  • 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
  • ```text
  • 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
  • o : o
  • p : q
  • q : p
  • v : v
  • w : w
  • x : x
  • ```
  • ### Lake rotations
  • ```text
  • 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
  • o : o
  • p : b
  • q : d
  • t : f
  • x : x
  • ```
  • </details>
  • <details><summary>Input</summary>
  • - 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
  • </details>
  • <details><summary>Output</summary>
  • - 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
  • </details>
  • <details><summary>Test cases</summary>
  • 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"]`
  • ```text
  • "HI" : ["HI", "IH"]
  • "HIDE" : ["HIDE"]
  • "SNOW" : ["MONS"]
  • "WAIT" : ["TIAW"]
  • "loft" : ["lotf"]
  • "MOW" : ["WOM", "MOW"]
  • "Moody" : ["hpooW"]
  • "loud" : ["pnol"]
  • "shoWy" : ["hMoys"]
  • ```
  • </details>
  • > Explanations are optional, but I'm more likely to upvote answers that have one.
  • ----
  • Alternative format without the expandable sections:
  • ----
  • 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.
  • For this challenge, the 3 types will be called ***clock***, ***mirror***, and ***lake*** rotations. They have more elaborate names and variations on the [Ambigram](https://en.wikipedia.org/wiki/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.
  • </details>
  • # 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
  • ```text
  • 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
  • ```text
  • 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
  • o : o
  • p : q
  • q : p
  • v : v
  • w : w
  • x : x
  • ```
  • ### Lake rotations
  • ```text
  • 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
  • o : o
  • p : b
  • q : d
  • t : f
  • 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
  • </details>
  • # 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"]`
  • ```text
  • "HI" : ["HI", "IH"]
  • "HIDE" : ["HIDE"]
  • "SNOW" : ["MONS"]
  • "WAIT" : ["TIAW"]
  • "loft" : ["lotf"]
  • "MOW" : ["WOM", "MOW"]
  • "Moody" : ["hpooW"]
  • "loud" : ["pnol"]
  • "shoWy" : ["hMoys"]
  • ```
  • > Explanations are optional, but I'm more likely to upvote answers that have one.
  • 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.
  • For this challenge, the 3 types will be called ***clock***, ***mirror***, and ***lake*** rotations. They have more elaborate names and variations on the [Ambigram](https://en.wikipedia.org/wiki/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.
  • </details>
  • # 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
  • ```text
  • 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
  • ```text
  • 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
  • o : o
  • p : q
  • q : p
  • v : v
  • w : w
  • x : x
  • ```
  • ### Lake rotations
  • ```text
  • 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
  • o : o
  • p : b
  • q : d
  • t : f
  • 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
  • </details>
  • # 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"]`
  • ```text
  • "HI" : ["HI", "IH"]
  • "HIDE" : ["HIDE"]
  • "SNOW" : ["MONS"]
  • "WAIT" : ["TIAW"]
  • "loft" : ["lotf"]
  • "MOW" : ["WOM", "MOW"]
  • "Moody" : ["hpooW"]
  • "loud" : ["pnol"]
  • "shoWy" : ["hMoys"]
  • ```
  • > Explanations are optional, but I'm more likely to upvote answers that have one.
#9: Post edited by user avatar trichoplax‭ · 2022-10-21T15:53:27Z (about 2 years ago)
Present collapsed html sections and plain markdown for comparison
  • 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.
  • For this challenge, the 3 types will be called ***clock***, ***mirror***, and ***lake*** rotations. They have more elaborate names and variations on the [Ambigram](https://en.wikipedia.org/wiki/Ambigram) Wikipedia page but those will not be used here.
  • <details><summary>Terminology</summary>
  • 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.
  • </details>
  • <details><summary>Letter rotations</summary>
  • 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
  • ```text
  • 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
  • ```text
  • 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
  • o : o
  • p : q
  • q : p
  • v : v
  • w : w
  • x : x
  • ```
  • ### Lake rotations
  • ```text
  • 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
  • o : o
  • p : b
  • q : d
  • t : f
  • x : x
  • ```
  • </details>
  • <details><summary>Input</summary>
  • - 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
  • </details>
  • <details><summary>Output</summary>
  • - 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
  • </details>
  • <details><summary>Test cases</summary>
  • 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"]`
  • ```text
  • "HI" : ["HI", "IH"]
  • "HIDE" : ["HIDE"]
  • "SNOW" : ["MONS"]
  • "WAIT" : ["TIAW"]
  • "loft" : ["lotf"]
  • "MOW" : ["WOM", "MOW"]
  • "Moody" : ["hpooW"]
  • "loud" : ["pnol"]
  • "shoWy" : ["hMoys"]
  • ```
  • </details>
  • > Explanations are optional, but I'm more likely to upvote answers that have one.
  • 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.
  • For this challenge, the 3 types will be called ***clock***, ***mirror***, and ***lake*** rotations. They have more elaborate names and variations on the [Ambigram](https://en.wikipedia.org/wiki/Ambigram) Wikipedia page but those will not be used here.
  • <details><summary>Terminology</summary>
  • 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.
  • </details>
  • <details><summary>Letter rotations</summary>
  • 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
  • ```text
  • 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
  • ```text
  • 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
  • o : o
  • p : q
  • q : p
  • v : v
  • w : w
  • x : x
  • ```
  • ### Lake rotations
  • ```text
  • 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
  • o : o
  • p : b
  • q : d
  • t : f
  • x : x
  • ```
  • </details>
  • <details><summary>Input</summary>
  • - 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
  • </details>
  • <details><summary>Output</summary>
  • - 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
  • </details>
  • <details><summary>Test cases</summary>
  • 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"]`
  • ```text
  • "HI" : ["HI", "IH"]
  • "HIDE" : ["HIDE"]
  • "SNOW" : ["MONS"]
  • "WAIT" : ["TIAW"]
  • "loft" : ["lotf"]
  • "MOW" : ["WOM", "MOW"]
  • "Moody" : ["hpooW"]
  • "loud" : ["pnol"]
  • "shoWy" : ["hMoys"]
  • ```
  • </details>
  • > Explanations are optional, but I'm more likely to upvote answers that have one.
  • ---
  • Alternative format without the expandable sections:
  • ---
  • 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.
  • For this challenge, the 3 types will be called ***clock***, ***mirror***, and ***lake*** rotations. They have more elaborate names and variations on the [Ambigram](https://en.wikipedia.org/wiki/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.
  • </details>
  • # 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
  • ```text
  • 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
  • ```text
  • 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
  • o : o
  • p : q
  • q : p
  • v : v
  • w : w
  • x : x
  • ```
  • ### Lake rotations
  • ```text
  • 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
  • o : o
  • p : b
  • q : d
  • t : f
  • 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
  • </details>
  • # 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"]`
  • ```text
  • "HI" : ["HI", "IH"]
  • "HIDE" : ["HIDE"]
  • "SNOW" : ["MONS"]
  • "WAIT" : ["TIAW"]
  • "loft" : ["lotf"]
  • "MOW" : ["WOM", "MOW"]
  • "Moody" : ["hpooW"]
  • "loud" : ["pnol"]
  • "shoWy" : ["hMoys"]
  • ```
  • > Explanations are optional, but I'm more likely to upvote answers that have one.
#8: Post edited by user avatar trichoplax‭ · 2022-10-18T23:53:04Z (about 2 years ago)
Experiment with hiding all sections
  • 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.
  • For this challenge, the 3 types will be called ***clock***, ***mirror***, and ***lake*** rotations. They have more elaborate names and variations on the [Ambigram](https://en.wikipedia.org/wiki/Ambigram) Wikipedia page but those will not be used here.
  • <details><summary>Terminology</summary>
  • 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.
  • </details>
  • <details><summary>Letter rotations</summary>
  • 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
  • ```text
  • 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
  • ```text
  • 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
  • o : o
  • p : q
  • q : p
  • v : v
  • w : w
  • x : x
  • ```
  • ### Lake rotations
  • ```text
  • 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
  • o : o
  • p : b
  • q : d
  • t : f
  • x : x
  • ```
  • </details>
  • ## 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"]`
  • ```text
  • "HI" : ["HI", "IH"]
  • "HIDE" : ["HIDE"]
  • "SNOW" : ["MONS"]
  • "WAIT" : ["TIAW"]
  • "loft" : ["lotf"]
  • "MOW" : ["WOM", "MOW"]
  • "Moody" : ["hpooW"]
  • "loud" : ["pnol"]
  • "shoWy" : ["hMoys"]
  • ```
  • > Explanations are optional, but I'm more likely to upvote answers that have one.
  • 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.
  • For this challenge, the 3 types will be called ***clock***, ***mirror***, and ***lake*** rotations. They have more elaborate names and variations on the [Ambigram](https://en.wikipedia.org/wiki/Ambigram) Wikipedia page but those will not be used here.
  • <details><summary>Terminology</summary>
  • 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.
  • </details>
  • <details><summary>Letter rotations</summary>
  • 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
  • ```text
  • 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
  • ```text
  • 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
  • o : o
  • p : q
  • q : p
  • v : v
  • w : w
  • x : x
  • ```
  • ### Lake rotations
  • ```text
  • 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
  • o : o
  • p : b
  • q : d
  • t : f
  • x : x
  • ```
  • </details>
  • <details><summary>Input</summary>
  • - 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
  • </details>
  • <details><summary>Output</summary>
  • - 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
  • </details>
  • <details><summary>Test cases</summary>
  • 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"]`
  • ```text
  • "HI" : ["HI", "IH"]
  • "HIDE" : ["HIDE"]
  • "SNOW" : ["MONS"]
  • "WAIT" : ["TIAW"]
  • "loft" : ["lotf"]
  • "MOW" : ["WOM", "MOW"]
  • "Moody" : ["hpooW"]
  • "loud" : ["pnol"]
  • "shoWy" : ["hMoys"]
  • ```
  • </details>
  • > Explanations are optional, but I'm more likely to upvote answers that have one.
#7: Post edited by user avatar trichoplax‭ · 2022-10-18T23:47:21Z (about 2 years ago)
Hide Terminology and Letter rotation sections, plus tidying
  • 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.
  • For this challenge, the 3 types will be called ***clock***, ***mirror***, and ***lake*** rotations. They have more elaborate names and variations on the [Ambigram](https://en.wikipedia.org/wiki/Ambigram) Wikipedia page but those will not be used here.
  • ## Terminology
  • *Note that the examples are not necessarily English words, 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).
  • - `pod` becomes `pod` (it is unchanged)
  • - `pow` becomes `mod`
  • A ***mirror rotation*** is a half turn about the y axis (the vertical).
  • - `dob` becomes `dob` (it is unchanged)
  • - `mod` becomes `bom`
  • A ***lake rotation*** is a half turn about the x axis (the horizontal).
  • - `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
  • ```text
  • 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
  • ```text
  • 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
  • o : o
  • p : q
  • q : p
  • v : v
  • w : w
  • x : x
  • ```
  • ### Lake rotations
  • ```text
  • 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
  • o : o
  • p : b
  • q : d
  • t : f
  • 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 not contain spaces, newlines, or punctuation - only letters
  • - The word will be rotatable by at least 1 of the 3 rotation types
  • - Specifically, this means 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
  • - Note that 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
  • Note that 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"]`
  • ```text
  • "HI" : ["HI", "IH"]
  • "HIDE" : ["HIDE"]
  • "SNOW" : ["MONS"]
  • "WAIT" : ["TIAW"]
  • "loft" : ["lotf"]
  • "MOW" : ["WOM", "MOW"]
  • "Moody" : ["hpooW"]
  • "loud" : ["pnol"]
  • "shoWy" : ["hMoys"]
  • ```
  • 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.
  • For this challenge, the 3 types will be called ***clock***, ***mirror***, and ***lake*** rotations. They have more elaborate names and variations on the [Ambigram](https://en.wikipedia.org/wiki/Ambigram) Wikipedia page but those will not be used here.
  • <details><summary>Terminology</summary>
  • 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.
  • </details>
  • <details><summary>Letter rotations</summary>
  • 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
  • ```text
  • 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
  • ```text
  • 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
  • o : o
  • p : q
  • q : p
  • v : v
  • w : w
  • x : x
  • ```
  • ### Lake rotations
  • ```text
  • 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
  • o : o
  • p : b
  • q : d
  • t : f
  • x : x
  • ```
  • </details>
  • ## 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"]`
  • ```text
  • "HI" : ["HI", "IH"]
  • "HIDE" : ["HIDE"]
  • "SNOW" : ["MONS"]
  • "WAIT" : ["TIAW"]
  • "loft" : ["lotf"]
  • "MOW" : ["WOM", "MOW"]
  • "Moody" : ["hpooW"]
  • "loud" : ["pnol"]
  • "shoWy" : ["hMoys"]
  • ```
  • > Explanations are optional, but I'm more likely to upvote answers that have one.
#6: Post edited by user avatar trichoplax‭ · 2022-10-18T23:17:44Z (about 2 years ago)
Clarity improvements
  • 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.
  • For this challenge, the 3 types will be called ***clock***, ***mirror***, and ***lake*** rotations. They have more elaborate names and variations on the [Ambigram](https://en.wikipedia.org/wiki/Ambigram) Wikipedia page but those will not be used here.
  • ## Terminology
  • *Note that the examples are not necessarily English words, 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).
  • - `pod` becomes `pod` (it is unchanged)
  • - `pob` becomes `qod`
  • A ***mirror rotation*** is a half turn about the y axis (the vertical).
  • - `dob` becomes `dob` (it is unchanged)
  • - `pod` becomes `boq`
  • A ***lake rotation*** is a half turn about the x axis (the horizontal).
  • - `DOB` becomes `DOB` (it is unchanged)
  • - `dob` becomes `qop`
  • 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
  • ```text
  • 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
  • ```text
  • 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
  • o : o
  • p : q
  • q : p
  • v : v
  • w : w
  • x : x
  • ```
  • ### Lake rotations
  • ```text
  • 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
  • o : o
  • p : b
  • q : d
  • t : f
  • 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 methods
  • ## 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
  • - More than 1 rotation type may be applied provided each is valid
  • - 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
  • ## Test cases
  • Note that 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"]`
  • ```text
  • "HI" : ["HI", "IH"]
  • "HIDE" : ["HIDE"]
  • "SNOW" : ["MONS"]
  • "WAIT" : ["TIAW"]
  • "loft" : ["lotf"]
  • "MOW" : ["WOM", "MOW"]
  • "Moody" : ["hpooW"]
  • "loud" : ["pnol"]
  • "shoWy" : ["hMoys"]
  • ```
  • 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.
  • For this challenge, the 3 types will be called ***clock***, ***mirror***, and ***lake*** rotations. They have more elaborate names and variations on the [Ambigram](https://en.wikipedia.org/wiki/Ambigram) Wikipedia page but those will not be used here.
  • ## Terminology
  • *Note that the examples are not necessarily English words, 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).
  • - `pod` becomes `pod` (it is unchanged)
  • - `pow` becomes `mod`
  • A ***mirror rotation*** is a half turn about the y axis (the vertical).
  • - `dob` becomes `dob` (it is unchanged)
  • - `mod` becomes `bom`
  • A ***lake rotation*** is a half turn about the x axis (the horizontal).
  • - `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
  • ```text
  • 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
  • ```text
  • 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
  • o : o
  • p : q
  • q : p
  • v : v
  • w : w
  • x : x
  • ```
  • ### Lake rotations
  • ```text
  • 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
  • o : o
  • p : b
  • q : d
  • t : f
  • 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 not contain spaces, newlines, or punctuation - only letters
  • - The word will be rotatable by at least 1 of the 3 rotation types
  • - Specifically, this means 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
  • - Note that 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
  • Note that 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"]`
  • ```text
  • "HI" : ["HI", "IH"]
  • "HIDE" : ["HIDE"]
  • "SNOW" : ["MONS"]
  • "WAIT" : ["TIAW"]
  • "loft" : ["lotf"]
  • "MOW" : ["WOM", "MOW"]
  • "Moody" : ["hpooW"]
  • "loud" : ["pnol"]
  • "shoWy" : ["hMoys"]
  • ```
#5: Post edited by user avatar trichoplax‭ · 2022-10-15T03:56:51Z (about 2 years ago)
Test case intro wording fix
  • 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.
  • For this challenge, the 3 types will be called ***clock***, ***mirror***, and ***lake*** rotations. They have more elaborate names and variations on the [Ambigram](https://en.wikipedia.org/wiki/Ambigram) Wikipedia page but those will not be used here.
  • ## Terminology
  • *Note that the examples are not necessarily English words, 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).
  • - `pod` becomes `pod` (it is unchanged)
  • - `pob` becomes `qod`
  • A ***mirror rotation*** is a half turn about the y axis (the vertical).
  • - `dob` becomes `dob` (it is unchanged)
  • - `pod` becomes `boq`
  • A ***lake rotation*** is a half turn about the x axis (the horizontal).
  • - `DOB` becomes `DOB` (it is unchanged)
  • - `dob` becomes `qop`
  • 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
  • ```text
  • 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
  • ```text
  • 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
  • o : o
  • p : q
  • q : p
  • v : v
  • w : w
  • x : x
  • ```
  • ### Lake rotations
  • ```text
  • 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
  • o : o
  • p : b
  • q : d
  • t : f
  • 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 methods
  • ## 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
  • - More than 1 rotation type may be applied provided each is valid
  • - 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
  • ## Test cases
  • Note that you must only output a single rotated word for a given input word. Where more than one valid output is listed, you may choose any one of them to output.
  • Test cases are in the format `"input word" : ["valid", "rotated", "words"]`
  • ```text
  • "HI" : ["HI", "IH"]
  • "HIDE" : ["HIDE"]
  • "SNOW" : ["MONS"]
  • "WAIT" : ["TIAW"]
  • "loft" : ["lotf"]
  • "MOW" : ["WOM", "MOW"]
  • "Moody" : ["hpooW"]
  • "loud" : ["pnol"]
  • "shoWy" : ["hMoys"]
  • ```
  • 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.
  • For this challenge, the 3 types will be called ***clock***, ***mirror***, and ***lake*** rotations. They have more elaborate names and variations on the [Ambigram](https://en.wikipedia.org/wiki/Ambigram) Wikipedia page but those will not be used here.
  • ## Terminology
  • *Note that the examples are not necessarily English words, 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).
  • - `pod` becomes `pod` (it is unchanged)
  • - `pob` becomes `qod`
  • A ***mirror rotation*** is a half turn about the y axis (the vertical).
  • - `dob` becomes `dob` (it is unchanged)
  • - `pod` becomes `boq`
  • A ***lake rotation*** is a half turn about the x axis (the horizontal).
  • - `DOB` becomes `DOB` (it is unchanged)
  • - `dob` becomes `qop`
  • 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
  • ```text
  • 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
  • ```text
  • 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
  • o : o
  • p : q
  • q : p
  • v : v
  • w : w
  • x : x
  • ```
  • ### Lake rotations
  • ```text
  • 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
  • o : o
  • p : b
  • q : d
  • t : f
  • 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 methods
  • ## 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
  • - More than 1 rotation type may be applied provided each is valid
  • - 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
  • ## Test cases
  • Note that 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"]`
  • ```text
  • "HI" : ["HI", "IH"]
  • "HIDE" : ["HIDE"]
  • "SNOW" : ["MONS"]
  • "WAIT" : ["TIAW"]
  • "loft" : ["lotf"]
  • "MOW" : ["WOM", "MOW"]
  • "Moody" : ["hpooW"]
  • "loud" : ["pnol"]
  • "shoWy" : ["hMoys"]
  • ```
#4: Post edited by user avatar trichoplax‭ · 2022-10-15T03:10:47Z (about 2 years ago)
Clarify letters must be English alphabet letters
  • 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 real letters, output one of its rotated forms.
  • For this challenge, the 3 types will be called ***clock***, ***mirror***, and ***lake*** rotations. They have more elaborate names and variations on the [Ambigram](https://en.wikipedia.org/wiki/Ambigram) Wikipedia page but those will not be used here.
  • ## Terminology
  • *Note that the examples are not necessarily real words, but the letters always remain real letters. If a rotation type on a letter does not give a real 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).
  • - `pod` becomes `pod` (it is unchanged)
  • - `pob` becomes `qod`
  • A ***mirror rotation*** is a half turn about the y axis (the vertical).
  • - `dob` becomes `dob` (it is unchanged)
  • - `pod` becomes `boq`
  • A ***lake rotation*** is a half turn about the x axis (the horizontal).
  • - `DOB` becomes `DOB` (it is unchanged)
  • - `dob` becomes `qop`
  • 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
  • ```text
  • 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
  • ```text
  • 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
  • o : o
  • p : q
  • q : p
  • v : v
  • w : w
  • x : x
  • ```
  • ### Lake rotations
  • ```text
  • 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
  • o : o
  • p : b
  • q : d
  • t : f
  • 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 methods
  • ## 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
  • - More than 1 rotation type may be applied provided each is valid
  • - 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
  • ## Test cases
  • Note that you must only output a single rotated word for a given input word. Where more than one valid output is listed, you may choose any one of them to output.
  • Test cases are in the format `"input word" : ["valid", "rotated", "words"]`
  • ```text
  • "HI" : ["HI", "IH"]
  • "HIDE" : ["HIDE"]
  • "SNOW" : ["MONS"]
  • "WAIT" : ["TIAW"]
  • "loft" : ["lotf"]
  • "MOW" : ["WOM", "MOW"]
  • "Moody" : ["hpooW"]
  • "loud" : ["pnol"]
  • "shoWy" : ["hMoys"]
  • ```
  • 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.
  • For this challenge, the 3 types will be called ***clock***, ***mirror***, and ***lake*** rotations. They have more elaborate names and variations on the [Ambigram](https://en.wikipedia.org/wiki/Ambigram) Wikipedia page but those will not be used here.
  • ## Terminology
  • *Note that the examples are not necessarily English words, 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).
  • - `pod` becomes `pod` (it is unchanged)
  • - `pob` becomes `qod`
  • A ***mirror rotation*** is a half turn about the y axis (the vertical).
  • - `dob` becomes `dob` (it is unchanged)
  • - `pod` becomes `boq`
  • A ***lake rotation*** is a half turn about the x axis (the horizontal).
  • - `DOB` becomes `DOB` (it is unchanged)
  • - `dob` becomes `qop`
  • 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
  • ```text
  • 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
  • ```text
  • 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
  • o : o
  • p : q
  • q : p
  • v : v
  • w : w
  • x : x
  • ```
  • ### Lake rotations
  • ```text
  • 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
  • o : o
  • p : b
  • q : d
  • t : f
  • 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 methods
  • ## 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
  • - More than 1 rotation type may be applied provided each is valid
  • - 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
  • ## Test cases
  • Note that you must only output a single rotated word for a given input word. Where more than one valid output is listed, you may choose any one of them to output.
  • Test cases are in the format `"input word" : ["valid", "rotated", "words"]`
  • ```text
  • "HI" : ["HI", "IH"]
  • "HIDE" : ["HIDE"]
  • "SNOW" : ["MONS"]
  • "WAIT" : ["TIAW"]
  • "loft" : ["lotf"]
  • "MOW" : ["WOM", "MOW"]
  • "Moody" : ["hpooW"]
  • "loud" : ["pnol"]
  • "shoWy" : ["hMoys"]
  • ```
#3: Post edited by user avatar trichoplax‭ · 2022-10-15T03:06:19Z (about 2 years ago)
Finish wording and add test cases
  • Given a word determine whether it is identical after rotation by 180 degrees (a half turn) about any of its 3 axes.
  • 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 real letters, output one of its rotated forms.
  • For this challenge, the 3 types will be called ***clock***, ***mirror***, and ***lake*** rotations. They have more elaborate names and variations on the [Ambigram](https://en.wikipedia.org/wiki/Ambigram) Wikipedia page but those will not be used here.
  • ## Terminology
  • *Note that the examples are not necessarily real words, but the letters always remain real letters. If a rotation type on a letter does not give a real 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).
  • - `pod` becomes `pod` (it is unchanged)
  • - `pob` becomes `qod`
  • A ***mirror rotation*** is a half turn about the y axis (the vertical).
  • - `dob` becomes `dob` (it is unchanged)
  • - `pod` becomes `boq`
  • A ***lake rotation*** is a half turn about the x axis (the horizontal).
  • - `DOB` becomes `DOB` (it is unchanged)
  • - `dob` becomes `qop`
  • 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
  • ```text
  • 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
  • ```text
  • 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
  • o : o
  • p : q
  • q : p
  • v : v
  • w : w
  • x : x
  • ```
  • ### Lake rotations
  • ```text
  • 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
  • o : o
  • p : b
  • q : d
  • t : f
  • 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 methods
  • ## 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
  • - More than 1 rotation type may be applied provided each is valid
  • - 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
  • ## Test cases
  • Note that you must only output a single rotated word for a given input word. Where more than one valid output is listed, you may choose any one of them to output.
  • Test cases are in the format `"input word" : ["valid", "rotated", "words"]`
  • ```text
  • "HI" : ["HI", "IH"]
  • "HIDE" : ["HIDE"]
  • "SNOW" : ["MONS"]
  • "WAIT" : ["TIAW"]
  • "loft" : ["lotf"]
  • "MOW" : ["WOM", "MOW"]
  • "Moody" : ["hpooW"]
  • "loud" : ["pnol"]
  • "shoWy" : ["hMoys"]
  • ```
#2: Post edited by user avatar trichoplax‭ · 2022-10-15T01:23:05Z (about 2 years ago)
Fix title
  • Pinwheel &zwsp;words
  • Pinwheel words
#1: Initial revision by user avatar trichoplax‭ · 2022-10-15T01:21:56Z (about 2 years ago)
Pinwheel &zwsp;words
Given a word determine whether it is identical after rotation by 180 degrees (a half turn) about any of its 3 axes.