-
-
Couldn't load subscription status.
- Fork 240
Birmingham | 25-ITP-Sept | Khor Biel | Sprint 3 | coursework/sprint-3-implement-and-rewrite #797
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
base: main
Are you sure you want to change the base?
Birmingham | 25-ITP-Sept | Khor Biel | Sprint 3 | coursework/sprint-3-implement-and-rewrite #797
Conversation
|
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
| // Handle invalid denominators (e.g., divide by zero) | ||
| if (denominator === 0) { | ||
| return false; | ||
| } | ||
|
|
||
| // Compare absolute values for proper fraction check | ||
| if (Math.abs(numerator) < Math.abs(denominator)) { | ||
| return true; | ||
| } else { | ||
| return false; | ||
| } |
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.
This solution is correct. If you are up to some challenge, try simplify the code to use at most one if-statement.
| if (!isNaN(rank) && Number(rank) >= 2 && Number(rank) <= 9) { | ||
| return Number(rank); | ||
| } |
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.
In JavaScript, strings that represent valid numeric literals in the language can be safely
converted to equivalent numbers or parsed into a valid integers.
Do you want to recognize these string values as valid ranks?
To find out what these strings are, you can ask AI
What kinds of string values would make
Number(rank)evaluate to2in JS?
|
The PR description is missing a "Changelist' section with a brief description of the changes made in PR. |
|
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
1 similar comment
|
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
|
@cjyuan I fixed some errors that you mentioned |
|
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
|
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
1 similar comment
|
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
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.
- The bot's message "Your PR description contained template fields" refers to the placeholder text "Briefly explain your PR" in the PR description. The bot expects you to delete it after you typed your brief description.
| } else if ((parseInt(rank) >= 2 && parseInt(rank)) && parseInt(rank) < 11){ | ||
| return parseInt(rank) | ||
| } |
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.
Can you find out from AI what strings can make the expression ((parseInt(rank) >= 2 && parseInt(rank)) && parseInt(rank) < 11) evaluate to true?
Should all of these strings be recognized as valid rank?
Also, what's the purpose of (... && parseInt(rank))?
| } else if ((parseInt(rank) >= 2 && parseInt(rank)) && parseInt(rank) < 11){ | ||
| return parseInt(rank) | ||
| } | ||
| else if( rank === "J" || rank === "Q" || rank === "K") { |
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.
What you had before is equally good.
if (["K", "Q", "J", "10"].includes(rank)) {
| // write one test at a time, and make it pass, build your solution up methodically | ||
| // just make one change at a time -- don't rush -- programmers are deep and careful thinkers | ||
| function getCardValue(card) { | ||
| let rank = card.slice(0, card.length - 1); |
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.
Why replaced const rank = card.slice(0, -1);?
|
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
1 similar comment
|
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
Self checklist