Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CreateCards and CreateCard() raise error. #7

Closed
henryhu123 opened this issue Mar 15, 2019 · 2 comments
Closed

CreateCards and CreateCard() raise error. #7

henryhu123 opened this issue Mar 15, 2019 · 2 comments

Comments

@henryhu123
Copy link

const { Pack, Hand, HandsCollection } = require('tx-holdem');

const pack = new Pack();

const board = new Hand(pack.createCards(5));

const pocket = new Hand([
    pack.createCard(),
    pack.createCard(),
]);

const coll = HandsCollection.createCombinations(board, pocket);

console.log('Highest is', coll.highestCombination.name);

or

const { Pack, Hand, HandsCollection } = require('tx-holdem');

const pack = new Pack();

const board = new Hand([
    pack.createCard(),
    pack.createCard(),
    pack.createCard(),
    pack.createCard(),
    pack.createCard(),
]);

const pocket = new Hand([
    pack.createCard(),
    pack.createCard(),
]);

const coll = HandsCollection.createCombinations(board, pocket);

console.log('Highest is', coll.highestCombination.name);

Both shows error in console with following information,

        this.cards.sort((l, r) => order === 'asc' ? l.compare(r) : r.compare(l));
                                                      ^

TypeError: Cannot read property 'compare' of null
    at cards.sort (C:\Users\HU\Desktop\c09\node_modules\tx-holdem\src\hand.js:220:55)
    at Array.sort (native)
    at Hand.sort (C:\Users\HU\Desktop\c09\node_modules\tx-holdem\src\hand.js:220:20)
    at new Hand (C:\Users\HU\Desktop\c09\node_modules\tx-holdem\src\hand.js:20:14)
    at Object.<anonymous> (C:\Users\HU\Desktop\c09\app.js:15:15)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)

Did I miss something or it is a bug?

@Merisho
Copy link
Owner

Merisho commented Mar 15, 2019

Hi @henryhu123 ,

thanks for your request. I will take a loot at it today

@Merisho
Copy link
Owner

Merisho commented Mar 18, 2019

Hello @henryhu123 ,

The issue has been resolved in the new 1.0.0 version. Please try to use it again.
Thank you for your issue request.

@Merisho Merisho closed this as completed Mar 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants