func DrawField(game *core.Game) []byte { var buf []byte for _, row := range game.Positions() { str := fmt.Sprintf(" %4d | %4d | %4d | %4d \r\n", row[0], row[1], row[2], row[3]) buf = append(buf, []byte(str)...) } return buf }
func draw(game *core.Game) { fmt.Println("/===========================\\") for i, row := range game.Positions() { fmt.Printf("| %4d | %4d | %4d | %4d |", row[0], row[1], row[2], row[3]) fmt.Println("") if i != (core.GameFieldSize - 1) { fmt.Println("|===========================|") } } fmt.Println("|===========================|") fmt.Println("| Next number: | ", game.NextSpawn(), " |") fmt.Printf("| Score: | %9d |", game.GetScore()) fmt.Println("") fmt.Println("\\===========================/") }