pinch_points/sim/gull.rs
1use crate::sim::crab::Handedness;
2use crate::sim::direction::Direction;
3
4/// Gull behaviour state (spec §3.5). Walking is the default and the whole
5/// offensive layer: a walking gull is steerable with signposts. Flight is a
6/// brief, occasional hop that exists so no corner can be permanently safe.
7#[derive(Clone, Copy, PartialEq, Eq, Debug)]
8pub enum GullState {
9 Walking,
10 /// Hopping `remaining` more tiles in the current direction, ignoring
11 /// walls and signposts, eating nothing.
12 Flying {
13 remaining: u8,
14 },
15}
16
17/// One gull. Moves on the grid exactly like a crab while walking (walls,
18/// signposts, handedness), slower than a common crab.
19#[derive(Clone, Copy, Debug)]
20pub struct Gull {
21 /// Stable identity for the render layer; unique within a match.
22 pub id: u32,
23 pub tile: u16,
24 pub dir: Direction,
25 pub progress: u16,
26 pub prev_tile: u16,
27 pub prev_progress: u16,
28 pub prev_dir: Direction,
29 pub handed: Handedness,
30 pub state: GullState,
31 /// Ticks of walking left until the next takeoff.
32 pub takeoff_in: u32,
33}
34
35/// Walking speed in subunits per tick (spec §4.2: slower than a common crab).
36pub const GULL_WALK_SPEED: u16 = 8;
37/// Flying speed in subunits per tick.
38pub const GULL_FLY_SPEED: u16 = 16;
39/// Gull-eats-crab range: Manhattan distance between sub-tile offsets on the
40/// same tile, in subunits (spec §4.3 suggests 48).
41pub const EAT_RANGE: u16 = 48;
42/// Takeoff timer range in ticks (5–12 s at 30 Hz): keeps gulls walking, and
43/// therefore steerable, roughly 85% of the time (spec §3.5).
44pub const TAKEOFF_MIN: u32 = 150;
45pub const TAKEOFF_MAX: u32 = 360;
46/// Flight length range in tiles (spec §3.5: 2–4).
47pub const FLIGHT_MIN: u8 = 2;
48pub const FLIGHT_MAX: u8 = 4;