Commit 1f09dfe0 authored by Derek Schaab's avatar Derek Schaab

Tweak ASCII output

parent 3bce22aa
...@@ -12,7 +12,6 @@ func WriteASCII(w io.Writer, g chess.Game, o Options) (err error) { ...@@ -12,7 +12,6 @@ func WriteASCII(w io.Writer, g chess.Game, o Options) (err error) {
f := s.File() f := s.File()
if s == chess.A8 { if s == chess.A8 {
dst.write(asciiTopRow) dst.write(asciiTopRow)
dst.writeByte(byte(g.ToMove.Color().Rune()))
dst.write(newline) dst.write(newline)
} else if f == 'a' { } else if f == 'a' {
dst.write(asciiInterRow) dst.write(asciiInterRow)
...@@ -20,6 +19,8 @@ func WriteASCII(w io.Writer, g chess.Game, o Options) (err error) { ...@@ -20,6 +19,8 @@ func WriteASCII(w io.Writer, g chess.Game, o Options) (err error) {
} }
if f == 'a' { if f == 'a' {
dst.writeByte(byte(s.Rank())) dst.writeByte(byte(s.Rank()))
dst.write(space)
dst.write(asciiDoubleVertical)
} else { } else {
dst.write(asciiSingleVertical) dst.write(asciiSingleVertical)
} }
...@@ -44,6 +45,9 @@ func WriteASCII(w io.Writer, g chess.Game, o Options) (err error) { ...@@ -44,6 +45,9 @@ func WriteASCII(w io.Writer, g chess.Game, o Options) (err error) {
} }
dst.write(asciiBottomRow) dst.write(asciiBottomRow)
dst.write(newline) dst.write(newline)
dst.writeByte(byte(g.ToMove.Color().Rune()))
dst.write(asciiFiles)
dst.write(newline)
err = dst.err err = dst.err
return return
} }
...@@ -55,9 +59,10 @@ type asciiWriter struct { ...@@ -55,9 +59,10 @@ type asciiWriter struct {
} }
var ( var (
asciiTopRow = []byte("╔═══╤═══╤═══╤═══╤═══╤═══╤═══╤═══") asciiTopRow = []byte(" ╔═══╤═══╤═══╤═══╤═══╤═══╤═══╤═══╗")
asciiInterRow = []byte("╟───┼───┼───┼───┼───┼───┼───┼───╢") asciiInterRow = []byte(" ╟───┼───┼───┼───┼───┼───┼───┼───╢")
asciiBottomRow = []byte("╚═a═╧═b═╧═c═╧═d═╧═e═╧═f═╧═g═╧═h═╝") asciiBottomRow = []byte(" ╚═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══╝")
asciiFiles = []byte(" a b c d e f g h ")
asciiSingleVertical = []byte("│") asciiSingleVertical = []byte("│")
asciiDoubleVertical = []byte("║") asciiDoubleVertical = []byte("║")
space = []byte(" ") space = []byte(" ")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment