2026-10-28 18:45:02 +00:00
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
namespace App\Game\Map;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2026-10-29 00:51:37 +00:00
|
|
|
|
* Continents are 100 × 100 blocks named by their row and column counted from the map's
|
|
|
|
|
|
* top-left corner, as in Die Stämme. The world starts at 0|0, the corner of K44, K45,
|
|
|
|
|
|
* K54 and K55; on a 1000-field map −500|−500 lies in K00 and 499|499 in K99.
|
2026-10-28 18:45:02 +00:00
|
|
|
|
*/
|
|
|
|
|
|
final class Continent
|
|
|
|
|
|
{
|
|
|
|
|
|
public const SIZE = 100;
|
|
|
|
|
|
|
2026-10-29 00:51:37 +00:00
|
|
|
|
public static function of(int $x, int $y, int $mapSize = 1000): string
|
2026-10-28 18:45:02 +00:00
|
|
|
|
{
|
2026-10-29 00:51:37 +00:00
|
|
|
|
$offset = intdiv($mapSize, 2);
|
|
|
|
|
|
|
|
|
|
|
|
return 'K'.intdiv($y + $offset, self::SIZE).intdiv($x + $offset, self::SIZE);
|
2026-10-28 18:45:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|