feat: model battlefield terrain and movement costs

This commit is contained in:
Keith Solomon
2026-07-04 15:08:40 -05:00
parent 7b82adbd71
commit 189be5bc64
4 changed files with 203 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
namespace BattleForge\Domain;
final readonly class Position
{
public function __construct(
public int $x,
public int $y,
) {
}
public function key(): string
{
return $this->x . ':' . $this->y;
}
public function distanceTo(self $position): int
{
return abs($this->x - $position->x) + abs($this->y - $position->y);
}
}