Something went wrong. Try again.
bayes for days
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152"""The boards the generator draws from carry no terrain the bot cannot model.
`sds.scenario.MAPS` is a hand-kept list, and the thing that makes it wrong is aboard whose title says nothing about what is in it. Two of the four bridgeboards are called `City Hills Residential 2` and `BattleForce 2`, and three ofthe boards on the list are called `City` something and carry no building at all.So the check reads the hexes rather than the name."""
from __future__ import annotations
import unittestfrom pathlib import Path
from sds.board import DEFAULT_MM_HOME, find_board_file, parse_boardfrom sds.scenario import MAPS
# Terrain the bot has no notion of. A building is not on the wire at all; a# bridge is on the board but `MoveHex` has no `BRIDGE`/`BRIDGE_ELEV`, so the# floor it computes for a bridge hex is the ground underneath and the step off# the far side is priced as flat. Either way the map measures the blindness# rather than the judgement.UNMODELLED = ("building", "bridge")
class MapsCarryNothingUnmodelled(unittest.TestCase): def setUp(self) -> None: if not (DEFAULT_MM_HOME / "data" / "boards").is_dir(): self.skipTest(f"no MegaMek boards under {DEFAULT_MM_HOME}")
def test_every_board_resolves(self) -> None: missing = [name for name in MAPS if find_board_file(name) is None] self.assertEqual(missing, [], "MAPS names no board in this MegaMek")
def test_no_board_carries_unmodelled_terrain(self) -> None: found: dict[str, list[str]] = {} for name in MAPS: path = find_board_file(name) if path is None: continue board = parse_board(Path(path)) carried = sorted( {t for hex_ in board.hexes.values() for t in UNMODELLED if t in hex_.terrain} ) if carried: found[name] = carried self.assertEqual(found, {}, "MAPS draws from a board the bot cannot model")
if __name__ == "__main__": unittest.main()