mirror of
https://github.com/mvvasilev/last_light.git
synced 2025-04-19 12:49:52 +03:00
32 lines
412 B
Go
32 lines
412 B
Go
package engine
|
|
|
|
import (
|
|
"log"
|
|
"testing"
|
|
)
|
|
|
|
func BenchmarkPathfinding(b *testing.B) {
|
|
path := FindPath(
|
|
PositionAt(0, 0),
|
|
PositionAt(16, 16),
|
|
func(x, y int) bool {
|
|
if x > 6 && x <= 16 && y == 10 {
|
|
return false
|
|
}
|
|
|
|
if x < 0 || y < 0 {
|
|
return false
|
|
}
|
|
|
|
if x > 16 || y > 16 {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
},
|
|
)
|
|
|
|
if path == nil {
|
|
log.Fatalf("No path could be found")
|
|
}
|
|
}
|