Skip to content
Snippets Groups Projects
Select Git revision
  • 71518a137db3ee69d881d02f6e286853f6c8e268
  • main default protected
2 results

FrameMemory.scala

Blame
  • FrameMemory.scala 730 B
    package cosc250.boids
    
    import scala.collection.immutable.Queue
    
    /**
      * Holds the replay buffer for our simulation.
      *
      * @param queue - the queue of frames that is the memory
      * @param max - the max number of frames to hold
      */
    class FrameMemory(queue:Queue[SimulationFrame], max:Int) {
    
      /** An alternative constructor, so we can say FrameMemory(startFrame, maxFrames) */
      def this(startFrame:SimulationFrame, max:Int) = this(Queue(startFrame), max)
    
      def currentFrame:SimulationFrame =
        // Remember, items join queues at the back.
        ???
    
      def oldestFrame:SimulationFrame =
        ???
    
      def pushFrame(frame:SimulationFrame):FrameMemory =
        // Don't forget to dequeue old frames if it's getting too long.
        ???
    
    }