https://github.com/bell-kevin/codewars-style-ranking-system
Codewars style ranking system. 4 kyu. Write a class called User that is used to calculate the amount that a user will progress through a ranking system similar to the one Codewars uses. Business Rules: A user starts at rank -8 and can progress all the way to 8. There is no 0 (zero) rank. The next rank after -1 is 1. Users will complete activities. These activities also have ranks. Each time the user completes a ranked activity the users rank progress is updated based off of the activity's rank The progress earned from the completed activity is relative to what the user's current rank is compared to the rank of the activity A user's rank progress starts off at zero, each time the progress reaches 100 the user's rank is upgraded to the next level Any remaining progress earned while in the previous rank will be applied towards the next rank's progress (we don't throw any progress away). The exception is if there is no other rank left to progress towards (Once you reach rank 8 there is no more progression). A user cannot progress beyond rank 8. The only acceptable range of rank values is -8,-7,-6,-5,-4,-3,-2,-1,1,2,3,4,5,6,7,8. Any other value should raise an error. The progress is scored like so: Completing an activity that is ranked the same as that of the user's will be worth 3 points Completing an activity that is ranked one ranking lower than the user's will be worth 1 point Any activities completed that are ranking 2 levels or more lower than the user's ranking will be ignored Completing an activity ranked higher than the current user's rank will accelerate the rank progression. The greater the difference between rankings the more the progression will be increased. The formula is 10 * d * d where d equals the difference in ranking between the activity and the user. Logic Examples: If a user ranked -8 completes an activity ranked -7 they will receive 10 progress If a user ranked -8 completes an activity ranked -6 they will receive 40 progress If a user ranked -8 completes an activity ranked -5 they will receive 90 progress If a user ranked -8 completes an activity ranked -4 they will receive 160 progress, resulting in the user being upgraded to rank -7 and having earned 60 progress towards their next rank If a user ranked -1 completes an activity ranked 1 they will receive 10 progress (remember, zero rank is ignored)
https://github.com/bell-kevin/codewars-style-ranking-system
codewars-kata-solution
Last synced: 8 months ago
JSON representation
Codewars style ranking system. 4 kyu. Write a class called User that is used to calculate the amount that a user will progress through a ranking system similar to the one Codewars uses. Business Rules: A user starts at rank -8 and can progress all the way to 8. There is no 0 (zero) rank. The next rank after -1 is 1. Users will complete activities. These activities also have ranks. Each time the user completes a ranked activity the users rank progress is updated based off of the activity's rank The progress earned from the completed activity is relative to what the user's current rank is compared to the rank of the activity A user's rank progress starts off at zero, each time the progress reaches 100 the user's rank is upgraded to the next level Any remaining progress earned while in the previous rank will be applied towards the next rank's progress (we don't throw any progress away). The exception is if there is no other rank left to progress towards (Once you reach rank 8 there is no more progression). A user cannot progress beyond rank 8. The only acceptable range of rank values is -8,-7,-6,-5,-4,-3,-2,-1,1,2,3,4,5,6,7,8. Any other value should raise an error. The progress is scored like so: Completing an activity that is ranked the same as that of the user's will be worth 3 points Completing an activity that is ranked one ranking lower than the user's will be worth 1 point Any activities completed that are ranking 2 levels or more lower than the user's ranking will be ignored Completing an activity ranked higher than the current user's rank will accelerate the rank progression. The greater the difference between rankings the more the progression will be increased. The formula is 10 * d * d where d equals the difference in ranking between the activity and the user. Logic Examples: If a user ranked -8 completes an activity ranked -7 they will receive 10 progress If a user ranked -8 completes an activity ranked -6 they will receive 40 progress If a user ranked -8 completes an activity ranked -5 they will receive 90 progress If a user ranked -8 completes an activity ranked -4 they will receive 160 progress, resulting in the user being upgraded to rank -7 and having earned 60 progress towards their next rank If a user ranked -1 completes an activity ranked 1 they will receive 10 progress (remember, zero rank is ignored)
- Host: GitHub
- URL: https://github.com/bell-kevin/codewars-style-ranking-system
- Owner: bell-kevin
- License: gpl-3.0
- Created: 2022-06-29T20:31:07.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-07-06T22:39:07.000Z (almost 4 years ago)
- Last Synced: 2025-01-23T16:49:27.960Z (over 1 year ago)
- Topics: codewars-kata-solution
- Language: JavaScript
- Homepage:
- Size: 17.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Codewars-style-ranking-system
Codewars style ranking system. 4 kyu. Write a class called User that is used to calculate the amount that a user will progress through a ranking system similar to the one Codewars uses. Business Rules: A user starts at rank -8 and can progress all the way to 8. There is no 0 (zero) rank. The next rank after -1 is 1. Users will complete activities. These activities also have ranks. Each time the user completes a ranked activity the users rank progress is updated based off of the activity's rank The progress earned from the completed activity is relative to what the user's current rank is compared to the rank of the activity A user's rank progress starts off at zero, each time the progress reaches 100 the user's rank is upgraded to the next level Any remaining progress earned while in the previous rank will be applied towards the next rank's progress (we don't throw any progress away). The exception is if there is no other rank left to progress towards (Once you reach rank 8 there is no more progression). A user cannot progress beyond rank 8. The only acceptable range of rank values is -8,-7,-6,-5,-4,-3,-2,-1,1,2,3,4,5,6,7,8. Any other value should raise an error. The progress is scored like so: Completing an activity that is ranked the same as that of the user's will be worth 3 points Completing an activity that is ranked one ranking lower than the user's will be worth 1 point Any activities completed that are ranking 2 levels or more lower than the user's ranking will be ignored Completing an activity ranked higher than the current user's rank will accelerate the rank progression. The greater the difference between rankings the more the progression will be increased. The formula is 10 * d * d where d equals the difference in ranking between the activity and the user. Logic Examples: If a user ranked -8 completes an activity ranked -7 they will receive 10 progress If a user ranked -8 completes an activity ranked -6 they will receive 40 progress If a user ranked -8 completes an activity ranked -5 they will receive 90 progress If a user ranked -8 completes an activity ranked -4 they will receive 160 progress, resulting in the user being upgraded to rank -7 and having earned 60 progress towards their next rank If a user ranked -1 completes an activity ranked 1 they will receive 10 progress (remember, zero rank is ignored)
== We're Using GitHub Under Protest ==
This project is currently hosted on GitHub. This is not ideal; GitHub is a
proprietary, trade-secret system that is not Free and Open Souce Software
(FOSS). We are deeply concerned about using a proprietary system like GitHub
to develop our FOSS project. We have an
[open {bug ticket, mailing list thread, etc.} ](INSERT_LINK) where the
project contributors are actively discussing how we can move away from GitHub
in the long term. We urge you to read about the
[Give up GitHub](https://GiveUpGitHub.org) campaign from
[the Software Freedom Conservancy](https://sfconservancy.org) to understand
some of the reasons why GitHub is not a good place to host FOSS projects.
If you are a contributor who personally has already quit using GitHub, please
[check this resource](INSERT_LINK) for how to send us contributions without
using GitHub directly.
Any use of this project's code by GitHub Copilot, past or present, is done
without our permission. We do not consent to GitHub's use of this project's
code in Copilot.
