uno icon indicating copy to clipboard operation
uno copied to clipboard

game.uno() throws error for non current players

Open nikhilbaby opened this issue 5 years ago • 0 comments

I tried the following code:

const {
  Card, Game,
} = require('uno-engine-updated');

const game = new Game(['1', '2', '3']);

The current player is 3 and when I try to run:

game.uno('2')

I get an error like this:

TypeError: Cannot read property 'length' of undefined

The error is from game.js line 217

        if (yellingPlayer.hand.length <= 2 && !this.yellers[yellingPlayer.name]) {
            this.yellers[yellingPlayer.name] = true;
            return [];
        }

Please let me know what is the issue here. Is it something expected from the package.

nikhilbaby avatar Oct 24 '19 07:10 nikhilbaby