|
@@ -1,6 +1,7 @@
|
|
|
package main
|
|
|
|
|
|
import (
|
|
|
+ "bytes"
|
|
|
"math/rand"
|
|
|
"red-green/door"
|
|
|
"strings"
|
|
@@ -71,10 +72,20 @@ func BackOf(level int) door.Panel {
|
|
|
Y: 0,
|
|
|
Width: 5,
|
|
|
}
|
|
|
- back := string(BackSymbol(level))
|
|
|
+ var back string
|
|
|
+
|
|
|
+ if door.Unicode {
|
|
|
+ back = strings.Repeat(string(BackSymbol(level)), 5)
|
|
|
+ } else {
|
|
|
+ // bytes get destroyed as string.
|
|
|
+ br := make([]byte, 1)
|
|
|
+ br[0] = byte(BackSymbol(level))
|
|
|
+ back = string(bytes.Repeat(br, 5))
|
|
|
+ }
|
|
|
+
|
|
|
for x := 0; x < 3; x++ {
|
|
|
p.Lines = append(p.Lines,
|
|
|
- door.Line{Text: strings.Repeat(back, 5)})
|
|
|
+ door.Line{Text: back})
|
|
|
}
|
|
|
return p
|
|
|
}
|
|
@@ -82,19 +93,33 @@ func BackOf(level int) door.Panel {
|
|
|
func MarkOf(c int) door.Panel {
|
|
|
p := door.Panel{Width: 1}
|
|
|
color := door.ColorText("BLUE ON WHITE")
|
|
|
- var m rune
|
|
|
+ // var m rune
|
|
|
if c == 0 {
|
|
|
- m = ' '
|
|
|
+ p.Lines = append(p.Lines,
|
|
|
+ door.Line{Text: " ",
|
|
|
+ DefaultColor: color,
|
|
|
+ })
|
|
|
+ // m = ' '
|
|
|
} else {
|
|
|
if door.Unicode {
|
|
|
- m = '\u25a0'
|
|
|
+ p.Lines = append(p.Lines,
|
|
|
+ door.Line{Text: "\u25a0",
|
|
|
+ DefaultColor: color,
|
|
|
+ })
|
|
|
+ // m = '\u25a0'
|
|
|
} else {
|
|
|
- m = '\xfe'
|
|
|
+ /*
|
|
|
+ var b [1]byte
|
|
|
+ b[0] = 0xfe
|
|
|
+ m = string(b[:]) // '\xfe'
|
|
|
+ */
|
|
|
+ var b [1]byte
|
|
|
+ b[0] = 0xfe
|
|
|
+ p.Lines = append(p.Lines,
|
|
|
+ door.Line{Text: string(b[:]),
|
|
|
+ DefaultColor: color})
|
|
|
}
|
|
|
}
|
|
|
- p.Lines = append(p.Lines,
|
|
|
- door.Line{Text: string(m),
|
|
|
- DefaultColor: color})
|
|
|
return p
|
|
|
}
|
|
|
|