Scala 494 without newlines 520 with newlines:
def k(i:Int,d:Int=0):(Int,Int)=if(i<(7-d))(d,i+1)else k(i-(7-d),d+1)
def t(i:Char)=(if(i=='y')i-4 else
if(i=='z')i+2 else
if(i=='j')i+14 else
if(i>='v')i+3 else
if(i>'i')i-1 else i)-'a'
def q(p:(Int,Int),i:Int,c:Char)=if(p._1==i||p._1+p._2==i)""+c else" "
def g(r:Int,c:Char)={val p=k(t(c.toLower))
print((r match{case 1=>q(p,3,'\\')+q(p,4,'|')+q(p,5,'/')
case 2=>q(p,2,'-')+"o"+q(p,6,'-')
case 3=>q(p,1,'/')+q(p,0,'|')+q(p,7,'\\')})+" ")}
for(w<-readLine.split(" ")){println;for(r<-(1 to 3)){w.map(c=>g(r,c));println}}
ungolfed:
def toClock (i: Int, depth: Int=0) : (Int, Int) = {
if (i < (7 - depth)) (depth, i+1) else toClock (i - (7-depth), depth + 1)}
def toIdx (i: Char) = {
(if (i == 'y') i - 4 else
if (i == 'z') i + 2 else
if (i == 'j') i + 14 else
if (i >= 'v') i + 3 else
if (i > 'i') i - 1 else i ) - 'a'}
def p2c (pair: (Int, Int), i: Int, c: Char) = {
if (pair._1 == i || pair._1 + pair._2 == i) ""+c else " "
}
def printGrid (row: Int, c: Char) = {
val idx = toIdx (c.toLower)
val pair = toClock (idx)
row match {
case 1 => { print(
p2c (pair, 3, '\\') +
p2c (pair, 4, '|') +
p2c (pair, 5, '/') + " ")
}
case 2 => { print(
p2c (pair, 2, '-') + "o" +
p2c (pair, 6, '-') + " ")
}
case 3 => { print(
p2c (pair, 1, '/') +
p2c (pair, 0, '|') +
p2c (pair, 7, '\\') + " ")
}
}
}
val worte = "This is Code Golf"
(1 to 3).map (row => {worte.map (c => printGrid (row, c));println})
Explanation:
I observed a clock-pattern, but not with 12 hours, but 8. And Starttime is 0 is, where 6 o'clock is, and a, b, c are the first codes, with the first (one) flag on South.
Since flag 1 and 2 are indistinguishable, we can sort all combinations with the lower number for the first flag first. Unfortunately, the fine order from the beginning is disturbed, when j doesn't follow i, but k, l, m, and later it get's a mess.
Therefore I rearrange my keys for the mapping:
val iis = is.map {i =>
if (i == 'y') i - 4 else
if (i == 'z') i + 2 else
if (i == 'j') i + 14 else
if (i >= 'v') i + 3 else
if (i > 'i') i - 1 else i }.map (_ - 'a')
iis.zipWithIndex .sortBy (_._1) .map (p => (p._1, ('a' + p._2).toChar))
Vector((97,a), (98, b), (99, c), (100,d), (101,e), (102,f), (103,g),
(104,h), (105,i), (106,k), (107,l), (108,m), (109,n),
(110,o), (111,p), (112,q), (113,r), (114,s),
(115,t), (116,u), (117,y), -------
------- (120,j), (121,v),
(122,w), (123,x),
(124,z))
If we substract 'a' from every character, we get the numbers from (0 to 7+6+5+...+1). We can map the numbers of a character-grid
3 4 5 \ | / |
2 6 - o - - o - o
1 0 7 / | \ (2, ) (2,2)
A pair of two numbers can map two flags, where the first number is the index of 0 to 6 for the first flag, and the second flag isn't a number from 1 to 7 for the second flag, but for the distance from the first to the second flag. (2,2) would mean, the first flag is to WEST, and the second is two steps clockwise from there, to the NORTH.
def toClock (i: Int, depth: Int=0) : (Int, Int) = {
if (i < (7 - depth)) (depth, i+1) else toClock (i - (7-depth), depth + 1)}
Vector( (0,1), (0,2), (0,3), (0,4), (0,5), (0,6), (0,7),
(1,1), (1,2), (1,3), (1,4), (1,5), (1,6),
(2,1), (2,2), (2,3), (2,4), (2,5),
(3,1), (3,2), (3,3),
(4,2), (4,3),
(5,1), (5,2),
(6,1))
and each row must be separated by a blank line
=> each word is meant, isn't it? \$\endgroup\$