@@ -36,44 +36,6 @@ func init() {
3636 }
3737}
3838
39- // Render the grid
40- func renderGrid() string {
41- out := ""
42-
43- // Grid cells
44- for y := 0; y < grid.Height; y++ {
45- for x := 0; x < grid.Width; x++ {
46- key := ufmt.Sprintf("%d,%d", x, y)
47- color := defaultcolor
48- link := defaultlink
49- // If the cell is owned, use its color
50- if cell, ok := grid.Cells[key]; ok {
51- color = cell.Color
52- caller := runtime.PreviousRealm().Address()
53-
54- if cell.Url != "" {
55- link = cell.Url
56- }
57-
58- // If the cell is owned by someone else, link to their pub if set
59- if cell.Owner != "" && cell.Owner != caller {
60- out += svgbtn.Button(cellSize, cellSize, color, "#333333", cell.Label, link)
61- out += strings.Repeat(" ", spacingCount)
62- continue
63- }
64- }
65- link = txlink.NewLink("BuyCell").
66- AddArgs("x", ufmt.Sprintf("%d", x), "y", ufmt.Sprintf("%d", y)).
67- URL()
68- out += svgbtn.Button(cellSize, cellSize, color, "#333333", "available", link)
69- out += strings.Repeat(" ", spacingCount)
70- }
71- out += "\n\n"
72- }
73-
74- return out
75- }
76-
7739// Function to validate the coordinates
7840func getCoordinate(x, y int) string {
7941 if x < 0 || x >= grid.Width || y < 0 || y >= grid.Height {
@@ -182,27 +144,6 @@ func Reset() string {
182144 return "The grid was successfully reset."
183145}
184146
185- // Stats of the grid (per cells owners)
186- func getStats() string {
187- stats := make(map[address]int)
188- for _, cell := range grid.Cells {
189- if cell.Owner != "" {
190- stats[cell.Owner]++
191- }
192- }
193-
194- out := "## Stats 📊:\n"
195- if len(stats) == 0 {
196- out += "No cells used.\n"
197- return out
198- }
199-
200- for owner, count := range stats {
201- out += ufmt.Sprintf("- %s: %d cell(s)\n", owner.String(), count)
202- }
203- return out
204- }
205-
206147func getColorName(color string) string {
207148 switch color {
208149 case "#f44336":
0 commit comments