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

With new API, refactored Riichi calculations to be a formula #64

Merged
merged 3 commits into from
Sep 25, 2018

Conversation

0spooky2me
Copy link
Collaborator

@0spooky2me 0spooky2me commented Sep 23, 2018

Some quality of life improvements, like utilising lists instead of
discrete variables
Most importantly, made HandScoreCalculator for hand calculation

Involved in issue #65

Some quality of life improvements, like utilising lists instead of
discrete variables
Most importantly, made HandScoreCalculator for hand calculation
@0spooky2me 0spooky2me self-assigned this Sep 24, 2018
Copy link
Member

@TwelveNights TwelveNights left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I gotta say that it looks pretty good more or less. Good work

// Check to see if you have to count basic points
if (points < 5) {
if (fu === 20 || (points === 1 && fu === 25)) {
throw TypeError("Invalid points/fu combination");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can make our own custom exception for this, since TypeError isn't exactly correct

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, it should be RangeError

imports/api/HandScoreCalculator.js Outdated Show resolved Hide resolved
Constants.WINDS.forEach(w => {winds[w] = 0});
let basicPoints;
let nonDealerPays;
let dealerPays;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can declare these uninitialized variables on one line

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yo I copy & pasted your code man, will change.

Changed exception type to RangeError
Removed extraneous braces
Declared variables in one line where applicable
@0spooky2me 0spooky2me force-pushed the genericise-japanese-score-calculation branch from 2bde6e8 to 99a217e Compare September 24, 2018 08:54
@Mooters Mooters closed this Sep 25, 2018
@0spooky2me
Copy link
Collaborator Author

Accidental closure

@0spooky2me 0spooky2me reopened this Sep 25, 2018
@0spooky2me 0spooky2me merged commit 9466261 into master Sep 25, 2018
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.

3 participants