Skip to content

A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.

2.1 KB
Raw Blame
"""Checks GDD v0.2 map locations against the authored hex grid."""
import json
from pathlib import Path

import yaml12

import hexgrid as hg


ROOT = Path(__file__).resolve().parents[2]
MAP = ROOT / "content" / "map"
HEXES = json.loads((MAP / "hexes.json").read_text())
LOCATIONS = yaml12.load((MAP / "locations_1948.yaml").read_text())["locations"]


def test_sourced_coordinates_bind_to_the_authored_hexes():
    for location in LOCATIONS:
        assert hg.settlement_hex(location["lon"], location["lat"], HEXES) == (location["q"], location["r"]), location["id"]


def test_umm_rashrash_is_optional_outpost_metadata():
    location = next(location for location in LOCATIONS if location["id"] == "umm_rashrash")
    assert location["kind"] == "outpost"
    assert location["priority"] == "optional"
    assert location["marker"] is True
    assert all(location[role] is False for role in ("managed_city", "designated_site", "settlement_control_target"))
    assert "population" not in location
    assert "starting_control" not in location
    assert hg.settlement_hex(location["lon"], location["lat"], HEXES) == (location["q"], location["r"])


def test_issue_1008_roster_and_separate_adjacent_positions():
    by_id = {location["id"]: location for location in LOCATIONS if location["priority"] == "must_have"}
    assert set(by_id) == {
        "negba", "hulda", "nir_am", "latrun_fort", "iraq_suwaydan_fort", "shaar_hagai",
        "ad_halom_bridge", "shaar_haaliyah", "jerusalem", "east_jerusalem_old_city",
    }
    assert by_id["iraq_suwaydan_fort"]["id"] != "negba"
    assert by_id["ad_halom_bridge"]["id"] != "isdud"
    assert by_id["jerusalem"]["managed_city"] is True
    assert by_id["east_jerusalem_old_city"]["managed_city"] is False
    assert {l["id"] for l in LOCATIONS if l["priority"] == "optional"} == {
        "umm_rashrash", "nirim",
        # #1719: the named camps with a sourced camp point (research_notes/Map/camps-1948-51.md).
        "military_tzrifin", "military_tel_litvinsky", "military_schneller", "military_camp_80",
        "reception_atlit", "reception_beit_lid",
    }