         shiftDown(indexToSwap)
     }
     
+    /// Swaps `indexA` and `indexB` in the `queue` array.
     private func swap(indexA a: Int, indexB b: Int) {
         let aData = queue[a]
         queue[a] = queue[b]

        }
    }
    
    var count: Int {
        return queue.count
    }
    
    convenience init(initialEvents: [Element]) {
        self.init()
        queue = initialEvents

import Foundation

class EventQueue {
    /// The type of an item in the `EventQueue`
    typealias Element = (event: GameEvent, playerNumber: Int, timeStep: Int, otherData: AnyObject?)
    private var queue = [Element]()
    
    /// The head of the `EventQueue`, the `Element` in the queue with the highest priority.
    var head: Element? {
        get {
            guard count > 0 else {
