12
I've been doing word searches recently, and I thought it would be so much easier if all of the words read left-to-right. But rewriting all the lines takes a lot of effort! So I'm enlisting code golfers to help.
(Disclaimer: The above story may or may not be remotely accurate.)
Your code will take a rectangular grid and output all of the lines through it in both directions.
The output must contain all 8 rotations of the grid (cardinals and main diagonals), 'read off' top to bottom, left to right. (This means that every "row" will be duplicated - once forwards, and once backwards.)
The line divisions can either be a space or a line break. If you choose spaces, the grid rotation divisions must be line breaks; otherwise, the grid rotation divisions must be two line breaks.
Example input (taken as an array of characters, multiline string, or other reasonable format)
ABCDE
FGHIJ
KLMNO
PQRST
Example output (using the first option for divisions)
ABCDE FGHIJ KLMNO PQRST
E DJ CIO BHNT AGMS FLR KQ P
EJOT DINS CHMR BGLQ AFKP
T OS JNR EIMQ DHLP CGK BF A
TSRQP ONMLK JIHGF EDBCA
P QK RLF SMGA TNHB OIC JD E
PKFA QLGB RMHC SNID TOJE
A FB KGC PLHD QMIE RNJ SO T
The order of the rotations "read off" does not matter as long as all eight cardinals and primary intercardinals are done once.
This is code-golf, so shortest code wins. Standard loopholes apply.
Does the grid only contain uppercase letters or can it be the whole printable ASCII? – Denker – 2016-03-11T10:14:35.753
Almost duplicate (without the diagonals) http://codegolf.stackexchange.com/questions/37940/word-search-puzzle
– Digital Trauma – 2016-03-11T16:39:52.353@DigitalTrauma: No, not really - this one doesn't ask you to find any words at all. – Deusovi – 2016-03-11T16:50:01.213