using only one dimensional grid by calculating y+STRIDE*x

This commit is contained in:
2024-07-16 19:07:51 +02:00
parent e8ed283233
commit 4074debdbf
3 changed files with 69 additions and 54 deletions

View File

@@ -87,6 +87,17 @@ func Loop(grid []bool) {
}
func main() {
grid := make([]int, 50*50)
for y := 0; y < 50; y++ {
for x := 0; x < 50; x++ {
grid[y+50*x] = 1
fmt.Printf("%d,%d => %d\n", x, y, x+50*y)
}
}
}
func xmain() {
// enable cpu profiling. Do NOT use q to stop the game but
// close the window to get a profile
fd, err := os.Create("cpu.profile")