librarygames/asteroids/Rocks.xtl

Asteroids' rules, a library: asteroids.xtl (scripted), play.xtl (the game: keys and the clock) and the web page all use these. Built on lib/Ecs: a world is a matrix, a row per entity slot, and every rule is a system over every entity at once. The entities come and go all the time: every shot is spawned and spent, every rock hit is despawned and its two halves spawned in the slots that freed. Which slots hold what is only masks (alive, rock, shot), so the churn needs no lists kept. A game's state is a tuple: (the world, the score, the lives left, the wave, the seconds played, how it stands: 0 playing, 1 every wave cleared, 2 no lives left, the seconds the ship cannot be hit).

source · imports ec: lib/Ecs.xtl lib/Ecs.xtlm; sv: lib/Svg.xtl

The data

ʰw̲orld : Int -> Float

function (private) · line 20

The layout: where it is (x then y, in tiles, y down), how fast it moves, the ship's heading (radians, 0 to the right), a rock's size (1 small to 3 big), a shot's time left, and what it is.

"h" ᵉᶜc̲omponents< "pos:2 vel:2 dir size life ship rock shot"
ᵉᶜc̲omponents< expands to
ʰw̲orld ← { n → (n c̲at 19) r̲eshape 0.0 }
ʰp̲os ← { W → (3 4) s̲elect₂ W }
ʰh̲asPos ← { W → 0 < 2 s̲elect₂ W }
ʰs̲etPos ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (2 3 4) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropPos ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 2 = r̲ange 19 }
ʰv̲el ← { W → (6 7) s̲elect₂ W }
ʰh̲asVel ← { W → 0 < 5 s̲elect₂ W }
ʰs̲etVel ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (5 6 7) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropVel ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 5 = r̲ange 19 }
ʰd̲ir ← { W → (9) s̲elect₂ W }
ʰh̲asDir ← { W → 0 < 8 s̲elect₂ W }
ʰs̲etDir ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (8 9) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropDir ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 8 = r̲ange 19 }
ʰs̲ize ← { W → (11) s̲elect₂ W }
ʰh̲asSize ← { W → 0 < 10 s̲elect₂ W }
ʰs̲etSize ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (10 11) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropSize ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 10 = r̲ange 19 }
ʰl̲ife ← { W → (13) s̲elect₂ W }
ʰh̲asLife ← { W → 0 < 12 s̲elect₂ W }
ʰs̲etLife ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (12 13) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropLife ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 12 = r̲ange 19 }
ʰs̲hip ← { W → (15) s̲elect₂ W }
ʰh̲asShip ← { W → 0 < 14 s̲elect₂ W }
ʰs̲etShip ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (14 15) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShip ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 14 = r̲ange 19 }
ʰr̲ock ← { W → (17) s̲elect₂ W }
ʰh̲asRock ← { W → 0 < 16 s̲elect₂ W }
ʰs̲etRock ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (16 17) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropRock ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 16 = r̲ange 19 }
ʰs̲hot ← { W → (19) s̲elect₂ W }
ʰh̲asShot ← { W → 0 < 18 s̲elect₂ W }
ʰs̲etShot ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (18 19) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShot ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 18 = r̲ange 19 }
Used in: ˡn̲ew

ʰp̲os : a -> a

function (private) · line 20

The layout: where it is (x then y, in tiles, y down), how fast it moves, the ship's heading (radians, 0 to the right), a rock's size (1 small to 3 big), a shot's time left, and what it is.

"h" ᵉᶜc̲omponents< "pos:2 vel:2 dir size life ship rock shot"
ᵉᶜc̲omponents< expands to
ʰw̲orld ← { n → (n c̲at 19) r̲eshape 0.0 }
ʰp̲os ← { W → (3 4) s̲elect₂ W }
ʰh̲asPos ← { W → 0 < 2 s̲elect₂ W }
ʰs̲etPos ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (2 3 4) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropPos ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 2 = r̲ange 19 }
ʰv̲el ← { W → (6 7) s̲elect₂ W }
ʰh̲asVel ← { W → 0 < 5 s̲elect₂ W }
ʰs̲etVel ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (5 6 7) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropVel ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 5 = r̲ange 19 }
ʰd̲ir ← { W → (9) s̲elect₂ W }
ʰh̲asDir ← { W → 0 < 8 s̲elect₂ W }
ʰs̲etDir ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (8 9) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropDir ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 8 = r̲ange 19 }
ʰs̲ize ← { W → (11) s̲elect₂ W }
ʰh̲asSize ← { W → 0 < 10 s̲elect₂ W }
ʰs̲etSize ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (10 11) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropSize ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 10 = r̲ange 19 }
ʰl̲ife ← { W → (13) s̲elect₂ W }
ʰh̲asLife ← { W → 0 < 12 s̲elect₂ W }
ʰs̲etLife ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (12 13) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropLife ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 12 = r̲ange 19 }
ʰs̲hip ← { W → (15) s̲elect₂ W }
ʰh̲asShip ← { W → 0 < 14 s̲elect₂ W }
ʰs̲etShip ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (14 15) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShip ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 14 = r̲ange 19 }
ʰr̲ock ← { W → (17) s̲elect₂ W }
ʰh̲asRock ← { W → 0 < 16 s̲elect₂ W }
ʰs̲etRock ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (16 17) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropRock ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 16 = r̲ange 19 }
ʰs̲hot ← { W → (19) s̲elect₂ W }
ʰh̲asShot ← { W → 0 < 18 s̲elect₂ W }
ʰs̲etShot ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (18 19) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShot ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 18 = r̲ange 19 }

ʰh̲asPos : (Num a, Truthy b) => a -> b

function (private) · line 20

The layout: where it is (x then y, in tiles, y down), how fast it moves, the ship's heading (radians, 0 to the right), a rock's size (1 small to 3 big), a shot's time left, and what it is.

"h" ᵉᶜc̲omponents< "pos:2 vel:2 dir size life ship rock shot"
ᵉᶜc̲omponents< expands to
ʰw̲orld ← { n → (n c̲at 19) r̲eshape 0.0 }
ʰp̲os ← { W → (3 4) s̲elect₂ W }
ʰh̲asPos ← { W → 0 < 2 s̲elect₂ W }
ʰs̲etPos ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (2 3 4) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropPos ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 2 = r̲ange 19 }
ʰv̲el ← { W → (6 7) s̲elect₂ W }
ʰh̲asVel ← { W → 0 < 5 s̲elect₂ W }
ʰs̲etVel ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (5 6 7) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropVel ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 5 = r̲ange 19 }
ʰd̲ir ← { W → (9) s̲elect₂ W }
ʰh̲asDir ← { W → 0 < 8 s̲elect₂ W }
ʰs̲etDir ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (8 9) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropDir ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 8 = r̲ange 19 }
ʰs̲ize ← { W → (11) s̲elect₂ W }
ʰh̲asSize ← { W → 0 < 10 s̲elect₂ W }
ʰs̲etSize ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (10 11) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropSize ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 10 = r̲ange 19 }
ʰl̲ife ← { W → (13) s̲elect₂ W }
ʰh̲asLife ← { W → 0 < 12 s̲elect₂ W }
ʰs̲etLife ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (12 13) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropLife ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 12 = r̲ange 19 }
ʰs̲hip ← { W → (15) s̲elect₂ W }
ʰh̲asShip ← { W → 0 < 14 s̲elect₂ W }
ʰs̲etShip ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (14 15) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShip ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 14 = r̲ange 19 }
ʰr̲ock ← { W → (17) s̲elect₂ W }
ʰh̲asRock ← { W → 0 < 16 s̲elect₂ W }
ʰs̲etRock ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (16 17) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropRock ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 16 = r̲ange 19 }
ʰs̲hot ← { W → (19) s̲elect₂ W }
ʰh̲asShot ← { W → 0 < 18 s̲elect₂ W }
ʰs̲etShot ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (18 19) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShot ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 18 = r̲ange 19 }

ʰs̲etPos : Float -> (Int, Float) -> Float

function (private) · line 20

The layout: where it is (x then y, in tiles, y down), how fast it moves, the ship's heading (radians, 0 to the right), a rock's size (1 small to 3 big), a shot's time left, and what it is.

"h" ᵉᶜc̲omponents< "pos:2 vel:2 dir size life ship rock shot"
ᵉᶜc̲omponents< expands to
ʰw̲orld ← { n → (n c̲at 19) r̲eshape 0.0 }
ʰp̲os ← { W → (3 4) s̲elect₂ W }
ʰh̲asPos ← { W → 0 < 2 s̲elect₂ W }
ʰs̲etPos ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (2 3 4) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropPos ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 2 = r̲ange 19 }
ʰv̲el ← { W → (6 7) s̲elect₂ W }
ʰh̲asVel ← { W → 0 < 5 s̲elect₂ W }
ʰs̲etVel ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (5 6 7) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropVel ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 5 = r̲ange 19 }
ʰd̲ir ← { W → (9) s̲elect₂ W }
ʰh̲asDir ← { W → 0 < 8 s̲elect₂ W }
ʰs̲etDir ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (8 9) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropDir ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 8 = r̲ange 19 }
ʰs̲ize ← { W → (11) s̲elect₂ W }
ʰh̲asSize ← { W → 0 < 10 s̲elect₂ W }
ʰs̲etSize ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (10 11) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropSize ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 10 = r̲ange 19 }
ʰl̲ife ← { W → (13) s̲elect₂ W }
ʰh̲asLife ← { W → 0 < 12 s̲elect₂ W }
ʰs̲etLife ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (12 13) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropLife ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 12 = r̲ange 19 }
ʰs̲hip ← { W → (15) s̲elect₂ W }
ʰh̲asShip ← { W → 0 < 14 s̲elect₂ W }
ʰs̲etShip ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (14 15) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShip ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 14 = r̲ange 19 }
ʰr̲ock ← { W → (17) s̲elect₂ W }
ʰh̲asRock ← { W → 0 < 16 s̲elect₂ W }
ʰs̲etRock ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (16 17) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropRock ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 16 = r̲ange 19 }
ʰs̲hot ← { W → (19) s̲elect₂ W }
ʰh̲asShot ← { W → 0 < 18 s̲elect₂ W }
ʰs̲etShot ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (18 19) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShot ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 18 = r̲ange 19 }

ʰd̲ropPos : Float -> Int -> Float

function (private) · line 20

The layout: where it is (x then y, in tiles, y down), how fast it moves, the ship's heading (radians, 0 to the right), a rock's size (1 small to 3 big), a shot's time left, and what it is.

"h" ᵉᶜc̲omponents< "pos:2 vel:2 dir size life ship rock shot"
ᵉᶜc̲omponents< expands to
ʰw̲orld ← { n → (n c̲at 19) r̲eshape 0.0 }
ʰp̲os ← { W → (3 4) s̲elect₂ W }
ʰh̲asPos ← { W → 0 < 2 s̲elect₂ W }
ʰs̲etPos ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (2 3 4) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropPos ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 2 = r̲ange 19 }
ʰv̲el ← { W → (6 7) s̲elect₂ W }
ʰh̲asVel ← { W → 0 < 5 s̲elect₂ W }
ʰs̲etVel ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (5 6 7) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropVel ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 5 = r̲ange 19 }
ʰd̲ir ← { W → (9) s̲elect₂ W }
ʰh̲asDir ← { W → 0 < 8 s̲elect₂ W }
ʰs̲etDir ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (8 9) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropDir ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 8 = r̲ange 19 }
ʰs̲ize ← { W → (11) s̲elect₂ W }
ʰh̲asSize ← { W → 0 < 10 s̲elect₂ W }
ʰs̲etSize ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (10 11) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropSize ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 10 = r̲ange 19 }
ʰl̲ife ← { W → (13) s̲elect₂ W }
ʰh̲asLife ← { W → 0 < 12 s̲elect₂ W }
ʰs̲etLife ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (12 13) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropLife ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 12 = r̲ange 19 }
ʰs̲hip ← { W → (15) s̲elect₂ W }
ʰh̲asShip ← { W → 0 < 14 s̲elect₂ W }
ʰs̲etShip ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (14 15) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShip ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 14 = r̲ange 19 }
ʰr̲ock ← { W → (17) s̲elect₂ W }
ʰh̲asRock ← { W → 0 < 16 s̲elect₂ W }
ʰs̲etRock ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (16 17) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropRock ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 16 = r̲ange 19 }
ʰs̲hot ← { W → (19) s̲elect₂ W }
ʰh̲asShot ← { W → 0 < 18 s̲elect₂ W }
ʰs̲etShot ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (18 19) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShot ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 18 = r̲ange 19 }

ʰv̲el : a -> a

function (private) · line 20

The layout: where it is (x then y, in tiles, y down), how fast it moves, the ship's heading (radians, 0 to the right), a rock's size (1 small to 3 big), a shot's time left, and what it is.

"h" ᵉᶜc̲omponents< "pos:2 vel:2 dir size life ship rock shot"
ᵉᶜc̲omponents< expands to
ʰw̲orld ← { n → (n c̲at 19) r̲eshape 0.0 }
ʰp̲os ← { W → (3 4) s̲elect₂ W }
ʰh̲asPos ← { W → 0 < 2 s̲elect₂ W }
ʰs̲etPos ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (2 3 4) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropPos ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 2 = r̲ange 19 }
ʰv̲el ← { W → (6 7) s̲elect₂ W }
ʰh̲asVel ← { W → 0 < 5 s̲elect₂ W }
ʰs̲etVel ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (5 6 7) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropVel ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 5 = r̲ange 19 }
ʰd̲ir ← { W → (9) s̲elect₂ W }
ʰh̲asDir ← { W → 0 < 8 s̲elect₂ W }
ʰs̲etDir ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (8 9) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropDir ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 8 = r̲ange 19 }
ʰs̲ize ← { W → (11) s̲elect₂ W }
ʰh̲asSize ← { W → 0 < 10 s̲elect₂ W }
ʰs̲etSize ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (10 11) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropSize ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 10 = r̲ange 19 }
ʰl̲ife ← { W → (13) s̲elect₂ W }
ʰh̲asLife ← { W → 0 < 12 s̲elect₂ W }
ʰs̲etLife ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (12 13) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropLife ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 12 = r̲ange 19 }
ʰs̲hip ← { W → (15) s̲elect₂ W }
ʰh̲asShip ← { W → 0 < 14 s̲elect₂ W }
ʰs̲etShip ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (14 15) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShip ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 14 = r̲ange 19 }
ʰr̲ock ← { W → (17) s̲elect₂ W }
ʰh̲asRock ← { W → 0 < 16 s̲elect₂ W }
ʰs̲etRock ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (16 17) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropRock ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 16 = r̲ange 19 }
ʰs̲hot ← { W → (19) s̲elect₂ W }
ʰh̲asShot ← { W → 0 < 18 s̲elect₂ W }
ʰs̲etShot ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (18 19) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShot ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 18 = r̲ange 19 }

ʰh̲asVel : (Num a, Truthy b) => a -> b

function (private) · line 20

The layout: where it is (x then y, in tiles, y down), how fast it moves, the ship's heading (radians, 0 to the right), a rock's size (1 small to 3 big), a shot's time left, and what it is.

"h" ᵉᶜc̲omponents< "pos:2 vel:2 dir size life ship rock shot"
ᵉᶜc̲omponents< expands to
ʰw̲orld ← { n → (n c̲at 19) r̲eshape 0.0 }
ʰp̲os ← { W → (3 4) s̲elect₂ W }
ʰh̲asPos ← { W → 0 < 2 s̲elect₂ W }
ʰs̲etPos ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (2 3 4) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropPos ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 2 = r̲ange 19 }
ʰv̲el ← { W → (6 7) s̲elect₂ W }
ʰh̲asVel ← { W → 0 < 5 s̲elect₂ W }
ʰs̲etVel ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (5 6 7) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropVel ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 5 = r̲ange 19 }
ʰd̲ir ← { W → (9) s̲elect₂ W }
ʰh̲asDir ← { W → 0 < 8 s̲elect₂ W }
ʰs̲etDir ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (8 9) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropDir ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 8 = r̲ange 19 }
ʰs̲ize ← { W → (11) s̲elect₂ W }
ʰh̲asSize ← { W → 0 < 10 s̲elect₂ W }
ʰs̲etSize ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (10 11) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropSize ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 10 = r̲ange 19 }
ʰl̲ife ← { W → (13) s̲elect₂ W }
ʰh̲asLife ← { W → 0 < 12 s̲elect₂ W }
ʰs̲etLife ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (12 13) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropLife ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 12 = r̲ange 19 }
ʰs̲hip ← { W → (15) s̲elect₂ W }
ʰh̲asShip ← { W → 0 < 14 s̲elect₂ W }
ʰs̲etShip ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (14 15) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShip ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 14 = r̲ange 19 }
ʰr̲ock ← { W → (17) s̲elect₂ W }
ʰh̲asRock ← { W → 0 < 16 s̲elect₂ W }
ʰs̲etRock ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (16 17) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropRock ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 16 = r̲ange 19 }
ʰs̲hot ← { W → (19) s̲elect₂ W }
ʰh̲asShot ← { W → 0 < 18 s̲elect₂ W }
ʰs̲etShot ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (18 19) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShot ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 18 = r̲ange 19 }

ʰs̲etVel : Float -> (Int, Float) -> Float

function (private) · line 20

The layout: where it is (x then y, in tiles, y down), how fast it moves, the ship's heading (radians, 0 to the right), a rock's size (1 small to 3 big), a shot's time left, and what it is.

"h" ᵉᶜc̲omponents< "pos:2 vel:2 dir size life ship rock shot"
ᵉᶜc̲omponents< expands to
ʰw̲orld ← { n → (n c̲at 19) r̲eshape 0.0 }
ʰp̲os ← { W → (3 4) s̲elect₂ W }
ʰh̲asPos ← { W → 0 < 2 s̲elect₂ W }
ʰs̲etPos ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (2 3 4) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropPos ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 2 = r̲ange 19 }
ʰv̲el ← { W → (6 7) s̲elect₂ W }
ʰh̲asVel ← { W → 0 < 5 s̲elect₂ W }
ʰs̲etVel ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (5 6 7) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropVel ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 5 = r̲ange 19 }
ʰd̲ir ← { W → (9) s̲elect₂ W }
ʰh̲asDir ← { W → 0 < 8 s̲elect₂ W }
ʰs̲etDir ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (8 9) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropDir ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 8 = r̲ange 19 }
ʰs̲ize ← { W → (11) s̲elect₂ W }
ʰh̲asSize ← { W → 0 < 10 s̲elect₂ W }
ʰs̲etSize ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (10 11) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropSize ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 10 = r̲ange 19 }
ʰl̲ife ← { W → (13) s̲elect₂ W }
ʰh̲asLife ← { W → 0 < 12 s̲elect₂ W }
ʰs̲etLife ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (12 13) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropLife ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 12 = r̲ange 19 }
ʰs̲hip ← { W → (15) s̲elect₂ W }
ʰh̲asShip ← { W → 0 < 14 s̲elect₂ W }
ʰs̲etShip ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (14 15) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShip ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 14 = r̲ange 19 }
ʰr̲ock ← { W → (17) s̲elect₂ W }
ʰh̲asRock ← { W → 0 < 16 s̲elect₂ W }
ʰs̲etRock ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (16 17) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropRock ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 16 = r̲ange 19 }
ʰs̲hot ← { W → (19) s̲elect₂ W }
ʰh̲asShot ← { W → 0 < 18 s̲elect₂ W }
ʰs̲etShot ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (18 19) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShot ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 18 = r̲ange 19 }

ʰd̲ropVel : Float -> Int -> Float

function (private) · line 20

The layout: where it is (x then y, in tiles, y down), how fast it moves, the ship's heading (radians, 0 to the right), a rock's size (1 small to 3 big), a shot's time left, and what it is.

"h" ᵉᶜc̲omponents< "pos:2 vel:2 dir size life ship rock shot"
ᵉᶜc̲omponents< expands to
ʰw̲orld ← { n → (n c̲at 19) r̲eshape 0.0 }
ʰp̲os ← { W → (3 4) s̲elect₂ W }
ʰh̲asPos ← { W → 0 < 2 s̲elect₂ W }
ʰs̲etPos ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (2 3 4) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropPos ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 2 = r̲ange 19 }
ʰv̲el ← { W → (6 7) s̲elect₂ W }
ʰh̲asVel ← { W → 0 < 5 s̲elect₂ W }
ʰs̲etVel ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (5 6 7) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropVel ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 5 = r̲ange 19 }
ʰd̲ir ← { W → (9) s̲elect₂ W }
ʰh̲asDir ← { W → 0 < 8 s̲elect₂ W }
ʰs̲etDir ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (8 9) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropDir ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 8 = r̲ange 19 }
ʰs̲ize ← { W → (11) s̲elect₂ W }
ʰh̲asSize ← { W → 0 < 10 s̲elect₂ W }
ʰs̲etSize ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (10 11) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropSize ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 10 = r̲ange 19 }
ʰl̲ife ← { W → (13) s̲elect₂ W }
ʰh̲asLife ← { W → 0 < 12 s̲elect₂ W }
ʰs̲etLife ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (12 13) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropLife ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 12 = r̲ange 19 }
ʰs̲hip ← { W → (15) s̲elect₂ W }
ʰh̲asShip ← { W → 0 < 14 s̲elect₂ W }
ʰs̲etShip ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (14 15) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShip ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 14 = r̲ange 19 }
ʰr̲ock ← { W → (17) s̲elect₂ W }
ʰh̲asRock ← { W → 0 < 16 s̲elect₂ W }
ʰs̲etRock ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (16 17) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropRock ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 16 = r̲ange 19 }
ʰs̲hot ← { W → (19) s̲elect₂ W }
ʰh̲asShot ← { W → 0 < 18 s̲elect₂ W }
ʰs̲etShot ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (18 19) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShot ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 18 = r̲ange 19 }

ʰd̲ir : a -> a

function (private) · line 20

The layout: where it is (x then y, in tiles, y down), how fast it moves, the ship's heading (radians, 0 to the right), a rock's size (1 small to 3 big), a shot's time left, and what it is.

"h" ᵉᶜc̲omponents< "pos:2 vel:2 dir size life ship rock shot"
ᵉᶜc̲omponents< expands to
ʰw̲orld ← { n → (n c̲at 19) r̲eshape 0.0 }
ʰp̲os ← { W → (3 4) s̲elect₂ W }
ʰh̲asPos ← { W → 0 < 2 s̲elect₂ W }
ʰs̲etPos ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (2 3 4) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropPos ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 2 = r̲ange 19 }
ʰv̲el ← { W → (6 7) s̲elect₂ W }
ʰh̲asVel ← { W → 0 < 5 s̲elect₂ W }
ʰs̲etVel ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (5 6 7) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropVel ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 5 = r̲ange 19 }
ʰd̲ir ← { W → (9) s̲elect₂ W }
ʰh̲asDir ← { W → 0 < 8 s̲elect₂ W }
ʰs̲etDir ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (8 9) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropDir ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 8 = r̲ange 19 }
ʰs̲ize ← { W → (11) s̲elect₂ W }
ʰh̲asSize ← { W → 0 < 10 s̲elect₂ W }
ʰs̲etSize ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (10 11) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropSize ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 10 = r̲ange 19 }
ʰl̲ife ← { W → (13) s̲elect₂ W }
ʰh̲asLife ← { W → 0 < 12 s̲elect₂ W }
ʰs̲etLife ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (12 13) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropLife ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 12 = r̲ange 19 }
ʰs̲hip ← { W → (15) s̲elect₂ W }
ʰh̲asShip ← { W → 0 < 14 s̲elect₂ W }
ʰs̲etShip ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (14 15) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShip ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 14 = r̲ange 19 }
ʰr̲ock ← { W → (17) s̲elect₂ W }
ʰh̲asRock ← { W → 0 < 16 s̲elect₂ W }
ʰs̲etRock ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (16 17) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropRock ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 16 = r̲ange 19 }
ʰs̲hot ← { W → (19) s̲elect₂ W }
ʰh̲asShot ← { W → 0 < 18 s̲elect₂ W }
ʰs̲etShot ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (18 19) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShot ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 18 = r̲ange 19 }

ʰh̲asDir : (Num a, Truthy b) => a -> b

function (private) · line 20

The layout: where it is (x then y, in tiles, y down), how fast it moves, the ship's heading (radians, 0 to the right), a rock's size (1 small to 3 big), a shot's time left, and what it is.

"h" ᵉᶜc̲omponents< "pos:2 vel:2 dir size life ship rock shot"
ᵉᶜc̲omponents< expands to
ʰw̲orld ← { n → (n c̲at 19) r̲eshape 0.0 }
ʰp̲os ← { W → (3 4) s̲elect₂ W }
ʰh̲asPos ← { W → 0 < 2 s̲elect₂ W }
ʰs̲etPos ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (2 3 4) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropPos ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 2 = r̲ange 19 }
ʰv̲el ← { W → (6 7) s̲elect₂ W }
ʰh̲asVel ← { W → 0 < 5 s̲elect₂ W }
ʰs̲etVel ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (5 6 7) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropVel ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 5 = r̲ange 19 }
ʰd̲ir ← { W → (9) s̲elect₂ W }
ʰh̲asDir ← { W → 0 < 8 s̲elect₂ W }
ʰs̲etDir ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (8 9) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropDir ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 8 = r̲ange 19 }
ʰs̲ize ← { W → (11) s̲elect₂ W }
ʰh̲asSize ← { W → 0 < 10 s̲elect₂ W }
ʰs̲etSize ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (10 11) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropSize ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 10 = r̲ange 19 }
ʰl̲ife ← { W → (13) s̲elect₂ W }
ʰh̲asLife ← { W → 0 < 12 s̲elect₂ W }
ʰs̲etLife ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (12 13) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropLife ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 12 = r̲ange 19 }
ʰs̲hip ← { W → (15) s̲elect₂ W }
ʰh̲asShip ← { W → 0 < 14 s̲elect₂ W }
ʰs̲etShip ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (14 15) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShip ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 14 = r̲ange 19 }
ʰr̲ock ← { W → (17) s̲elect₂ W }
ʰh̲asRock ← { W → 0 < 16 s̲elect₂ W }
ʰs̲etRock ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (16 17) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropRock ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 16 = r̲ange 19 }
ʰs̲hot ← { W → (19) s̲elect₂ W }
ʰh̲asShot ← { W → 0 < 18 s̲elect₂ W }
ʰs̲etShot ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (18 19) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShot ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 18 = r̲ange 19 }

ʰs̲etDir : Float -> (Int, Float) -> Float

function (private) · line 20

The layout: where it is (x then y, in tiles, y down), how fast it moves, the ship's heading (radians, 0 to the right), a rock's size (1 small to 3 big), a shot's time left, and what it is.

"h" ᵉᶜc̲omponents< "pos:2 vel:2 dir size life ship rock shot"
ᵉᶜc̲omponents< expands to
ʰw̲orld ← { n → (n c̲at 19) r̲eshape 0.0 }
ʰp̲os ← { W → (3 4) s̲elect₂ W }
ʰh̲asPos ← { W → 0 < 2 s̲elect₂ W }
ʰs̲etPos ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (2 3 4) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropPos ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 2 = r̲ange 19 }
ʰv̲el ← { W → (6 7) s̲elect₂ W }
ʰh̲asVel ← { W → 0 < 5 s̲elect₂ W }
ʰs̲etVel ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (5 6 7) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropVel ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 5 = r̲ange 19 }
ʰd̲ir ← { W → (9) s̲elect₂ W }
ʰh̲asDir ← { W → 0 < 8 s̲elect₂ W }
ʰs̲etDir ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (8 9) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropDir ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 8 = r̲ange 19 }
ʰs̲ize ← { W → (11) s̲elect₂ W }
ʰh̲asSize ← { W → 0 < 10 s̲elect₂ W }
ʰs̲etSize ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (10 11) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropSize ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 10 = r̲ange 19 }
ʰl̲ife ← { W → (13) s̲elect₂ W }
ʰh̲asLife ← { W → 0 < 12 s̲elect₂ W }
ʰs̲etLife ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (12 13) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropLife ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 12 = r̲ange 19 }
ʰs̲hip ← { W → (15) s̲elect₂ W }
ʰh̲asShip ← { W → 0 < 14 s̲elect₂ W }
ʰs̲etShip ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (14 15) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShip ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 14 = r̲ange 19 }
ʰr̲ock ← { W → (17) s̲elect₂ W }
ʰh̲asRock ← { W → 0 < 16 s̲elect₂ W }
ʰs̲etRock ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (16 17) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropRock ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 16 = r̲ange 19 }
ʰs̲hot ← { W → (19) s̲elect₂ W }
ʰh̲asShot ← { W → 0 < 18 s̲elect₂ W }
ʰs̲etShot ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (18 19) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShot ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 18 = r̲ange 19 }

ʰd̲ropDir : Float -> Int -> Float

function (private) · line 20

The layout: where it is (x then y, in tiles, y down), how fast it moves, the ship's heading (radians, 0 to the right), a rock's size (1 small to 3 big), a shot's time left, and what it is.

"h" ᵉᶜc̲omponents< "pos:2 vel:2 dir size life ship rock shot"
ᵉᶜc̲omponents< expands to
ʰw̲orld ← { n → (n c̲at 19) r̲eshape 0.0 }
ʰp̲os ← { W → (3 4) s̲elect₂ W }
ʰh̲asPos ← { W → 0 < 2 s̲elect₂ W }
ʰs̲etPos ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (2 3 4) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropPos ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 2 = r̲ange 19 }
ʰv̲el ← { W → (6 7) s̲elect₂ W }
ʰh̲asVel ← { W → 0 < 5 s̲elect₂ W }
ʰs̲etVel ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (5 6 7) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropVel ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 5 = r̲ange 19 }
ʰd̲ir ← { W → (9) s̲elect₂ W }
ʰh̲asDir ← { W → 0 < 8 s̲elect₂ W }
ʰs̲etDir ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (8 9) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropDir ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 8 = r̲ange 19 }
ʰs̲ize ← { W → (11) s̲elect₂ W }
ʰh̲asSize ← { W → 0 < 10 s̲elect₂ W }
ʰs̲etSize ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (10 11) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropSize ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 10 = r̲ange 19 }
ʰl̲ife ← { W → (13) s̲elect₂ W }
ʰh̲asLife ← { W → 0 < 12 s̲elect₂ W }
ʰs̲etLife ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (12 13) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropLife ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 12 = r̲ange 19 }
ʰs̲hip ← { W → (15) s̲elect₂ W }
ʰh̲asShip ← { W → 0 < 14 s̲elect₂ W }
ʰs̲etShip ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (14 15) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShip ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 14 = r̲ange 19 }
ʰr̲ock ← { W → (17) s̲elect₂ W }
ʰh̲asRock ← { W → 0 < 16 s̲elect₂ W }
ʰs̲etRock ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (16 17) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropRock ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 16 = r̲ange 19 }
ʰs̲hot ← { W → (19) s̲elect₂ W }
ʰh̲asShot ← { W → 0 < 18 s̲elect₂ W }
ʰs̲etShot ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (18 19) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShot ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 18 = r̲ange 19 }

ʰs̲ize : a -> a

function (private) · line 20

The layout: where it is (x then y, in tiles, y down), how fast it moves, the ship's heading (radians, 0 to the right), a rock's size (1 small to 3 big), a shot's time left, and what it is.

"h" ᵉᶜc̲omponents< "pos:2 vel:2 dir size life ship rock shot"
ᵉᶜc̲omponents< expands to
ʰw̲orld ← { n → (n c̲at 19) r̲eshape 0.0 }
ʰp̲os ← { W → (3 4) s̲elect₂ W }
ʰh̲asPos ← { W → 0 < 2 s̲elect₂ W }
ʰs̲etPos ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (2 3 4) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropPos ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 2 = r̲ange 19 }
ʰv̲el ← { W → (6 7) s̲elect₂ W }
ʰh̲asVel ← { W → 0 < 5 s̲elect₂ W }
ʰs̲etVel ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (5 6 7) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropVel ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 5 = r̲ange 19 }
ʰd̲ir ← { W → (9) s̲elect₂ W }
ʰh̲asDir ← { W → 0 < 8 s̲elect₂ W }
ʰs̲etDir ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (8 9) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropDir ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 8 = r̲ange 19 }
ʰs̲ize ← { W → (11) s̲elect₂ W }
ʰh̲asSize ← { W → 0 < 10 s̲elect₂ W }
ʰs̲etSize ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (10 11) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropSize ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 10 = r̲ange 19 }
ʰl̲ife ← { W → (13) s̲elect₂ W }
ʰh̲asLife ← { W → 0 < 12 s̲elect₂ W }
ʰs̲etLife ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (12 13) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropLife ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 12 = r̲ange 19 }
ʰs̲hip ← { W → (15) s̲elect₂ W }
ʰh̲asShip ← { W → 0 < 14 s̲elect₂ W }
ʰs̲etShip ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (14 15) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShip ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 14 = r̲ange 19 }
ʰr̲ock ← { W → (17) s̲elect₂ W }
ʰh̲asRock ← { W → 0 < 16 s̲elect₂ W }
ʰs̲etRock ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (16 17) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropRock ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 16 = r̲ange 19 }
ʰs̲hot ← { W → (19) s̲elect₂ W }
ʰh̲asShot ← { W → 0 < 18 s̲elect₂ W }
ʰs̲etShot ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (18 19) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShot ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 18 = r̲ange 19 }

ʰh̲asSize : (Num a, Truthy b) => a -> b

function (private) · line 20

The layout: where it is (x then y, in tiles, y down), how fast it moves, the ship's heading (radians, 0 to the right), a rock's size (1 small to 3 big), a shot's time left, and what it is.

"h" ᵉᶜc̲omponents< "pos:2 vel:2 dir size life ship rock shot"
ᵉᶜc̲omponents< expands to
ʰw̲orld ← { n → (n c̲at 19) r̲eshape 0.0 }
ʰp̲os ← { W → (3 4) s̲elect₂ W }
ʰh̲asPos ← { W → 0 < 2 s̲elect₂ W }
ʰs̲etPos ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (2 3 4) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropPos ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 2 = r̲ange 19 }
ʰv̲el ← { W → (6 7) s̲elect₂ W }
ʰh̲asVel ← { W → 0 < 5 s̲elect₂ W }
ʰs̲etVel ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (5 6 7) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropVel ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 5 = r̲ange 19 }
ʰd̲ir ← { W → (9) s̲elect₂ W }
ʰh̲asDir ← { W → 0 < 8 s̲elect₂ W }
ʰs̲etDir ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (8 9) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropDir ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 8 = r̲ange 19 }
ʰs̲ize ← { W → (11) s̲elect₂ W }
ʰh̲asSize ← { W → 0 < 10 s̲elect₂ W }
ʰs̲etSize ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (10 11) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropSize ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 10 = r̲ange 19 }
ʰl̲ife ← { W → (13) s̲elect₂ W }
ʰh̲asLife ← { W → 0 < 12 s̲elect₂ W }
ʰs̲etLife ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (12 13) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropLife ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 12 = r̲ange 19 }
ʰs̲hip ← { W → (15) s̲elect₂ W }
ʰh̲asShip ← { W → 0 < 14 s̲elect₂ W }
ʰs̲etShip ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (14 15) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShip ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 14 = r̲ange 19 }
ʰr̲ock ← { W → (17) s̲elect₂ W }
ʰh̲asRock ← { W → 0 < 16 s̲elect₂ W }
ʰs̲etRock ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (16 17) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropRock ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 16 = r̲ange 19 }
ʰs̲hot ← { W → (19) s̲elect₂ W }
ʰh̲asShot ← { W → 0 < 18 s̲elect₂ W }
ʰs̲etShot ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (18 19) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShot ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 18 = r̲ange 19 }

ʰs̲etSize : Float -> (Int, Float) -> Float

function (private) · line 20

The layout: where it is (x then y, in tiles, y down), how fast it moves, the ship's heading (radians, 0 to the right), a rock's size (1 small to 3 big), a shot's time left, and what it is.

"h" ᵉᶜc̲omponents< "pos:2 vel:2 dir size life ship rock shot"
ᵉᶜc̲omponents< expands to
ʰw̲orld ← { n → (n c̲at 19) r̲eshape 0.0 }
ʰp̲os ← { W → (3 4) s̲elect₂ W }
ʰh̲asPos ← { W → 0 < 2 s̲elect₂ W }
ʰs̲etPos ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (2 3 4) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropPos ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 2 = r̲ange 19 }
ʰv̲el ← { W → (6 7) s̲elect₂ W }
ʰh̲asVel ← { W → 0 < 5 s̲elect₂ W }
ʰs̲etVel ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (5 6 7) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropVel ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 5 = r̲ange 19 }
ʰd̲ir ← { W → (9) s̲elect₂ W }
ʰh̲asDir ← { W → 0 < 8 s̲elect₂ W }
ʰs̲etDir ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (8 9) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropDir ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 8 = r̲ange 19 }
ʰs̲ize ← { W → (11) s̲elect₂ W }
ʰh̲asSize ← { W → 0 < 10 s̲elect₂ W }
ʰs̲etSize ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (10 11) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropSize ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 10 = r̲ange 19 }
ʰl̲ife ← { W → (13) s̲elect₂ W }
ʰh̲asLife ← { W → 0 < 12 s̲elect₂ W }
ʰs̲etLife ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (12 13) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropLife ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 12 = r̲ange 19 }
ʰs̲hip ← { W → (15) s̲elect₂ W }
ʰh̲asShip ← { W → 0 < 14 s̲elect₂ W }
ʰs̲etShip ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (14 15) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShip ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 14 = r̲ange 19 }
ʰr̲ock ← { W → (17) s̲elect₂ W }
ʰh̲asRock ← { W → 0 < 16 s̲elect₂ W }
ʰs̲etRock ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (16 17) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropRock ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 16 = r̲ange 19 }
ʰs̲hot ← { W → (19) s̲elect₂ W }
ʰh̲asShot ← { W → 0 < 18 s̲elect₂ W }
ʰs̲etShot ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (18 19) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShot ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 18 = r̲ange 19 }

ʰd̲ropSize : Float -> Int -> Float

function (private) · line 20

The layout: where it is (x then y, in tiles, y down), how fast it moves, the ship's heading (radians, 0 to the right), a rock's size (1 small to 3 big), a shot's time left, and what it is.

"h" ᵉᶜc̲omponents< "pos:2 vel:2 dir size life ship rock shot"
ᵉᶜc̲omponents< expands to
ʰw̲orld ← { n → (n c̲at 19) r̲eshape 0.0 }
ʰp̲os ← { W → (3 4) s̲elect₂ W }
ʰh̲asPos ← { W → 0 < 2 s̲elect₂ W }
ʰs̲etPos ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (2 3 4) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropPos ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 2 = r̲ange 19 }
ʰv̲el ← { W → (6 7) s̲elect₂ W }
ʰh̲asVel ← { W → 0 < 5 s̲elect₂ W }
ʰs̲etVel ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (5 6 7) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropVel ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 5 = r̲ange 19 }
ʰd̲ir ← { W → (9) s̲elect₂ W }
ʰh̲asDir ← { W → 0 < 8 s̲elect₂ W }
ʰs̲etDir ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (8 9) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropDir ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 8 = r̲ange 19 }
ʰs̲ize ← { W → (11) s̲elect₂ W }
ʰh̲asSize ← { W → 0 < 10 s̲elect₂ W }
ʰs̲etSize ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (10 11) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropSize ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 10 = r̲ange 19 }
ʰl̲ife ← { W → (13) s̲elect₂ W }
ʰh̲asLife ← { W → 0 < 12 s̲elect₂ W }
ʰs̲etLife ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (12 13) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropLife ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 12 = r̲ange 19 }
ʰs̲hip ← { W → (15) s̲elect₂ W }
ʰh̲asShip ← { W → 0 < 14 s̲elect₂ W }
ʰs̲etShip ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (14 15) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShip ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 14 = r̲ange 19 }
ʰr̲ock ← { W → (17) s̲elect₂ W }
ʰh̲asRock ← { W → 0 < 16 s̲elect₂ W }
ʰs̲etRock ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (16 17) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropRock ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 16 = r̲ange 19 }
ʰs̲hot ← { W → (19) s̲elect₂ W }
ʰh̲asShot ← { W → 0 < 18 s̲elect₂ W }
ʰs̲etShot ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (18 19) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShot ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 18 = r̲ange 19 }

ʰl̲ife : a -> a

function (private) · line 20

The layout: where it is (x then y, in tiles, y down), how fast it moves, the ship's heading (radians, 0 to the right), a rock's size (1 small to 3 big), a shot's time left, and what it is.

"h" ᵉᶜc̲omponents< "pos:2 vel:2 dir size life ship rock shot"
ᵉᶜc̲omponents< expands to
ʰw̲orld ← { n → (n c̲at 19) r̲eshape 0.0 }
ʰp̲os ← { W → (3 4) s̲elect₂ W }
ʰh̲asPos ← { W → 0 < 2 s̲elect₂ W }
ʰs̲etPos ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (2 3 4) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropPos ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 2 = r̲ange 19 }
ʰv̲el ← { W → (6 7) s̲elect₂ W }
ʰh̲asVel ← { W → 0 < 5 s̲elect₂ W }
ʰs̲etVel ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (5 6 7) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropVel ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 5 = r̲ange 19 }
ʰd̲ir ← { W → (9) s̲elect₂ W }
ʰh̲asDir ← { W → 0 < 8 s̲elect₂ W }
ʰs̲etDir ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (8 9) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropDir ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 8 = r̲ange 19 }
ʰs̲ize ← { W → (11) s̲elect₂ W }
ʰh̲asSize ← { W → 0 < 10 s̲elect₂ W }
ʰs̲etSize ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (10 11) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropSize ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 10 = r̲ange 19 }
ʰl̲ife ← { W → (13) s̲elect₂ W }
ʰh̲asLife ← { W → 0 < 12 s̲elect₂ W }
ʰs̲etLife ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (12 13) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropLife ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 12 = r̲ange 19 }
ʰs̲hip ← { W → (15) s̲elect₂ W }
ʰh̲asShip ← { W → 0 < 14 s̲elect₂ W }
ʰs̲etShip ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (14 15) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShip ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 14 = r̲ange 19 }
ʰr̲ock ← { W → (17) s̲elect₂ W }
ʰh̲asRock ← { W → 0 < 16 s̲elect₂ W }
ʰs̲etRock ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (16 17) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropRock ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 16 = r̲ange 19 }
ʰs̲hot ← { W → (19) s̲elect₂ W }
ʰh̲asShot ← { W → 0 < 18 s̲elect₂ W }
ʰs̲etShot ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (18 19) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShot ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 18 = r̲ange 19 }
Used in: ʰa̲ge

ʰh̲asLife : (Num a, Truthy b) => a -> b

function (private) · line 20

The layout: where it is (x then y, in tiles, y down), how fast it moves, the ship's heading (radians, 0 to the right), a rock's size (1 small to 3 big), a shot's time left, and what it is.

"h" ᵉᶜc̲omponents< "pos:2 vel:2 dir size life ship rock shot"
ᵉᶜc̲omponents< expands to
ʰw̲orld ← { n → (n c̲at 19) r̲eshape 0.0 }
ʰp̲os ← { W → (3 4) s̲elect₂ W }
ʰh̲asPos ← { W → 0 < 2 s̲elect₂ W }
ʰs̲etPos ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (2 3 4) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropPos ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 2 = r̲ange 19 }
ʰv̲el ← { W → (6 7) s̲elect₂ W }
ʰh̲asVel ← { W → 0 < 5 s̲elect₂ W }
ʰs̲etVel ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (5 6 7) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropVel ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 5 = r̲ange 19 }
ʰd̲ir ← { W → (9) s̲elect₂ W }
ʰh̲asDir ← { W → 0 < 8 s̲elect₂ W }
ʰs̲etDir ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (8 9) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropDir ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 8 = r̲ange 19 }
ʰs̲ize ← { W → (11) s̲elect₂ W }
ʰh̲asSize ← { W → 0 < 10 s̲elect₂ W }
ʰs̲etSize ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (10 11) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropSize ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 10 = r̲ange 19 }
ʰl̲ife ← { W → (13) s̲elect₂ W }
ʰh̲asLife ← { W → 0 < 12 s̲elect₂ W }
ʰs̲etLife ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (12 13) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropLife ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 12 = r̲ange 19 }
ʰs̲hip ← { W → (15) s̲elect₂ W }
ʰh̲asShip ← { W → 0 < 14 s̲elect₂ W }
ʰs̲etShip ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (14 15) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShip ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 14 = r̲ange 19 }
ʰr̲ock ← { W → (17) s̲elect₂ W }
ʰh̲asRock ← { W → 0 < 16 s̲elect₂ W }
ʰs̲etRock ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (16 17) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropRock ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 16 = r̲ange 19 }
ʰs̲hot ← { W → (19) s̲elect₂ W }
ʰh̲asShot ← { W → 0 < 18 s̲elect₂ W }
ʰs̲etShot ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (18 19) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShot ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 18 = r̲ange 19 }

ʰs̲etLife : Float -> (Int, Float) -> Float

function (private) · line 20

The layout: where it is (x then y, in tiles, y down), how fast it moves, the ship's heading (radians, 0 to the right), a rock's size (1 small to 3 big), a shot's time left, and what it is.

"h" ᵉᶜc̲omponents< "pos:2 vel:2 dir size life ship rock shot"
ᵉᶜc̲omponents< expands to
ʰw̲orld ← { n → (n c̲at 19) r̲eshape 0.0 }
ʰp̲os ← { W → (3 4) s̲elect₂ W }
ʰh̲asPos ← { W → 0 < 2 s̲elect₂ W }
ʰs̲etPos ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (2 3 4) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropPos ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 2 = r̲ange 19 }
ʰv̲el ← { W → (6 7) s̲elect₂ W }
ʰh̲asVel ← { W → 0 < 5 s̲elect₂ W }
ʰs̲etVel ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (5 6 7) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropVel ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 5 = r̲ange 19 }
ʰd̲ir ← { W → (9) s̲elect₂ W }
ʰh̲asDir ← { W → 0 < 8 s̲elect₂ W }
ʰs̲etDir ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (8 9) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropDir ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 8 = r̲ange 19 }
ʰs̲ize ← { W → (11) s̲elect₂ W }
ʰh̲asSize ← { W → 0 < 10 s̲elect₂ W }
ʰs̲etSize ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (10 11) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropSize ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 10 = r̲ange 19 }
ʰl̲ife ← { W → (13) s̲elect₂ W }
ʰh̲asLife ← { W → 0 < 12 s̲elect₂ W }
ʰs̲etLife ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (12 13) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropLife ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 12 = r̲ange 19 }
ʰs̲hip ← { W → (15) s̲elect₂ W }
ʰh̲asShip ← { W → 0 < 14 s̲elect₂ W }
ʰs̲etShip ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (14 15) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShip ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 14 = r̲ange 19 }
ʰr̲ock ← { W → (17) s̲elect₂ W }
ʰh̲asRock ← { W → 0 < 16 s̲elect₂ W }
ʰs̲etRock ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (16 17) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropRock ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 16 = r̲ange 19 }
ʰs̲hot ← { W → (19) s̲elect₂ W }
ʰh̲asShot ← { W → 0 < 18 s̲elect₂ W }
ʰs̲etShot ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (18 19) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShot ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 18 = r̲ange 19 }
Used in: ʰa̲ge, ʰf̲ire

ʰd̲ropLife : Float -> Int -> Float

function (private) · line 20

The layout: where it is (x then y, in tiles, y down), how fast it moves, the ship's heading (radians, 0 to the right), a rock's size (1 small to 3 big), a shot's time left, and what it is.

"h" ᵉᶜc̲omponents< "pos:2 vel:2 dir size life ship rock shot"
ᵉᶜc̲omponents< expands to
ʰw̲orld ← { n → (n c̲at 19) r̲eshape 0.0 }
ʰp̲os ← { W → (3 4) s̲elect₂ W }
ʰh̲asPos ← { W → 0 < 2 s̲elect₂ W }
ʰs̲etPos ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (2 3 4) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropPos ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 2 = r̲ange 19 }
ʰv̲el ← { W → (6 7) s̲elect₂ W }
ʰh̲asVel ← { W → 0 < 5 s̲elect₂ W }
ʰs̲etVel ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (5 6 7) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropVel ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 5 = r̲ange 19 }
ʰd̲ir ← { W → (9) s̲elect₂ W }
ʰh̲asDir ← { W → 0 < 8 s̲elect₂ W }
ʰs̲etDir ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (8 9) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropDir ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 8 = r̲ange 19 }
ʰs̲ize ← { W → (11) s̲elect₂ W }
ʰh̲asSize ← { W → 0 < 10 s̲elect₂ W }
ʰs̲etSize ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (10 11) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropSize ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 10 = r̲ange 19 }
ʰl̲ife ← { W → (13) s̲elect₂ W }
ʰh̲asLife ← { W → 0 < 12 s̲elect₂ W }
ʰs̲etLife ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (12 13) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropLife ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 12 = r̲ange 19 }
ʰs̲hip ← { W → (15) s̲elect₂ W }
ʰh̲asShip ← { W → 0 < 14 s̲elect₂ W }
ʰs̲etShip ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (14 15) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShip ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 14 = r̲ange 19 }
ʰr̲ock ← { W → (17) s̲elect₂ W }
ʰh̲asRock ← { W → 0 < 16 s̲elect₂ W }
ʰs̲etRock ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (16 17) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropRock ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 16 = r̲ange 19 }
ʰs̲hot ← { W → (19) s̲elect₂ W }
ʰh̲asShot ← { W → 0 < 18 s̲elect₂ W }
ʰs̲etShot ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (18 19) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShot ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 18 = r̲ange 19 }

ʰs̲hip : a -> a

function (private) · line 20

The layout: where it is (x then y, in tiles, y down), how fast it moves, the ship's heading (radians, 0 to the right), a rock's size (1 small to 3 big), a shot's time left, and what it is.

"h" ᵉᶜc̲omponents< "pos:2 vel:2 dir size life ship rock shot"
ᵉᶜc̲omponents< expands to
ʰw̲orld ← { n → (n c̲at 19) r̲eshape 0.0 }
ʰp̲os ← { W → (3 4) s̲elect₂ W }
ʰh̲asPos ← { W → 0 < 2 s̲elect₂ W }
ʰs̲etPos ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (2 3 4) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropPos ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 2 = r̲ange 19 }
ʰv̲el ← { W → (6 7) s̲elect₂ W }
ʰh̲asVel ← { W → 0 < 5 s̲elect₂ W }
ʰs̲etVel ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (5 6 7) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropVel ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 5 = r̲ange 19 }
ʰd̲ir ← { W → (9) s̲elect₂ W }
ʰh̲asDir ← { W → 0 < 8 s̲elect₂ W }
ʰs̲etDir ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (8 9) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropDir ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 8 = r̲ange 19 }
ʰs̲ize ← { W → (11) s̲elect₂ W }
ʰh̲asSize ← { W → 0 < 10 s̲elect₂ W }
ʰs̲etSize ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (10 11) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropSize ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 10 = r̲ange 19 }
ʰl̲ife ← { W → (13) s̲elect₂ W }
ʰh̲asLife ← { W → 0 < 12 s̲elect₂ W }
ʰs̲etLife ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (12 13) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropLife ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 12 = r̲ange 19 }
ʰs̲hip ← { W → (15) s̲elect₂ W }
ʰh̲asShip ← { W → 0 < 14 s̲elect₂ W }
ʰs̲etShip ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (14 15) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShip ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 14 = r̲ange 19 }
ʰr̲ock ← { W → (17) s̲elect₂ W }
ʰh̲asRock ← { W → 0 < 16 s̲elect₂ W }
ʰs̲etRock ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (16 17) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropRock ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 16 = r̲ange 19 }
ʰs̲hot ← { W → (19) s̲elect₂ W }
ʰh̲asShot ← { W → 0 < 18 s̲elect₂ W }
ʰs̲etShot ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (18 19) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShot ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 18 = r̲ange 19 }

ʰh̲asShip : (Num a, Truthy b) => a -> b

function (private) · line 20

The layout: where it is (x then y, in tiles, y down), how fast it moves, the ship's heading (radians, 0 to the right), a rock's size (1 small to 3 big), a shot's time left, and what it is.

"h" ᵉᶜc̲omponents< "pos:2 vel:2 dir size life ship rock shot"
ᵉᶜc̲omponents< expands to
ʰw̲orld ← { n → (n c̲at 19) r̲eshape 0.0 }
ʰp̲os ← { W → (3 4) s̲elect₂ W }
ʰh̲asPos ← { W → 0 < 2 s̲elect₂ W }
ʰs̲etPos ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (2 3 4) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropPos ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 2 = r̲ange 19 }
ʰv̲el ← { W → (6 7) s̲elect₂ W }
ʰh̲asVel ← { W → 0 < 5 s̲elect₂ W }
ʰs̲etVel ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (5 6 7) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropVel ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 5 = r̲ange 19 }
ʰd̲ir ← { W → (9) s̲elect₂ W }
ʰh̲asDir ← { W → 0 < 8 s̲elect₂ W }
ʰs̲etDir ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (8 9) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropDir ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 8 = r̲ange 19 }
ʰs̲ize ← { W → (11) s̲elect₂ W }
ʰh̲asSize ← { W → 0 < 10 s̲elect₂ W }
ʰs̲etSize ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (10 11) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropSize ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 10 = r̲ange 19 }
ʰl̲ife ← { W → (13) s̲elect₂ W }
ʰh̲asLife ← { W → 0 < 12 s̲elect₂ W }
ʰs̲etLife ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (12 13) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropLife ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 12 = r̲ange 19 }
ʰs̲hip ← { W → (15) s̲elect₂ W }
ʰh̲asShip ← { W → 0 < 14 s̲elect₂ W }
ʰs̲etShip ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (14 15) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShip ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 14 = r̲ange 19 }
ʰr̲ock ← { W → (17) s̲elect₂ W }
ʰh̲asRock ← { W → 0 < 16 s̲elect₂ W }
ʰs̲etRock ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (16 17) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropRock ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 16 = r̲ange 19 }
ʰs̲hot ← { W → (19) s̲elect₂ W }
ʰh̲asShot ← { W → 0 < 18 s̲elect₂ W }
ʰs̲etShot ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (18 19) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShot ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 18 = r̲ange 19 }
Used in: ʰm̲e, ˡc̲ounts

ʰs̲etShip : Float -> (Int, Float) -> Float

function (private) · line 20

The layout: where it is (x then y, in tiles, y down), how fast it moves, the ship's heading (radians, 0 to the right), a rock's size (1 small to 3 big), a shot's time left, and what it is.

"h" ᵉᶜc̲omponents< "pos:2 vel:2 dir size life ship rock shot"
ᵉᶜc̲omponents< expands to
ʰw̲orld ← { n → (n c̲at 19) r̲eshape 0.0 }
ʰp̲os ← { W → (3 4) s̲elect₂ W }
ʰh̲asPos ← { W → 0 < 2 s̲elect₂ W }
ʰs̲etPos ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (2 3 4) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropPos ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 2 = r̲ange 19 }
ʰv̲el ← { W → (6 7) s̲elect₂ W }
ʰh̲asVel ← { W → 0 < 5 s̲elect₂ W }
ʰs̲etVel ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (5 6 7) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropVel ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 5 = r̲ange 19 }
ʰd̲ir ← { W → (9) s̲elect₂ W }
ʰh̲asDir ← { W → 0 < 8 s̲elect₂ W }
ʰs̲etDir ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (8 9) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropDir ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 8 = r̲ange 19 }
ʰs̲ize ← { W → (11) s̲elect₂ W }
ʰh̲asSize ← { W → 0 < 10 s̲elect₂ W }
ʰs̲etSize ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (10 11) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropSize ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 10 = r̲ange 19 }
ʰl̲ife ← { W → (13) s̲elect₂ W }
ʰh̲asLife ← { W → 0 < 12 s̲elect₂ W }
ʰs̲etLife ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (12 13) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropLife ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 12 = r̲ange 19 }
ʰs̲hip ← { W → (15) s̲elect₂ W }
ʰh̲asShip ← { W → 0 < 14 s̲elect₂ W }
ʰs̲etShip ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (14 15) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShip ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 14 = r̲ange 19 }
ʰr̲ock ← { W → (17) s̲elect₂ W }
ʰh̲asRock ← { W → 0 < 16 s̲elect₂ W }
ʰs̲etRock ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (16 17) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropRock ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 16 = r̲ange 19 }
ʰs̲hot ← { W → (19) s̲elect₂ W }
ʰh̲asShot ← { W → 0 < 18 s̲elect₂ W }
ʰs̲etShot ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (18 19) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShot ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 18 = r̲ange 19 }
Used in: ˡn̲ew

ʰd̲ropShip : Float -> Int -> Float

function (private) · line 20

The layout: where it is (x then y, in tiles, y down), how fast it moves, the ship's heading (radians, 0 to the right), a rock's size (1 small to 3 big), a shot's time left, and what it is.

"h" ᵉᶜc̲omponents< "pos:2 vel:2 dir size life ship rock shot"
ᵉᶜc̲omponents< expands to
ʰw̲orld ← { n → (n c̲at 19) r̲eshape 0.0 }
ʰp̲os ← { W → (3 4) s̲elect₂ W }
ʰh̲asPos ← { W → 0 < 2 s̲elect₂ W }
ʰs̲etPos ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (2 3 4) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropPos ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 2 = r̲ange 19 }
ʰv̲el ← { W → (6 7) s̲elect₂ W }
ʰh̲asVel ← { W → 0 < 5 s̲elect₂ W }
ʰs̲etVel ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (5 6 7) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropVel ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 5 = r̲ange 19 }
ʰd̲ir ← { W → (9) s̲elect₂ W }
ʰh̲asDir ← { W → 0 < 8 s̲elect₂ W }
ʰs̲etDir ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (8 9) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropDir ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 8 = r̲ange 19 }
ʰs̲ize ← { W → (11) s̲elect₂ W }
ʰh̲asSize ← { W → 0 < 10 s̲elect₂ W }
ʰs̲etSize ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (10 11) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropSize ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 10 = r̲ange 19 }
ʰl̲ife ← { W → (13) s̲elect₂ W }
ʰh̲asLife ← { W → 0 < 12 s̲elect₂ W }
ʰs̲etLife ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (12 13) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropLife ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 12 = r̲ange 19 }
ʰs̲hip ← { W → (15) s̲elect₂ W }
ʰh̲asShip ← { W → 0 < 14 s̲elect₂ W }
ʰs̲etShip ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (14 15) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShip ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 14 = r̲ange 19 }
ʰr̲ock ← { W → (17) s̲elect₂ W }
ʰh̲asRock ← { W → 0 < 16 s̲elect₂ W }
ʰs̲etRock ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (16 17) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropRock ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 16 = r̲ange 19 }
ʰs̲hot ← { W → (19) s̲elect₂ W }
ʰh̲asShot ← { W → 0 < 18 s̲elect₂ W }
ʰs̲etShot ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (18 19) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShot ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 18 = r̲ange 19 }

ʰr̲ock : a -> a

function (private) · line 20

The layout: where it is (x then y, in tiles, y down), how fast it moves, the ship's heading (radians, 0 to the right), a rock's size (1 small to 3 big), a shot's time left, and what it is.

"h" ᵉᶜc̲omponents< "pos:2 vel:2 dir size life ship rock shot"
ᵉᶜc̲omponents< expands to
ʰw̲orld ← { n → (n c̲at 19) r̲eshape 0.0 }
ʰp̲os ← { W → (3 4) s̲elect₂ W }
ʰh̲asPos ← { W → 0 < 2 s̲elect₂ W }
ʰs̲etPos ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (2 3 4) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropPos ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 2 = r̲ange 19 }
ʰv̲el ← { W → (6 7) s̲elect₂ W }
ʰh̲asVel ← { W → 0 < 5 s̲elect₂ W }
ʰs̲etVel ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (5 6 7) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropVel ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 5 = r̲ange 19 }
ʰd̲ir ← { W → (9) s̲elect₂ W }
ʰh̲asDir ← { W → 0 < 8 s̲elect₂ W }
ʰs̲etDir ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (8 9) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropDir ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 8 = r̲ange 19 }
ʰs̲ize ← { W → (11) s̲elect₂ W }
ʰh̲asSize ← { W → 0 < 10 s̲elect₂ W }
ʰs̲etSize ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (10 11) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropSize ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 10 = r̲ange 19 }
ʰl̲ife ← { W → (13) s̲elect₂ W }
ʰh̲asLife ← { W → 0 < 12 s̲elect₂ W }
ʰs̲etLife ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (12 13) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropLife ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 12 = r̲ange 19 }
ʰs̲hip ← { W → (15) s̲elect₂ W }
ʰh̲asShip ← { W → 0 < 14 s̲elect₂ W }
ʰs̲etShip ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (14 15) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShip ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 14 = r̲ange 19 }
ʰr̲ock ← { W → (17) s̲elect₂ W }
ʰh̲asRock ← { W → 0 < 16 s̲elect₂ W }
ʰs̲etRock ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (16 17) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropRock ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 16 = r̲ange 19 }
ʰs̲hot ← { W → (19) s̲elect₂ W }
ʰh̲asShot ← { W → 0 < 18 s̲elect₂ W }
ʰs̲etShot ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (18 19) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShot ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 18 = r̲ange 19 }

ʰh̲asRock : (Num a, Truthy b) => a -> b

function (private) · line 20

The layout: where it is (x then y, in tiles, y down), how fast it moves, the ship's heading (radians, 0 to the right), a rock's size (1 small to 3 big), a shot's time left, and what it is.

"h" ᵉᶜc̲omponents< "pos:2 vel:2 dir size life ship rock shot"
ᵉᶜc̲omponents< expands to
ʰw̲orld ← { n → (n c̲at 19) r̲eshape 0.0 }
ʰp̲os ← { W → (3 4) s̲elect₂ W }
ʰh̲asPos ← { W → 0 < 2 s̲elect₂ W }
ʰs̲etPos ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (2 3 4) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropPos ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 2 = r̲ange 19 }
ʰv̲el ← { W → (6 7) s̲elect₂ W }
ʰh̲asVel ← { W → 0 < 5 s̲elect₂ W }
ʰs̲etVel ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (5 6 7) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropVel ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 5 = r̲ange 19 }
ʰd̲ir ← { W → (9) s̲elect₂ W }
ʰh̲asDir ← { W → 0 < 8 s̲elect₂ W }
ʰs̲etDir ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (8 9) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropDir ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 8 = r̲ange 19 }
ʰs̲ize ← { W → (11) s̲elect₂ W }
ʰh̲asSize ← { W → 0 < 10 s̲elect₂ W }
ʰs̲etSize ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (10 11) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropSize ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 10 = r̲ange 19 }
ʰl̲ife ← { W → (13) s̲elect₂ W }
ʰh̲asLife ← { W → 0 < 12 s̲elect₂ W }
ʰs̲etLife ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (12 13) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropLife ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 12 = r̲ange 19 }
ʰs̲hip ← { W → (15) s̲elect₂ W }
ʰh̲asShip ← { W → 0 < 14 s̲elect₂ W }
ʰs̲etShip ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (14 15) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShip ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 14 = r̲ange 19 }
ʰr̲ock ← { W → (17) s̲elect₂ W }
ʰh̲asRock ← { W → 0 < 16 s̲elect₂ W }
ʰs̲etRock ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (16 17) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropRock ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 16 = r̲ange 19 }
ʰs̲hot ← { W → (19) s̲elect₂ W }
ʰh̲asShot ← { W → 0 < 18 s̲elect₂ W }
ʰs̲etShot ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (18 19) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShot ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 18 = r̲ange 19 }
Used in: ʰr̲ocks

ʰs̲etRock : Float -> (Int, Float) -> Float

function (private) · line 20

The layout: where it is (x then y, in tiles, y down), how fast it moves, the ship's heading (radians, 0 to the right), a rock's size (1 small to 3 big), a shot's time left, and what it is.

"h" ᵉᶜc̲omponents< "pos:2 vel:2 dir size life ship rock shot"
ᵉᶜc̲omponents< expands to
ʰw̲orld ← { n → (n c̲at 19) r̲eshape 0.0 }
ʰp̲os ← { W → (3 4) s̲elect₂ W }
ʰh̲asPos ← { W → 0 < 2 s̲elect₂ W }
ʰs̲etPos ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (2 3 4) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropPos ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 2 = r̲ange 19 }
ʰv̲el ← { W → (6 7) s̲elect₂ W }
ʰh̲asVel ← { W → 0 < 5 s̲elect₂ W }
ʰs̲etVel ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (5 6 7) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropVel ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 5 = r̲ange 19 }
ʰd̲ir ← { W → (9) s̲elect₂ W }
ʰh̲asDir ← { W → 0 < 8 s̲elect₂ W }
ʰs̲etDir ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (8 9) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropDir ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 8 = r̲ange 19 }
ʰs̲ize ← { W → (11) s̲elect₂ W }
ʰh̲asSize ← { W → 0 < 10 s̲elect₂ W }
ʰs̲etSize ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (10 11) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropSize ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 10 = r̲ange 19 }
ʰl̲ife ← { W → (13) s̲elect₂ W }
ʰh̲asLife ← { W → 0 < 12 s̲elect₂ W }
ʰs̲etLife ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (12 13) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropLife ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 12 = r̲ange 19 }
ʰs̲hip ← { W → (15) s̲elect₂ W }
ʰh̲asShip ← { W → 0 < 14 s̲elect₂ W }
ʰs̲etShip ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (14 15) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShip ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 14 = r̲ange 19 }
ʰr̲ock ← { W → (17) s̲elect₂ W }
ʰh̲asRock ← { W → 0 < 16 s̲elect₂ W }
ʰs̲etRock ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (16 17) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropRock ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 16 = r̲ange 19 }
ʰs̲hot ← { W → (19) s̲elect₂ W }
ʰh̲asShot ← { W → 0 < 18 s̲elect₂ W }
ʰs̲etShot ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (18 19) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShot ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 18 = r̲ange 19 }

ʰd̲ropRock : Float -> Int -> Float

function (private) · line 20

The layout: where it is (x then y, in tiles, y down), how fast it moves, the ship's heading (radians, 0 to the right), a rock's size (1 small to 3 big), a shot's time left, and what it is.

"h" ᵉᶜc̲omponents< "pos:2 vel:2 dir size life ship rock shot"
ᵉᶜc̲omponents< expands to
ʰw̲orld ← { n → (n c̲at 19) r̲eshape 0.0 }
ʰp̲os ← { W → (3 4) s̲elect₂ W }
ʰh̲asPos ← { W → 0 < 2 s̲elect₂ W }
ʰs̲etPos ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (2 3 4) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropPos ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 2 = r̲ange 19 }
ʰv̲el ← { W → (6 7) s̲elect₂ W }
ʰh̲asVel ← { W → 0 < 5 s̲elect₂ W }
ʰs̲etVel ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (5 6 7) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropVel ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 5 = r̲ange 19 }
ʰd̲ir ← { W → (9) s̲elect₂ W }
ʰh̲asDir ← { W → 0 < 8 s̲elect₂ W }
ʰs̲etDir ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (8 9) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropDir ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 8 = r̲ange 19 }
ʰs̲ize ← { W → (11) s̲elect₂ W }
ʰh̲asSize ← { W → 0 < 10 s̲elect₂ W }
ʰs̲etSize ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (10 11) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropSize ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 10 = r̲ange 19 }
ʰl̲ife ← { W → (13) s̲elect₂ W }
ʰh̲asLife ← { W → 0 < 12 s̲elect₂ W }
ʰs̲etLife ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (12 13) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropLife ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 12 = r̲ange 19 }
ʰs̲hip ← { W → (15) s̲elect₂ W }
ʰh̲asShip ← { W → 0 < 14 s̲elect₂ W }
ʰs̲etShip ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (14 15) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShip ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 14 = r̲ange 19 }
ʰr̲ock ← { W → (17) s̲elect₂ W }
ʰh̲asRock ← { W → 0 < 16 s̲elect₂ W }
ʰs̲etRock ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (16 17) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropRock ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 16 = r̲ange 19 }
ʰs̲hot ← { W → (19) s̲elect₂ W }
ʰh̲asShot ← { W → 0 < 18 s̲elect₂ W }
ʰs̲etShot ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (18 19) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShot ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 18 = r̲ange 19 }

ʰs̲hot : a -> a

function (private) · line 20

The layout: where it is (x then y, in tiles, y down), how fast it moves, the ship's heading (radians, 0 to the right), a rock's size (1 small to 3 big), a shot's time left, and what it is.

"h" ᵉᶜc̲omponents< "pos:2 vel:2 dir size life ship rock shot"
ᵉᶜc̲omponents< expands to
ʰw̲orld ← { n → (n c̲at 19) r̲eshape 0.0 }
ʰp̲os ← { W → (3 4) s̲elect₂ W }
ʰh̲asPos ← { W → 0 < 2 s̲elect₂ W }
ʰs̲etPos ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (2 3 4) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropPos ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 2 = r̲ange 19 }
ʰv̲el ← { W → (6 7) s̲elect₂ W }
ʰh̲asVel ← { W → 0 < 5 s̲elect₂ W }
ʰs̲etVel ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (5 6 7) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropVel ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 5 = r̲ange 19 }
ʰd̲ir ← { W → (9) s̲elect₂ W }
ʰh̲asDir ← { W → 0 < 8 s̲elect₂ W }
ʰs̲etDir ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (8 9) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropDir ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 8 = r̲ange 19 }
ʰs̲ize ← { W → (11) s̲elect₂ W }
ʰh̲asSize ← { W → 0 < 10 s̲elect₂ W }
ʰs̲etSize ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (10 11) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropSize ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 10 = r̲ange 19 }
ʰl̲ife ← { W → (13) s̲elect₂ W }
ʰh̲asLife ← { W → 0 < 12 s̲elect₂ W }
ʰs̲etLife ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (12 13) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropLife ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 12 = r̲ange 19 }
ʰs̲hip ← { W → (15) s̲elect₂ W }
ʰh̲asShip ← { W → 0 < 14 s̲elect₂ W }
ʰs̲etShip ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (14 15) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShip ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 14 = r̲ange 19 }
ʰr̲ock ← { W → (17) s̲elect₂ W }
ʰh̲asRock ← { W → 0 < 16 s̲elect₂ W }
ʰs̲etRock ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (16 17) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropRock ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 16 = r̲ange 19 }
ʰs̲hot ← { W → (19) s̲elect₂ W }
ʰh̲asShot ← { W → 0 < 18 s̲elect₂ W }
ʰs̲etShot ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (18 19) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShot ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 18 = r̲ange 19 }

ʰh̲asShot : (Num a, Truthy b) => a -> b

function (private) · line 20

The layout: where it is (x then y, in tiles, y down), how fast it moves, the ship's heading (radians, 0 to the right), a rock's size (1 small to 3 big), a shot's time left, and what it is.

"h" ᵉᶜc̲omponents< "pos:2 vel:2 dir size life ship rock shot"
ᵉᶜc̲omponents< expands to
ʰw̲orld ← { n → (n c̲at 19) r̲eshape 0.0 }
ʰp̲os ← { W → (3 4) s̲elect₂ W }
ʰh̲asPos ← { W → 0 < 2 s̲elect₂ W }
ʰs̲etPos ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (2 3 4) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropPos ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 2 = r̲ange 19 }
ʰv̲el ← { W → (6 7) s̲elect₂ W }
ʰh̲asVel ← { W → 0 < 5 s̲elect₂ W }
ʰs̲etVel ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (5 6 7) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropVel ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 5 = r̲ange 19 }
ʰd̲ir ← { W → (9) s̲elect₂ W }
ʰh̲asDir ← { W → 0 < 8 s̲elect₂ W }
ʰs̲etDir ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (8 9) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropDir ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 8 = r̲ange 19 }
ʰs̲ize ← { W → (11) s̲elect₂ W }
ʰh̲asSize ← { W → 0 < 10 s̲elect₂ W }
ʰs̲etSize ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (10 11) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropSize ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 10 = r̲ange 19 }
ʰl̲ife ← { W → (13) s̲elect₂ W }
ʰh̲asLife ← { W → 0 < 12 s̲elect₂ W }
ʰs̲etLife ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (12 13) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropLife ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 12 = r̲ange 19 }
ʰs̲hip ← { W → (15) s̲elect₂ W }
ʰh̲asShip ← { W → 0 < 14 s̲elect₂ W }
ʰs̲etShip ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (14 15) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShip ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 14 = r̲ange 19 }
ʰr̲ock ← { W → (17) s̲elect₂ W }
ʰh̲asRock ← { W → 0 < 16 s̲elect₂ W }
ʰs̲etRock ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (16 17) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropRock ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 16 = r̲ange 19 }
ʰs̲hot ← { W → (19) s̲elect₂ W }
ʰh̲asShot ← { W → 0 < 18 s̲elect₂ W }
ʰs̲etShot ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (18 19) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShot ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 18 = r̲ange 19 }
Used in: ʰs̲hots

ʰs̲etShot : Float -> (Int, Float) -> Float

function (private) · line 20

The layout: where it is (x then y, in tiles, y down), how fast it moves, the ship's heading (radians, 0 to the right), a rock's size (1 small to 3 big), a shot's time left, and what it is.

"h" ᵉᶜc̲omponents< "pos:2 vel:2 dir size life ship rock shot"
ᵉᶜc̲omponents< expands to
ʰw̲orld ← { n → (n c̲at 19) r̲eshape 0.0 }
ʰp̲os ← { W → (3 4) s̲elect₂ W }
ʰh̲asPos ← { W → 0 < 2 s̲elect₂ W }
ʰs̲etPos ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (2 3 4) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropPos ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 2 = r̲ange 19 }
ʰv̲el ← { W → (6 7) s̲elect₂ W }
ʰh̲asVel ← { W → 0 < 5 s̲elect₂ W }
ʰs̲etVel ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (5 6 7) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropVel ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 5 = r̲ange 19 }
ʰd̲ir ← { W → (9) s̲elect₂ W }
ʰh̲asDir ← { W → 0 < 8 s̲elect₂ W }
ʰs̲etDir ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (8 9) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropDir ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 8 = r̲ange 19 }
ʰs̲ize ← { W → (11) s̲elect₂ W }
ʰh̲asSize ← { W → 0 < 10 s̲elect₂ W }
ʰs̲etSize ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (10 11) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropSize ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 10 = r̲ange 19 }
ʰl̲ife ← { W → (13) s̲elect₂ W }
ʰh̲asLife ← { W → 0 < 12 s̲elect₂ W }
ʰs̲etLife ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (12 13) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropLife ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 12 = r̲ange 19 }
ʰs̲hip ← { W → (15) s̲elect₂ W }
ʰh̲asShip ← { W → 0 < 14 s̲elect₂ W }
ʰs̲etShip ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (14 15) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShip ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 14 = r̲ange 19 }
ʰr̲ock ← { W → (17) s̲elect₂ W }
ʰh̲asRock ← { W → 0 < 16 s̲elect₂ W }
ʰs̲etRock ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (16 17) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropRock ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 16 = r̲ange 19 }
ʰs̲hot ← { W → (19) s̲elect₂ W }
ʰh̲asShot ← { W → 0 < 18 s̲elect₂ W }
ʰs̲etShot ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (18 19) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShot ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 18 = r̲ange 19 }
Used in: ʰf̲ire

ʰd̲ropShot : Float -> Int -> Float

function (private) · line 20

The layout: where it is (x then y, in tiles, y down), how fast it moves, the ship's heading (radians, 0 to the right), a rock's size (1 small to 3 big), a shot's time left, and what it is.

"h" ᵉᶜc̲omponents< "pos:2 vel:2 dir size life ship rock shot"
ᵉᶜc̲omponents< expands to
ʰw̲orld ← { n → (n c̲at 19) r̲eshape 0.0 }
ʰp̲os ← { W → (3 4) s̲elect₂ W }
ʰh̲asPos ← { W → 0 < 2 s̲elect₂ W }
ʰs̲etPos ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (2 3 4) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropPos ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 2 = r̲ange 19 }
ʰv̲el ← { W → (6 7) s̲elect₂ W }
ʰh̲asVel ← { W → 0 < 5 s̲elect₂ W }
ʰs̲etVel ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 2) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (5 6 7) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 3) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropVel ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 5 = r̲ange 19 }
ʰd̲ir ← { W → (9) s̲elect₂ W }
ʰh̲asDir ← { W → 0 < 8 s̲elect₂ W }
ʰs̲etDir ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (8 9) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropDir ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 8 = r̲ange 19 }
ʰs̲ize ← { W → (11) s̲elect₂ W }
ʰh̲asSize ← { W → 0 < 10 s̲elect₂ W }
ʰs̲etSize ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (10 11) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropSize ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 10 = r̲ange 19 }
ʰl̲ife ← { W → (13) s̲elect₂ W }
ʰh̲asLife ← { W → 0 < 12 s̲elect₂ W }
ʰs̲etLife ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (12 13) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropLife ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 12 = r̲ange 19 }
ʰs̲hip ← { W → (15) s̲elect₂ W }
ʰh̲asShip ← { W → 0 < 14 s̲elect₂ W }
ʰs̲etShip ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (14 15) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShip ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 14 = r̲ange 19 }
ʰr̲ock ← { W → (17) s̲elect₂ W }
ʰh̲asRock ← { W → 0 < 16 s̲elect₂ W }
ʰs̲etRock ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (16 17) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropRock ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 16 = r̲ange 19 }
ʰs̲hot ← { W → (19) s̲elect₂ W }
ʰh̲asShot ← { W → 0 < 18 s̲elect₂ W }
ʰs̲etShot ← { W (ids, v) →
  i ← r̲avel ids
  V ← (((t̲ally i) c̲at 1) r̲eshape 1.0) c̲at₂ ((t̲ally i) c̲at 1) r̲eshape v
  R ← f̲loat (r̲ange t̲ally W) '= t̲able i
  C ← f̲loat (18 19) '= t̲able r̲ange 19
  M ← 0 < R '+ '× i̲nner (((t̲ally i) c̲at 2) r̲eshape 1.0) '+ '× i̲nner C
  (W × f̲loat n̲ot M) + R '+ '× i̲nner V '+ '× i̲nner C
}
ʰd̲ropShot ← { W ids → W × f̲loat n̲ot ((r̲ange t̲ally W) m̲ember? r̲avel ids) '× t̲able 18 = r̲ange 19 }

ʰn̲ums : Char -> Float

function (private) · line 22

A list of numbers from asteroids.toml.

ʰn̲ums ← { k → 'ˢᵛn̲um e̲ach "asteroids.toml" ⎕L̲IST k }

FIELD : Float

value (private) · line 23
FIELD ← ʰn̲ums "field"
Used in: FX, FY

FX : Float

value (private) · line 24
FX ← f̲irst FIELD

FY : Float

value (private) · line 25
FY ← 2 s̲elect FIELD

WAVES : Int

value (private) · line 26
WAVES ← f̲loor ʰn̲ums "waves"

RADII : Float

value (private) · line 27
RADII ← ʰn̲ums "radii"

SPEEDS : Float

value (private) · line 28
SPEEDS ← ʰn̲ums "speeds"

POINTS : Int

value (private) · line 29
POINTS ← f̲loor ʰn̲ums "points"
Used in: ʰs̲hoot

ship : Float

value (private) · line 30
ship ← ʰn̲ums "ship"
Used in: TURN, THRUST, FAST, DRAG, LIVES, SAFE

TURN : Float

value (private) · line 31
TURN ← f̲irst ship
Used in: ˡk̲ey

THRUST : Float

value (private) · line 32
THRUST ← 2 s̲elect ship
Used in: ʰt̲hrust

FAST : Float

value (private) · line 33
FAST ← 3 s̲elect ship
Used in: ʰt̲hrust

DRAG : Float

value (private) · line 34
DRAG ← 4 s̲elect ship
Used in: ʰm̲ove

LIVES : Int

value (private) · line 35
LIVES ← f̲loor 5 s̲elect ship
Used in: ˡn̲ew

SAFE : Float

value (private) · line 36
SAFE ← 6 s̲elect ship
Used in: ˡn̲ew, ʰc̲rash

gun : Float

value (private) · line 37
gun ← ʰn̲ums "gun"
Used in: SHOT, FLIGHT, SHOTS

SHOT : Float

value (private) · line 38
SHOT ← f̲irst gun
Used in: ʰf̲ire

FLIGHT : Float

value (private) · line 39
FLIGHT ← 2 s̲elect gun
Used in: ʰf̲ire

SHOTS : Float

value (private) · line 40
SHOTS ← 3 s̲elect gun
Used in: ʰf̲ire

A new game

ʰp̲air : (a, a) -> a

function (private) · line 45

n by 2 from two columns.

ʰp̲air ← { (a, b) → o̲\ (2 c̲at t̲ally a) r̲eshape a c̲at b }

ʰr̲adians : Num a => a -> Float

function (private) · line 47

Angles in radians from a number of degrees.

ʰr̲adians ← { d → (p̲i @) × (f̲loat d) ÷ 180.0 }
Used in: ʰw̲ave

ʰp̲lace : Float -> (Int, Float, Float) -> Float

function (private) · line 49

The world with the entities ids at P, moving at V.

ʰp̲lace ← { W (ids, P, V) → (W ʰs̲etPos (ids, P)) ʰs̲etVel (ids, V) }

ʰw̲ave : Float -> Int -> Float

function (private) · line 52

A wave of big rocks (wave k says how many): each on a ring around the middle, flying off in a direction of its own, all drawn at random.

ʰw̲ave ← { W k →
  n ← k s̲elect WAVES
  (spawned, ids) ← W ᵉᶜs̲pawn n
  a ← ʰr̲adians r̲oll! n r̲eshape 360
  b ← ʰr̲adians r̲oll! n r̲eshape 360
  P ← ʰp̲air ((0.5 × FX) + 7.0 × c̲os a, (0.5 × FY) + 7.0 × s̲in a)
  V ← ʰp̲air ((3 s̲elect SPEEDS) × c̲os b, (3 s̲elect SPEEDS) × s̲in b)
  ((spawned ʰp̲lace (ids, P, V)) ʰs̲etSize (ids, 3.0)) ʰs̲etRock (ids, 1.0)
}
Used in: ˡn̲ew, ʰn̲ext

ʰc̲enter : Float -> Int -> Float

function (private) · line 62

The ship put in the middle, still, heading up.

ʰc̲enter ← { W me → (W ʰp̲lace (me, (0.5 × FX) c̲at 0.5 × FY, 0.0 0.0)) ʰs̲etDir (me, n̲eg 0.5 × p̲i @) }
Used in: ˡn̲ew, ʰc̲rash

ˡn̲ew : (Any a, Num b, Num c, Num d) => a -> (Float, b, Int, c, Float, d, Float)

function · line 65

A new game: the ship in the middle and the first wave of rocks.

ˡn̲ew ← { z →
  (spawned, me) ← (ʰw̲orld 64) ᵉᶜs̲pawn 1
  (((spawned ʰc̲enter me) ʰs̲etShip (me, 1.0)) ʰw̲ave 1, 0, LIVES, 1, 0.0, 0, SAFE)
}

The systems

ʰm̲e : Num a => a -> Int

function (private) · line 73

The ship, the rocks, the shots alive.

ʰm̲e ← { W → f̲irst w̲here (ᵉᶜa̲live W) ∧ ʰh̲asShip W }

ʰr̲ocks : Num a => a -> Int

function (private) · line 74
ʰr̲ocks ← { W → w̲here (ᵉᶜa̲live W) ∧ ʰh̲asRock W }

ʰs̲hots : Num a => a -> Int

function (private) · line 75
ʰs̲hots ← { W → w̲here (ᵉᶜa̲live W) ∧ ʰh̲asShot W }

ʰm̲ove : Float -> Float -> Float

function (private) · line 78

Every entity moves by its speed, wrapping around the field's edges; the ship keeps a little less of its speed.

ʰm̲ove ← { W dt →
  c ← w̲here ᵉᶜa̲live W
  P ← (c s̲elect ʰp̲os W) + dt × c s̲elect ʰv̲el W
  x ← 1 s̲elect₂ P
  y ← 2 s̲elect₂ P
  moved ← W ʰs̲etPos (c, ʰp̲air (x − FX × f̲loat f̲loor x ÷ FX, y − FY × f̲loat f̲loor y ÷ FY))
  me ← ʰm̲e moved
  moved ʰs̲etVel (me, DRAG × me s̲elect ʰv̲el moved)
}
Used in: ˡt̲ick

ʰa̲ge : Float -> Float -> Float

function (private) · line 88

Every shot's time runs down; the spent shots go.

ʰa̲ge ← { W dt →
  s ← ʰs̲hots W
  aged ← W ʰs̲etLife (s, (s s̲elect ʰl̲ife W) − dt)
  aged ᵉᶜd̲espawn ((s s̲elect ʰl̲ife aged) ≤ 0.0) r̲eplicate s
}
Used in: ˡt̲ick

ʰw̲ithin : Truthy a => Float -> (Float, Int, Float) -> a

function (private) · line 95

Which of the points P lie within reach of which rocks r (each its radius plus more): a table, P's rows down, the rocks across.

ʰw̲ithin ← { W (P, r, more) →
  R ← r s̲elect ʰp̲os W
  dx ← (1 s̲elect₂ P) '− t̲able 1 s̲elect₂ R
  dy ← (2 s̲elect₂ P) '− t̲able 2 s̲elect₂ R
  reach ← more + (f̲loor r s̲elect ʰs̲ize W) s̲elect RADII
  ((dx × dx) + dy × dy) < (s̲hape dx) r̲eshape reach × reach
}

ʰh̲alves : Float -> (Int, Int) -> Float

function (private) · line 106

The world without the entities gone, and with the two halves of each rock of ids (one of them): where it was, a size smaller, flying at the smaller size's speed, one turned left of its way and one right, spawned in the first free slots (the ones just freed among them).

ʰh̲alves ← { W (ids, gone) →
  0 = t̲ally ids ? W ᵉᶜd̲espawn gone
  two ← ((t̲ally ids) r̲eshape 2) r̲eplicate ids
  n ← t̲ally two
  V ← two s̲elect ʰv̲el W
  sz ← (two s̲elect ʰs̲ize W) − 1.0
  a ← 0.7 × 1.0 − 2.0 × f̲loat (r̲ange n) m̲od 2
  vx ← ((1 s̲elect₂ V) × c̲os a) − (2 s̲elect₂ V) × s̲in a
  vy ← ((1 s̲elect₂ V) × s̲in a) + (2 s̲elect₂ V) × c̲os a
  k ← ((f̲loor sz) s̲elect SPEEDS) ÷ 0.001 m̲ax ((vx × vx) + vy × vy) ^ 0.5
  P ← two s̲elect ʰp̲os W
  (spawned, kids) ← (W ᵉᶜd̲espawn gone) ᵉᶜs̲pawn n
  ((spawned ʰp̲lace (kids, P, ʰp̲air (k × vx, k × vy))) ʰs̲etSize (kids, sz)) ʰs̲etRock (kids, 1.0)
}
Used in: ʰs̲hoot

ʰs̲hoot : Float -> (Float, Int)

function (private) · line 124

Shots that reach a rock: the shots are spent, the rocks go (their points scored), and the rocks bigger than small leave two halves each, spawned in the slots just freed. Every shot against every rock at once.

ʰs̲hoot ← { W →
  s ← ʰs̲hots W
  r ← ʰr̲ocks W
  0 = (t̲ally s) × t̲ally r ? (W, 0)
  H ← W ʰw̲ithin (s s̲elect ʰp̲os W, r, 0.0)
  hit ← ('∨ r̲/₁ H) r̲eplicate r
  sz ← f̲loor hit s̲elect ʰs̲ize W
  big ← (sz > 1) r̲eplicate hit
  (W ʰh̲alves (big, (('∨ r̲/₂ H) r̲eplicate s) c̲at hit), '+ r̲/ 0 c̲at sz s̲elect POINTS)
}
Used in: ˡt̲ick

ʰc̲rash : Num a => (Float, a, Float) -> (Float, a, Float)

function (private) · line 136

A rock that reaches the ship, unless it cannot be hit: a life lost, the ship back in the middle, safe for a while.

ʰc̲rash ← { (W, lives, safe) →
  safe > 0.0 ? (W, lives, safe)
  me ← ʰm̲e W
  r ← ʰr̲ocks W
  0 = t̲ally r ? (W, lives, safe)
  n̲ot '∨ r̲/ r̲avel W ʰw̲ithin (1 2 r̲eshape me s̲elect ʰp̲os W, r, 0.35) ? (W, lives, safe)
  (W ʰc̲enter me, lives − 1, SAFE)
}
Used in: ˡt̲ick

ʰn̲ext : Num a => (Float, Int) -> (Float, Int, a)

function (private) · line 145

When the rocks are all gone: the next wave, or, after the last, won.

ʰn̲ext ← { (W, wave) →
  0 < t̲ally ʰr̲ocks W ? (W, wave, 0)
  wave = t̲ally WAVES ? (W, wave, 1)
  (W ʰw̲ave wave + 1, wave + 1, 0)
}
Used in: ˡt̲ick

ʰs̲tanding : (Num a, Num b, Num c) => (a, b) -> c

function (private) · line 151

How it stands: won 1, no lives left 2, else 0.

ʰs̲tanding ← { (won, lives) → won = 1 ? 1◆ lives ≤ 0 ? 2◆ 0 }
Used in: ˡt̲ick

ˡt̲ick : (Num a, Num b) => (Float, Int, a, Int, Float, b, Float) -> Float -> (Float, Int, a, Int, Float, b, Float)

function · line 157

A tick of the clock, dt seconds: everything moves, the shots age, the shots that reach rocks break them, a rock that reaches the ship costs a life, and a field cleared brings the next wave; each a system over every entity at once. A game over stays as it is.

ˡt̲ick ← { (W, sc, lv, wv, t, st, sf) dt →
  st > 0 ? (W, sc, lv, wv, t, st, sf)
  flown ← (W ʰm̲ove dt) ʰa̲ge dt
  (broken, pts) ← ʰs̲hoot flown
  (crashed, lives, safe) ← ʰc̲rash (broken, lv, 0.0 m̲ax sf − dt)
  (next, wave, won) ← ʰn̲ext (crashed, wv)
  (next, sc + pts, lives, wave, t + dt, ʰs̲tanding (won, lives), safe)
}

Your keys

ʰf̲ire : Float -> Int -> Float

function (private) · line 170

A shot from the ship's nose, at the ship's speed plus the gun's, unless the most shots are already in flight.

ʰf̲ire ← { W me →
  SHOTS ≤ f̲loat t̲ally ʰs̲hots W ? W
  d ← me s̲elect ʰd̲ir W
  u ← (c̲os d) c̲at s̲in d
  (spawned, ids) ← W ᵉᶜs̲pawn 1
  P ← (me s̲elect ʰp̲os W) + 0.6 × u
  V ← (me s̲elect ʰv̲el W) + SHOT × u
  ((spawned ʰp̲lace (ids, P, V)) ʰs̲etLife (ids, FLIGHT)) ʰs̲etShot (ids, 1.0)
}
Used in: ˡk̲ey

ʰt̲hrust : Float -> Int -> Float

function (private) · line 181

The ship's speed with an up key's added along its heading, no faster than the fastest.

ʰt̲hrust ← { W me →
  d ← me s̲elect ʰd̲ir W
  v ← (me s̲elect ʰv̲el W) + THRUST × (c̲os d) c̲at s̲in d
  W ʰs̲etVel (me, v × 1.0 m̲in FAST ÷ 0.001 m̲ax ('+ r̲/ v × v) ^ 0.5)
}
Used in: ˡk̲ey

ˡk̲ey : (Any a, Any b, Any c, Any d, Num e, Any f) => (Float, a, b, c, d, e, f) -> Char -> (Float, a, b, c, d, e, f)

function · line 190

A key: left and right (or a and d) turn the ship, up (or w) thrusts, the space bar (or f) fires; other keys, and keys after the game is over, do nothing.

ˡk̲ey ← { s name →
  (W, sc, lv, wv, t, st, sf) ← s
  me ← ʰm̲e W
  k ← ("LEFT" "RIGHT" "a" "d" "UP" "w" " " "f") i̲ndexOf e̲nclose name
  (k > 8) ∨ st > 0 ? s
  k > 6 ? (W ʰf̲ire me, sc, lv, wv, t, st, sf)
  k > 4 ? (W ʰt̲hrust me, sc, lv, wv, t, st, sf)
  (W ʰs̲etDir (me, (me s̲elect ʰd̲ir W) + TURN × f̲loat (2 × (k − 1) m̲od 2) − 1), sc, lv, wv, t, st, sf)
}

What it shows

ˡs̲tatus : (Any a, Any b, Any c, Any d, Any e, Any f, Any g) => (a, b, c, d, e, f, g) -> f

function · line 204

0 playing, 1 every wave cleared, 2 no lives left.

ˡs̲tatus ← { (W, sc, lv, wv, t, st, sf) → st }

ˡs̲core : (Any a, Any c, Any d, Any e) => (a, b, b, b, c, d, e) -> b

function · line 207

The score, the lives left, the wave.

ˡs̲core ← { (W, sc, lv, wv, t, st, sf) → sc c̲at lv c̲at wv }

ˡc̲ounts : (Num a, Any b, Any c, Any d, Any e, Any f, Any g) => (a, b, c, d, e, f, g) -> Int

function · line 210

How many are alive: the ship, rocks, shots; and the slots in use.

ˡc̲ounts ← { (W, sc, lv, wv, t, st, sf) → ('+ r̲/ 0 + (ᵉᶜa̲live W) ∧ ʰh̲asShip W) c̲at (t̲ally ʰr̲ocks W) c̲at (t̲ally ʰs̲hots W) c̲at ᵉᶜc̲ount W }

ˡs̲hip : (Num a, Any b, Any c, Any d, Any e, Any f, Any g) => (a, b, c, d, e, f, g) -> a

function · line 213

The ship: where it is, its heading, and its speed across and down.

ˡs̲hip ← { (W, sc, lv, wv, t, st, sf) →
  me ← ʰm̲e W
  (me s̲elect ʰp̲os W) c̲at (me s̲elect ʰd̲ir W) c̲at me s̲elect ʰv̲el W
}
Used in: ˡd̲raw

ˡr̲ocks : (Num a, Any b, Any c, Any d, Any e, Any f, Any g) => (a, b, c, d, e, f, g) -> a

function · line 219

The rocks: where each is, a row each.

ˡr̲ocks ← { (W, sc, lv, wv, t, st, sf) → (ʰr̲ocks W) s̲elect ʰp̲os W }

ʰu̲nits : Float -> Char

function (private) · line 221

A number of tiles as units of the picture (40 a tile).

ʰu̲nits ← { x → ˢᵛw̲hole 40.0 × x }

ʰd̲rawRock : (Float, Float, Float) -> Box Char

function (private) · line 223

A rock at x, y of radius z; a shot at x, y.

ʰd̲rawRock ← { (x, y, z) → e̲nclose @ f̲ormat< "<circle class=\"entity\" cx=\"{h:u_nits x}\" cy=\"{h:u_nits y}\" r=\"{h:u_nits z}\" fill=\"#5c636a\" stroke=\"#ced4da\" stroke-width=\"3\"/>" }
f̲ormat< expands to
("<circle class=\"entity\" cx=\"" c̲at (f̲ormat (ʰu̲nits x)) c̲at "\" cy=\"" c̲at (f̲ormat (ʰu̲nits y)) c̲at "\" r=\"" c̲at (f̲ormat (ʰu̲nits z)) c̲at "\" fill=\"#5c636a\" stroke=\"#ced4da\" stroke-width=\"3\"/>")
Used in: ˡd̲raw

ʰd̲rawShot : (Float, Float) -> Box Char

function (private) · line 224
ʰd̲rawShot ← { (x, y) → e̲nclose @ f̲ormat< "<circle class=\"entity\" cx=\"{h:u_nits x}\" cy=\"{h:u_nits y}\" r=\"4\" fill=\"#ffd166\"/>" }
f̲ormat< expands to
("<circle class=\"entity\" cx=\"" c̲at (f̲ormat (ʰu̲nits x)) c̲at "\" cy=\"" c̲at (f̲ormat (ʰu̲nits y)) c̲at "\" r=\"4\" fill=\"#ffd166\"/>")
Used in: ˡd̲raw

ʰd̲rawShip : (Float, Float, Float, Float) -> Box Char

function (private) · line 226

The ship at x, y heading d; faint while it cannot be hit.

ʰd̲rawShip ← { (x, y, d, safe) →
  o ← d̲isclose (1 + safe > 0.0) s̲elect "1" "0.45"
  e̲nclose @ f̲ormat< "<g class=\"entity you\" opacity=\"{o}\" transform=\"translate({h:u_nits x} {h:u_nits y}) rotate({sv:w_hole d * 180.0 / p_i @})\"><polygon points=\"20,0 -14,-12 -8,0 -14,12\" fill=\"#e9ecef\" stroke=\"#4cc9f0\" stroke-width=\"3\"/></g>"
}
f̲ormat< expands to
("<g class=\"entity you\" opacity=\"" c̲at (f̲ormat (o)) c̲at "\" transform=\"translate(" c̲at (f̲ormat (ʰu̲nits x)) c̲at " " c̲at (f̲ormat (ʰu̲nits y)) c̲at ") rotate(" c̲at (f̲ormat (ˢᵛw̲hole d × 180.0 ÷ p̲i @)) c̲at ")\"><polygon points=\"20,0 -14,-12 -8,0 -14,12\" fill=\"#e9ecef\" stroke=\"#4cc9f0\" stroke-width=\"3\"/></g>")
Used in: ˡd̲raw

ʰs̲ays : (Num d, Num e) => (a, b, c, d, e) -> Char

function (private) · line 231

What the top line says.

ʰs̲ays ← { (sc, lv, wv, t, st) →
  st = 1 ? @ f̲ormat< "Every wave cleared! Score {sc} | Time {f_loor t} s"
  st = 2 ? @ f̲ormat< "Game over. Score {sc} | Time {f_loor t} s"
  @ f̲ormat< "Score {sc} | Lives {lv} | Wave {wv} of {t_ally WAVES} | Time {f_loor t} s | Arrows, space"
}
f̲ormat< expands to
("Every wave cleared! Score " c̲at (f̲ormat (sc)) c̲at " | Time " c̲at (f̲ormat (f̲loor t)) c̲at " s")
f̲ormat< expands to
("Game over. Score " c̲at (f̲ormat (sc)) c̲at " | Time " c̲at (f̲ormat (f̲loor t)) c̲at " s")
f̲ormat< expands to
"Score " c̲at (f̲ormat (sc)) c̲at " | Lives " c̲at (f̲ormat (lv)) c̲at " | Wave " c̲at (f̲ormat (wv)) c̲at " of " c̲at (f̲ormat (t̲ally WAVES)) c̲at " | Time " c̲at (f̲ormat (f̲loor t)) c̲at " s | Arrows, space"
Used in: ˡd̲raw

ˡd̲raw : (Num d, Num e) => (Float, a, b, c, d, e, Float) -> Char

function · line 239

The picture, as SVG text: the field (what crosses an edge cut off), the rocks, the shots and the ship, and the top line above.

ˡd̲raw ← { (W, sc, lv, wv, t, st, sf) →
  v ← 0.0 0.0 c̲at (40.0 × FX) c̲at 60.0 + 40.0 × FY
  r ← ʰr̲ocks W
  R ← r s̲elect ʰp̲os W
  z ← (f̲loor r s̲elect ʰs̲ize W) s̲elect RADII
  rocks ← '{ i → ʰd̲rawRock (i s̲elect 1 s̲elect₂ R, i s̲elect 2 s̲elect₂ R, i s̲elect z) } e̲ach r̲ange t̲ally r
  S ← (ʰs̲hots W) s̲elect ʰp̲os W
  shots ← '{ i → ʰd̲rawShot (i s̲elect 1 s̲elect₂ S, i s̲elect 2 s̲elect₂ S) } e̲ach r̲ange t̲ally S
  me ← ˡs̲hip (W, sc, lv, wv, t, st, sf)
  you ← ʰd̲rawShip (f̲irst me, 2 s̲elect me, 3 s̲elect me, sf)
  clip ← e̲nclose @ f̲ormat< "<clipPath id=\"field\"><rect width=\"{h:u_nits FX}\" height=\"{h:u_nits FY}\"/></clipPath><g transform=\"translate(0 60)\" clip-path=\"url(#field)\">"
  top ← (20.0, 42.0, 30.0) ˢᵛw̲ords ʰs̲ays (sc, lv, wv, t, st)
  v ˢᵛp̲icture (v ˢᵛr̲ect "fill=\"#0b0c1a\"") c̲at clip c̲at rocks c̲at shots c̲at you c̲at (e̲nclose "</g>") c̲at top
}
f̲ormat< expands to
("<clipPath id=\"field\"><rect width=\"" c̲at (f̲ormat (ʰu̲nits FX)) c̲at "\" height=\"" c̲at (f̲ormat (ʰu̲nits FY)) c̲at "\"/></clipPath><g transform=\"translate(0 60)\" clip-path=\"url(#field)\">")
Used in: _, ᵘs̲how