Ver Fonte

Fix json van bord

Harry de Boer há 10 anos atrás
pai
commit
cbf1957b93
1 ficheiros alterados com 2 adições e 1 exclusões
  1. 2 1
      board/board.go

+ 2 - 1
board/board.go

@@ -58,6 +58,7 @@ func (b *Board) String() string {
 
 func (b *Board) WriteJSON(w io.Writer, startCol, startRow, cols, rows int) {
 	sc, sr, cols, rows := sanitizeViewPort(b, startCol, startRow, cols, rows)
+	fmt.Fprintf(w, "{x=\"%v\",y=\"%v\",rows=\"%v\",columns=\"%v\",tiles=[", sc, sr, cols, rows)
 
 	for y := startRow; y < sr+rows; y++ {
 		for x := startCol; x < sc+cols; x++ {
@@ -70,7 +71,7 @@ func (b *Board) WriteJSON(w io.Writer, startCol, startRow, cols, rows int) {
 		}
 	}
 
-	fmt.Fprintf(w, "}}")
+	fmt.Fprintf(w, "]}")
 }
 
 func sanitizeViewPort(b *Board, startCol, startRow, cols, rows int) (int, int, int, int) {