Browse Source

Use piece colors

master
Joop Kiefte 7 months ago
parent
commit
85faa47b77
1 changed files with 16 additions and 12 deletions
  1. +16
    -12
      main.go

+ 16
- 12
main.go View File

@ -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