func (t *tile) PathEstimatedCost(to astar.Pather) float64 {
	toT := to.(*tile)
	return float64(t.position.Distance(toT.position))
}
PathEstimatedCost estimates the cost of moving between two points.
package bot
import (
	"math/rand"
	"time"
	"github.com/beefsack/go-astar"
	"github.com/google/uuid"
	"github.com/mortenson/grpc-game-example/pkg/backend"
)
type bot struct {
	playerID uuid.UUID
}
type Bots struct {
	bots []*bot
	game *backend.Game
}
func NewBots(game *backend.Game) *Bots {
	return &Bots{
		game: game,
		bots: make([]*bot, 0),
	}
}
func (bots *Bots) AddBot(name string) *backend.Player {
	playerID := uuid.New()
	player := &backend.Player{
		Name:            name,
		Icon:            'b',
		IdentifierBase:  backend.IdentifierBase{playerID},
		CurrentPosition: backend.Coordinate{X: -1, Y: 9},
	}
	bots.game.Mu.Lock()
	bots.game.AddEntity(player)
	bots.game.Mu.Unlock()
	bots.bots = append(bots.bots, &bot{playerID: playerID})
	return player
}
type world struct {
	tiles map[backend.Coordinate]*tile
}
type tileKind int
const (
	tileWall tileKind = iota
	tileNone
)
type tile struct {
	position backend.Coordinate
	world    *world
	kind     tileKind
}
func (t *tile) PathNeighbors() []astar.Pather {
	neighbors := []astar.Pather{}
	for _, difference := range []backend.Coordinate{
		{X: -1, Y: 0},
		{X: 1, Y: 0},
		{X: 0, Y: -1},
		{X: 0, Y: 1},
	} {
		position := t.position.Add(difference)
		neighbor, ok := t.world.tiles[position]
		if ok && neighbor.kind == tileNone {
			neighbors = append(neighbors, neighbor)
		}
	}
	return neighbors
}
func (t *tile) PathNeighborCost(to astar.Pather) float64 {
	return 1
}