Browse Source

Use piece colors

master
Joop Kiefte 2 years ago
parent
commit
85faa47b77
  1. 28
      main.go

28
main.go

@ -35,18 +35,22 @@ func npos(l, c int, f tris.Field) {
func lpos(l, c int, f tris.Field) {
pos(l, c)
var line []int
for _, r := range f {
if len(line) == 0 {
line = r
}
for i := range line {
if r[i] > 0 {
line[i] = 5
}
}
}
ppos(l, c, render(line, "\u2591\u2591", " "))
ppos(l, c, render(where(f), "\u2591\u2591", " "))
}
func where(f tris.Field) []int {
var line []int
for _, r := range f {
if len(line) == 0 {
line = r
}
for i := range line {
if r[i] > 0 {
line[i] = r[i]
}
}
}
return line
}
func render(r []int, block, empty string) string {

Loading…
Cancel
Save