-
Notifications
You must be signed in to change notification settings - Fork 4
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
Conversation
Some quality of life improvements, like utilising lists instead of discrete variables Most importantly, made HandScoreCalculator for hand calculation
There was a problem hiding this 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
imports/api/HandScoreCalculator.js
Outdated
// 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"); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
Constants.WINDS.forEach(w => {winds[w] = 0}); | ||
let basicPoints; | ||
let nonDealerPays; | ||
let dealerPays; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
2bde6e8
to
99a217e
Compare
Accidental closure |
Some quality of life improvements, like utilising lists instead of
discrete variables
Most importantly, made HandScoreCalculator for hand calculation
Involved in issue #65