DenialAdams / roland

Roland programming language
https://www.brick.codes/roland
Apache License 2.0
48 stars 0 forks source link

scary inference bug #50

Closed DenialAdams closed 2 years ago

DenialAdams commented 2 years ago
proc move_ghost(dt: f64) {
   // if player x > ghost x, ghost x++
   // if player x < ghost x, ghost x--

   let target_position: Position = PLAYER_POSITIONS[0];
   // (this should be INF, but we don't have that yet in Roland!)
   let best_dist = 99999999999999999999999999.0;
   for i in 0..ACTIVE_PLAYERS {
      if !PLAYERS_ALIVE[i] {
         continue;
      }
      if dist(PLAYER_POSITIONS[i], GHOST_POSITION) < best_dist {
      //   target_position = PLAYER_POSITIONS[i];
      }
   }

   if (target_position.x > GHOST_POSITION.x) {
      GHOST_POSITION.x = GHOST_POSITION.x + (1.0 * dt);
      GHOST_FACING_LEFT = false;
   }
   else {
      GHOST_POSITION.x = GHOST_POSITION.x - (1.0 * dt);
      GHOST_FACING_LEFT = true;
   }
   if (target_position.y >= GHOST_POSITION.y) {
      GHOST_POSITION.y = GHOST_POSITION.y + (1.0 * dt);
   }
   else {
      GHOST_POSITION.y = GHOST_POSITION.y - (1.0 * dt);
   }
}
DenialAdams commented 2 years ago

Fixed in e4f5311587d78c90ace6259c8d4f0bd14efba2c1