Physical memory holds only a few frames. As a program runs it references pages in some order — a reference string. A referenced page already in a frame is a hit; one that isn't is a page fault, and if every frame is full the operating system must choose a victim to evict. Fewer faults means less disk traffic, so the replacement policy matters.
FIFO evicts the oldest-loaded page; LRU evicts the least-recently-used one, betting the recent past predicts the near future. OPT (Belady's MIN) evicts the page whose next use is farthest away — provably optimal, but it needs to see the future, so no real system can run it. It is the floor every practical policy is measured against.
In 1969 László Bélády found a shock: with FIFO, giving a program more frames can cause more faults — Belady's anomaly. Switch the rival to FIFO, run the canonical tape at three frames, then widen to four and watch the count climb. LRU and OPT are "stack" algorithms and can never do this; FIFO can, because a bigger queue reorders which pages survive.
The simulation stopped unexpectedly — the lesson continues without it. You can move on; nothing you did was wrong.