Meteor RangeError:future.js中超出了最大调用堆栈大小

时间:2015-02-17 08:59:57

标签: meteor

我有一个小纸牌游戏,我有一个经销商向玩家分发卡片。我的game.js中的这段代码使Meteor崩溃并导致RangeError: Maximum call stack size exceeded

Dealer = {
    deal: function(players, deck) {

        for(var j=0; j < players.length; j++) {
            var p = players[j];

            for(var i=0; i < 3; i++) {

                //assign card to player
                var card = deck.shift();
                card.owner = p;
                p.cards.push(card);

            }
        }
    }
};

/server/main.js我有一些设置新游戏的代码

var table = new Table();

var deck = new Deck();
deck.deck = deck.shuffle();

var trump = deck.deck[_.random(0, 39)];
trump.is_trump = true;

var human = new Player('Human', false);
var computer = new Player('Computer', true);
var players = [human, computer];

console.log('Players: ', players);

//this last line is the one that calls the Dealer above
Dealer.deal(players, deck.deck); 

我该如何调试此错误? card.owner = p

在future.js的第245行附近抛出异常

我是否应该考虑以不同的方式编写此代码?

0 个答案:

没有答案