Skip to content

Split Captain into a commander and units; play from a roster - #133

Open
ptescher wants to merge 1 commit into
actors-queuefrom
actors-roster
Open

ptescher wants to merge 1 commit into
actors-queuefrom
actors-roster

Conversation

@ptescher

Copy link
Copy Markdown
Owner

Step 2 of plans/actors.md: Captain is split into a commander for each team and a unit for each drone, and a game is played from a roster. Based on actors-queue.

What changed

  • recreation_towers::actors (no I/O, for the arena and later the server):
    • trait Command { fn decide(&mut self, &TeamView) -> Result<Vec<Directive>, String> }, Directive { drone, order, queue }. Commander implements it.
    • trait Unit { fn fly(&mut self, &OnBoard, &mut Instruction) -> Option<Order>; fn restart(&mut self) }. OnBoard has private fields: team, number, flying, clock, silent/in_contact, battery, link timeout and bingo, obs() (its EdgeObs), done(order). A unit cannot reach another drone or the team's map.
    • Autopilot, the default unit: Instruction::tick_with.
  • cognition_towers: Match::with_units (a unit for each of ten drones) and step_with(&mut dyn Command, &mut dyn Command); Roster (new, of_captains, with_unit) and play_roster. Captain is kept: Directing(captain) is its Command; Captain::unit(team, k) replaces Captain::edge. Edged makes an EdgeUnit (autopilot, then the policy once a second when out of contact) with its own clone of the policy. No existing edge read captain state. compare_edge takes an Rc<dyn Edge>.
  • Seat protocol: a reply is a list of [drone, order] or [drone, order, queue] (Reply); old replies read as before. serve_with serves any Command; SeatProcess hands the queues to the match.
  • Glossary: Commander, Unit. plans/actors.md results, domains/cognition/README.md.

Not done / differs from the brief

  • A unit runs on every arena step (10 a second), not once a second. The queue (a Silent(after) time, the Done test) is worked at that rate today; running the default unit at 1 Hz moves the numbers. The edge policies still run once a second, inside EdgeUnit.
  • No advisor trait (step 4). No server changes.
  • cognition_league tests/acceptance.rs fails with "The suite's 120 s ran out before this test started", as on the base branch; its unit tests pass.

Gates (before = base actors-queue, after = this branch)

denial, ruleset v2 200, edge 30 and cognition_league judge --game captain --champion timid --challenger default --seeds 24 are byte-identical before and after (cmp). Judge: kept out (mean difference +0.175, lower bound -0.132); champion 24 won / 24 lost, 512 points; challenger 26 won / 22 lost, 547 against 493.
Tests: -p recreation_towers -p cognition_towers -p recreation_towers_ground pass (36 + 140 + 7 acceptance + 7); cognition_league unit tests pass; recreation_towers_server and teleoperation_command build; fmt and clippy clean; expectation check expectations: 0 errors.
New tests: a counting unit runs on every step for every drone in and out of contact; teams on different units, and one drone on a different unit, are deterministic and change the game; old and new reply; a served and a spawned seat with a queue.

🤖 Generated with Claude Code

…om a roster

Command and Unit are traits in recreation_towers (no I/O). The default unit,
Autopilot, is Instruction::tick_with; the edge policies are units (EdgeUnit).
Match is built from units, and Roster puts commanders and units together.
Captain is kept, as Directing (its Command) and Captain::unit. The seat reply
carries each order's queue.

Co-Authored-By: Claude <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant