function gameWon() {
    // A small delay is needed to record the last move.
    setTimeout(function () {
        // Display the modal.
        modal.style.display = "block";
        // Display the amount of stars earned.
        firstFinalStar.className = firstStar.className;
        firstFinalStar.classList.add("fa-2x");
        secondFinalStar.className = secondStar.className;
        secondFinalStar.classList.add("fa-2x");
        thirdFinalStar.className = thirdStar.className;
        thirdFinalStar.classList.add("fa-2x");
        // Display the total moves.
        finalMoves.textContent = moves.textContent;
        // Display the time taken to finish the game
        finalMinutes.textContent = minutes.textContent;
        finalSeconds.textContent = seconds.textContent;
        /**
         * @event document#click
         * @type {mouseEventParams}
         * @description If the player wants to play again,
         * remove the modal and reset the game.
         */
        document.querySelector(".play-again")
            .addEventListener("click", () => {
                modal.style.display = "none";
                resetGame();
            });
        /**
         * @event document#click
         * @type {mouseEventParams}
         * @description If the player doesn't want to play again,
         * just close the modal and retain the previous game stats.
         */
        document.querySelector(".close")
            .addEventListener("click", () => {
                modal.style.display = "none";
            });
    }, 100);
}
/**
 * @description When a player wins the game, a modal is displayed indicating
 * the number of stars achieved and the time taken to finish the game.
 * The player can simply close the modal, or the player can choose to play
 * again, in which case the game will be reset.
 */
@description When a player wins the game, a modal is displayed indicating
the number of stars achieved and the time taken to finish the game.
The player can simply close the modal, or the player can choose to play
again, in which case the game will be reset.
@description When a player wins the game a modal is displayed indicating the number of stars achieved and the time taken to finish the game . The player can simply close the modal or the player can choose to play again in which case the game will be reset .
function gameWon() {
    setTimeout(function () {
        modal.style.display = "block";
        firstFinalStar.className = firstStar.className;
        firstFinalStar.classList.add("fa-2x");
        secondFinalStar.className = secondStar.className;
        secondFinalStar.classList.add("fa-2x");
        thirdFinalStar.className = thirdStar.className;
        thirdFinalStar.classList.add("fa-2x");
        finalMoves.textContent = moves.textContent;
        finalMinutes.textContent = minutes.textContent;
        finalSeconds.textContent = seconds.textContent;
        document.querySelector(".play-again")
            .addEventListener("click", () => {
                modal.style.display = "none";
                resetGame();
            });
        document.querySelector(".close")
            .addEventListener("click", () => {
                modal.style.display = "none";
            });
    }, 100);
}
function gameWon ( ) { setTimeout ( function ( ) { modal . style . display = "block" ; firstFinalStar . className = firstStar . className ; firstFinalStar . classList . add ( "fa-2x" ) ; secondFinalStar . className = secondStar . className ; secondFinalStar . classList . add ( "fa-2x" ) ; thirdFinalStar . className = thirdStar . className ; thirdFinalStar . classList . add ( "fa-2x" ) ; finalMoves . textContent = moves . textContent ; finalMinutes . textContent = minutes . textContent ; finalSeconds . textContent = seconds . textContent ; document . querySelector ( ".play-again" ) . addEventListener ( "click" , ( ) => { modal . style . display = "none" ; resetGame ( ) ; } ) ; document . querySelector ( ".close" ) . addEventListener ( "click" , ( ) => { modal . style . display = "none" ; } ) ; } , 100 ) ; }
@description When a player wins the game, a modal is displayed indicating
 the number of stars achieved and the time taken to finish the game.
@description When a player wins the game a modal is displayed indicating the number of stars achieved and the time taken to finish the game .
// A small delay is needed to record the last move. // Display the modal. // Display the amount of stars earned. // Display the total moves. // Display the time taken to finish the game /**
         * @event document#click
         * @type {mouseEventParams}
         * @description If the player wants to play again,
         * remove the modal and reset the game.
         */ /**
         * @event document#click
         * @type {mouseEventParams}
         * @description If the player doesn't want to play again,
         * just close the modal and retain the previous game stats.
         */