ayuda con juego

Buenas dias, solicito de su ayuda para poder hacer que este juego solo tenga la posibilidad de jugarse 3 veces. no logro hacerlo, el juego funciona correctamente, solo me hace falta eso.

var Memory = {

init: function(cards) { this.$game = $(".game"); this.$modal = $(".modal"); this.$overlay = $(".modal-overlay"); this.cardsArray = $.merge(cards, cards); this.shuffleCards(this.cardsArray); this.setup(); },

shuffleCards: function(cardsArray) { this.$cards = $(this.shuffle(this.cardsArray)); },

setup: function() { this.html = this.buildHTML(); this.$game.html(this.html); this.$memoryCards = $(".card"); this.binding(); this.paused = false; this.guess = null; },

binding: function() { this.$memoryCards.on("click", this.cardClicked); }, kinda messy but hey cardClicked: function() { var = Memory; var $card = $(this); if (!.paused && !$card.find(".inside").hasClass("matched") && !$card.find(".inside").hasClass("picked")) { $card.find(".inside").addClass("picked"); if (!.guess) { .guess = $(this).attr("data-id"); } else if (.guess == $(this).attr("data-id") && !$(this).hasClass("picked")) { $(".picked").addClass("matched"); .guess = null; } else { .guess = null; .paused = true; setTimeout(function() { $(".picked").removeClass("picked"); Memory.paused = false; }, 600); } if ($(".matched").length == $(".card").length) { _.win(); } } },

win: function() { this.paused = true; clearTimeout(t); $.ajax({ method: 'POST', url: win_url, data: { 'time' : (hours ? (hours > 9 ? hours : "0" + hours + ":") : " ") + (minutes ? (minutes > 9 ? minutes : "0" + minutes) : "00") + ":" + (seconds > 9 ? seconds : "0" + seconds) + ":" + (mili > 9 ? mili : "0" + mili), 'user' : user_id, 'game' : game_id }, a JSON object to send back success: function(response){ // What to do if we succeed Memory.showModal(); Memory.$game.fadeOut(); setTimeout(function() { location.reload(); }, 5000);

}, error: function(jqXHR, textStatus, errorThrown) { // What to do if we fail console.log(JSON.stringify(jqXHR)); console.log("AJAX error: " + textStatus + ' : ' + errorThrown);// } }); },

showModal: function() { this.$overlay.show(); this.$modal.fadeIn("slow"); },

hideModal: function() { this.$overlay.hide(); this.$modal.hide(); },

reset: function() { this.hideModal(); this.shuffleCards(this.cardsArray); this.setup(); this.$game.show("slow"); },

Fisher--Yates Algorithm -- http://bost.ocks.org/mike/shuffle/ shuffle: function(array) { var counter = array.length, temp, index; While there are elements in the array while (counter > 0) { Pick a random index index = Math.floor(Math.random() * counter); Decrease counter by 1 counter--; And swap the last element with it temp = array[counter]; array[counter] = array[index]; array[index] = temp; } return array; },

buildHTML: function() { var frag = ''; this.$cards.each(function(k, v) { frag += '

\

' + v.name + '