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

implement short-deck game variant + updates to get build/tests/lint to pass #5

Merged
merged 12 commits into from
Aug 5, 2018

Conversation

dheffx
Copy link
Contributor

@dheffx dheffx commented Aug 1, 2018

  • updated packages to resolve npm audit vulnerabilities
  • change lodash calls in HandRank to pass typescript compilation
  • code tweaks to satisfy tslint
  • update to tslint.config to ignores warnings i either could not figure out how to resolve, or seemed innocuous / over aggressive
  • implement short deck game logic
  • added launch config to add easy debugging during unit test runs in vscode
  • changed travis config to test additional versions of node

I have verified the build, test, and coverage in the following versions of node
6.14.3
7.10.1
8.11.3 (lts)
9.11.2
10.7.0
10.6.0 (stable)

as for the short-deck implementation itself

Usage via CLI is non-breaking. If no game is supplied, it will default to full-deck.
Usage via code is breaking, as the OddsCalculator.calculate() function requires an additional argument (though it does fall back to full-deck if the argument is null), since the “iterations” argument was optionally in the args. Maybe there is a better way to achieve this, like a overloaded method in Java.

The calculate function will check the game type and perform the following actions

  • if it is short-deck, and the input board or hands contains a card lower than 6, an error is thrown
  • pick the game rules object to initiate, which are both implementing an interface IGame which designates the differentiations in rules and ranks. The different rankings of flush and full house allow short-deck to determine a flush beats a full house. There is also additional logic around the A-lo straights, to accommodate the A-6-7-8-9 straight.

@rundef
Copy link
Owner

rundef commented Aug 3, 2018

Nice work 👍
Looks good to me

Juste one small comment: can you remove .vscode/* and add that folder to gitignore ?

Thanks

@dheffx
Copy link
Contributor Author

dheffx commented Aug 3, 2018

yep, done

@rundef rundef merged commit 49b0994 into rundef:master Aug 5, 2018
@rundef
Copy link
Owner

rundef commented Aug 5, 2018

Thanks @dheffx

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

Successfully merging this pull request may close these issues.

None yet

2 participants