lib/game-results-tracker.js
/**
     * Stores the current result of the game.
     * Does nothing if the game is not in a final state.
     * @param {boolean} didSwitch   did the player switch doors?
     */
Stores the current result of the game.
Does nothing if the game is not in a final state.
Stores the current result of the game . Does nothing if the game is not in a final state .
trackResult(didSwitch) {
        let resultKey
        if (this.game.state === Game.State.STATE_END_WON) {
            resultKey = didSwitch ? 'wonBySwitching' : 'wonByStaying'
        } else if (this.game.state === Game.State.STATE_END_LOST) {
            resultKey = didSwitch ? 'lostBySwitching' : 'lostByStaying'
        } else {
            return
        }
        this.results[resultKey]++
    }
trackResult ( didSwitch ) { let resultKey if ( this . game . state === Game . State . STATE_END_WON ) { resultKey = didSwitch ? 'wonBySwitching' : 'wonByStaying' } else if ( this . game . state === Game . State . STATE_END_LOST ) { resultKey = didSwitch ? 'lostBySwitching' : 'lostByStaying' } else { return } this . results [ resultKey ] ++ }
Stores the current result of the game.
Stores the current result of the game .