style: go vet applied
This commit is contained in:
@@ -68,6 +68,7 @@ func game(initrandom bool) {
|
|||||||
// catch interrupt signals
|
// catch interrupt signals
|
||||||
sigs := make(chan os.Signal, 1)
|
sigs := make(chan os.Signal, 1)
|
||||||
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM, syscall.SIGHUP)
|
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM, syscall.SIGHUP)
|
||||||
|
defer signal.Stop(sigs)
|
||||||
|
|
||||||
// initialize screen
|
// initialize screen
|
||||||
term.StartFullscreen()
|
term.StartFullscreen()
|
||||||
|
|||||||
+1
-1
@@ -103,7 +103,7 @@ func (a *Arena) processChunk(to *Arena, startY, endY int) {
|
|||||||
yCurrOffset := y * w
|
yCurrOffset := y * w
|
||||||
yNextOffset := yNext * w
|
yNextOffset := yNext * w
|
||||||
|
|
||||||
for x := 0; x < w; x++ {
|
for x := range w {
|
||||||
// Precompute x indices
|
// Precompute x indices
|
||||||
xPrev := (x - 1 + w) % w
|
xPrev := (x - 1 + w) % w
|
||||||
xNext := (x + 1) % w
|
xNext := (x + 1) % w
|
||||||
|
|||||||
+4
-4
@@ -72,7 +72,7 @@ func TestRules(t *testing.T) {
|
|||||||
// Set center
|
// Set center
|
||||||
a.Set(1, 1, alive)
|
a.Set(1, 1, alive)
|
||||||
// Set neighbors
|
// Set neighbors
|
||||||
for i := 0; i < activeNeighbors; i++ {
|
for i := range activeNeighbors {
|
||||||
nx, ny := neighbors[i][0], neighbors[i][1]
|
nx, ny := neighbors[i][0], neighbors[i][1]
|
||||||
a.Set(nx, ny, true)
|
a.Set(nx, ny, true)
|
||||||
}
|
}
|
||||||
@@ -134,8 +134,8 @@ func BenchmarkNextGen(b *testing.B) {
|
|||||||
next := New(size, size)
|
next := New(size, size)
|
||||||
|
|
||||||
// Initialize with some pattern (e.g., random-ish)
|
// Initialize with some pattern (e.g., random-ish)
|
||||||
for y := 0; y < size; y++ {
|
for y := range size {
|
||||||
for x := 0; x < size; x++ {
|
for x := range size {
|
||||||
if (x+y)%2 == 0 {
|
if (x+y)%2 == 0 {
|
||||||
arena.Set(x, y, true)
|
arena.Set(x, y, true)
|
||||||
}
|
}
|
||||||
@@ -143,7 +143,7 @@ func BenchmarkNextGen(b *testing.B) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
b.ResetTimer()
|
b.ResetTimer()
|
||||||
for i := 0; i < b.N; i++ {
|
for b.Loop() {
|
||||||
arena.NextGen(next)
|
arena.NextGen(next)
|
||||||
arena, next = next, arena
|
arena, next = next, arena
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user