@@ -21,7 +21,7 @@ type Gui struct {
2121}
2222
2323var FieldStateName = map [FieldState ]string {
24- Empty : "┼ " ,
24+ Empty : "+ " ,
2525 Black : "○" , // Unicode empty circle for black stone
2626 White : "●" , // Unicode filled circle for white stone
2727}
@@ -55,68 +55,38 @@ func (g *Gui) Refresh() {
5555func (g * Gui ) DrawGridToWriter (w io.Writer , cursorRow , cursorCol int ) {
5656 // Column labels
5757 fmt .Fprint (w , " " )
58- for j := 0 ; j < 9 ; j ++ {
58+ for j := range g . Grid [ 0 ] {
5959 fmt .Fprintf (w , " %c " , 'A' + j )
6060 }
6161 fmt .Fprintln (w )
6262
63- for i := 0 ; i < 9 ; i ++ {
63+ for i , row := range g . Grid {
6464 // Row label
6565 fmt .Fprintf (w , "%2d " , i + 1 )
66- for j := 0 ; j < 9 ; j ++ {
67- stone := g.Grid [i ][j ].String ()
68- // Use box-drawing characters for borders and intersections
69- if g.Grid [i ][j ] != Empty {
70- stone = g.Grid [i ][j ].String ()
71- } else {
72- switch {
73- case i == 0 && j == 0 :
74- stone = "┌"
75- case i == 0 && j == 8 :
76- stone = "┐"
77- case i == 8 && j == 0 :
78- stone = "└"
79- case i == 8 && j == 8 :
80- stone = "┘"
81- case i == 0 :
82- stone = "┬"
83- case i == 8 :
84- stone = "┴"
85- case j == 0 :
86- stone = "├"
87- case j == 8 :
88- stone = "┤"
89- default :
90- stone = g.Grid [i ][j ].String ()
91- }
92- }
93- var cell string
66+ for j , cellVal := range row {
67+ stone := cellVal .String ()
68+
69+ cell := fmt .Sprintf ("-%s-" , stone )
9470 if j == 0 {
95- cell = fmt .Sprintf (" %s─ " , stone )
71+ cell = fmt .Sprintf (" %s- " , stone )
9672 } else if j == 8 {
97- cell = fmt .Sprintf ("─%s " , stone )
98- } else {
99- // Use a box-drawing character for the stone
100- cell = fmt .Sprintf ("─%s─" , stone )
73+ cell = fmt .Sprintf ("-%s " , stone )
10174 }
102-
10375 if i == cursorRow && j == cursorCol {
104- // Use a different background or brackets, but keep width 3
10576 cell = fmt .Sprintf ("[%s]" , stone )
10677 }
10778 fmt .Fprint (w , cell )
108-
10979 // Draw horizontal line except after last column
11080 if j < 8 {
111- fmt .Fprint (w , "─ " )
81+ fmt .Fprint (w , "- " )
11282 }
11383 }
11484 fmt .Fprintln (w )
11585 // Draw vertical lines except after last row
11686 if i < 8 {
11787 fmt .Fprint (w , " " )
118- for j := 0 ; j < 9 ; j ++ {
119- fmt .Fprint (w , " │ " )
88+ for j := range g . Grid [ i ] {
89+ fmt .Fprint (w , " | " )
12090 if j < 8 {
12191 fmt .Fprint (w , " " )
12292 }
0 commit comments