From 0a970ff2f96c9693f1e99d8ed2176302df68c129 Mon Sep 17 00:00:00 2001 From: lulunac27a Date: Thu, 1 Feb 2024 21:50:20 -0600 Subject: [PATCH 1/3] Support more levels and fix incorrect calculations --- src/levels.ts | 56 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 53 insertions(+), 3 deletions(-) diff --git a/src/levels.ts b/src/levels.ts index 3b58f02..d7044d0 100644 --- a/src/levels.ts +++ b/src/levels.ts @@ -114,8 +114,58 @@ export interface LevelData { { points: 96150000, level: 106, pointsNext: 98120000 }, { points: 98120000, level: 107, pointsNext: 100110000 }, { points: 100110000, level: 108, pointsNext: 102120000 }, - { points: 102120000, level: 109, pointsNext: 102120000 }, - { points: 104150000, level: 110, pointsNext: 106150000 }, + { points: 102120000, level: 109, pointsNext: 104150000 }, + { points: 104150000, level: 110, pointsNext: 106200000 }, + { points: 106200000, level: 111, pointsNext: 108300000 }, + { points: 108300000, level: 112, pointsNext: 110450000 }, + { points: 110450000, level: 113, pointsNext: 112650000 }, + { points: 112650000, level: 114, pointsNext: 114900000 }, + { points: 114900000, level: 115, pointsNext: 117200000 }, + { points: 117200000, level: 116, pointsNext: 119550000 }, + { points: 119550000, level: 117, pointsNext: 121950000 }, + { points: 121950000, level: 118, pointsNext: 124400000 }, + { points: 124400000, level: 119, pointsNext: 126900000 }, + { points: 126900000, level: 120, pointsNext: 129450000 }, + { points: 129450000, level: 121, pointsNext: 132050000 }, + { points: 132050000, level: 122, pointsNext: 134700000 }, + { points: 134700000, level: 123, pointsNext: 137100000 }, + { points: 137100000, level: 124, pointsNext: 139850000 }, + { points: 139850000, level: 125, pointsNext: 142650000 }, + { points: 142650000, level: 126, pointsNext: 145500000 }, + { points: 145500000, level: 127, pointsNext: 148400000 }, + { points: 148400000, level: 128, pointsNext: 151350000 }, + { points: 151350000, level: 129, pointsNext: 154350000 }, + { points: 154350000, level: 130, pointsNext: 157400000 }, + { points: 157400000, level: 131, pointsNext: 160500000 }, + { points: 160500000, level: 132, pointsNext: 163650000 }, + { points: 163650000, level: 133, pointsNext: 166850000 }, + { points: 166850000, level: 134, pointsNext: 170100000 }, + { points: 170100000, level: 135, pointsNext: 173400000 }, + { points: 173400000, level: 136, pointsNext: 176750000 }, + { points: 176750000, level: 137, pointsNext: 180150000 }, + { points: 180150000, level: 138, pointsNext: 183600000 }, + { points: 183600000, level: 139, pointsNext: 187100000 }, + { points: 187100000, level: 140, pointsNext: 190650000 }, + { points: 190650000, level: 141, pointsNext: 194250000 }, + { points: 194250000, level: 142, pointsNext: 197900000 }, + { points: 197900000, level: 143, pointsNext: 201600000 }, + { points: 201600000, level: 144, pointsNext: 205350000 }, + { points: 205350000, level: 145, pointsNext: 209150000 }, + { points: 209150000, level: 146, pointsNext: 213000000 }, + { points: 213000000, level: 147, pointsNext: 216900000 }, + { points: 216900000, level: 148, pointsNext: 220850000 }, + { points: 220850000, level: 149, pointsNext: 224850000 }, + { points: 224850000, level: 150, pointsNext: 228900000 }, + { points: 228900000, level: 151, pointsNext: 233000000 }, + { points: 233000000, level: 152, pointsNext: 237150000 }, + { points: 237150000, level: 153, pointsNext: 241350000 }, + { points: 241350000, level: 154, pointsNext: 245600000 }, + { points: 245600000, level: 155, pointsNext: 249900000 }, + { points: 249900000, level: 156, pointsNext: 254250000 }, + { points: 254250000, level: 157, pointsNext: 258650000 }, + { points: 258650000, level: 158, pointsNext: 263100000 }, + { points: 263100000, level: 159, pointsNext: 267600000 }, + { points: 267600000, level: 160, pointsNext: 272200000 }, ]; export function getLevelForPoints(points: number): LevelData { @@ -147,4 +197,4 @@ export interface LevelData { const points = 5500; const level = getLevelForPoints(points); console.debug(`With ${points} points, the current level is ${level}.`); -*/ \ No newline at end of file +*/ From 7a5ad38189d1d653828941e3b8f0daf282975cdd Mon Sep 17 00:00:00 2001 From: lulunac27a Date: Fri, 2 Feb 2024 17:09:56 -0600 Subject: [PATCH 2/3] Add more levels and fix incorrect calculations --- src/levels.ts | 116 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 78 insertions(+), 38 deletions(-) diff --git a/src/levels.ts b/src/levels.ts index d7044d0..4f49b2b 100644 --- a/src/levels.ts +++ b/src/levels.ts @@ -128,44 +128,84 @@ export interface LevelData { { points: 126900000, level: 120, pointsNext: 129450000 }, { points: 129450000, level: 121, pointsNext: 132050000 }, { points: 132050000, level: 122, pointsNext: 134700000 }, - { points: 134700000, level: 123, pointsNext: 137100000 }, - { points: 137100000, level: 124, pointsNext: 139850000 }, - { points: 139850000, level: 125, pointsNext: 142650000 }, - { points: 142650000, level: 126, pointsNext: 145500000 }, - { points: 145500000, level: 127, pointsNext: 148400000 }, - { points: 148400000, level: 128, pointsNext: 151350000 }, - { points: 151350000, level: 129, pointsNext: 154350000 }, - { points: 154350000, level: 130, pointsNext: 157400000 }, - { points: 157400000, level: 131, pointsNext: 160500000 }, - { points: 160500000, level: 132, pointsNext: 163650000 }, - { points: 163650000, level: 133, pointsNext: 166850000 }, - { points: 166850000, level: 134, pointsNext: 170100000 }, - { points: 170100000, level: 135, pointsNext: 173400000 }, - { points: 173400000, level: 136, pointsNext: 176750000 }, - { points: 176750000, level: 137, pointsNext: 180150000 }, - { points: 180150000, level: 138, pointsNext: 183600000 }, - { points: 183600000, level: 139, pointsNext: 187100000 }, - { points: 187100000, level: 140, pointsNext: 190650000 }, - { points: 190650000, level: 141, pointsNext: 194250000 }, - { points: 194250000, level: 142, pointsNext: 197900000 }, - { points: 197900000, level: 143, pointsNext: 201600000 }, - { points: 201600000, level: 144, pointsNext: 205350000 }, - { points: 205350000, level: 145, pointsNext: 209150000 }, - { points: 209150000, level: 146, pointsNext: 213000000 }, - { points: 213000000, level: 147, pointsNext: 216900000 }, - { points: 216900000, level: 148, pointsNext: 220850000 }, - { points: 220850000, level: 149, pointsNext: 224850000 }, - { points: 224850000, level: 150, pointsNext: 228900000 }, - { points: 228900000, level: 151, pointsNext: 233000000 }, - { points: 233000000, level: 152, pointsNext: 237150000 }, - { points: 237150000, level: 153, pointsNext: 241350000 }, - { points: 241350000, level: 154, pointsNext: 245600000 }, - { points: 245600000, level: 155, pointsNext: 249900000 }, - { points: 249900000, level: 156, pointsNext: 254250000 }, - { points: 254250000, level: 157, pointsNext: 258650000 }, - { points: 258650000, level: 158, pointsNext: 263100000 }, - { points: 263100000, level: 159, pointsNext: 267600000 }, - { points: 267600000, level: 160, pointsNext: 272200000 }, + { points: 134700000, level: 123, pointsNext: 137400000 }, + { points: 137400000, level: 124, pointsNext: 140150000 }, + { points: 140150000, level: 125, pointsNext: 142950000 }, + { points: 142950000, level: 126, pointsNext: 145800000 }, + { points: 145800000, level: 127, pointsNext: 148700000 }, + { points: 148700000, level: 128, pointsNext: 151650000 }, + { points: 151650000, level: 129, pointsNext: 154650000 }, + { points: 154650000, level: 130, pointsNext: 157700000 }, + { points: 157700000, level: 131, pointsNext: 160800000 }, + { points: 160800000, level: 132, pointsNext: 163950000 }, + { points: 163950000, level: 133, pointsNext: 167150000 }, + { points: 167150000, level: 134, pointsNext: 170400000 }, + { points: 170400000, level: 135, pointsNext: 173700000 }, + { points: 173700000, level: 136, pointsNext: 177050000 }, + { points: 177050000, level: 137, pointsNext: 180450000 }, + { points: 180450000, level: 138, pointsNext: 183900000 }, + { points: 183900000, level: 139, pointsNext: 187400000 }, + { points: 187400000, level: 140, pointsNext: 190950000 }, + { points: 190950000, level: 141, pointsNext: 194550000 }, + { points: 194550000, level: 142, pointsNext: 198200000 }, + { points: 198200000, level: 143, pointsNext: 201900000 }, + { points: 201900000, level: 144, pointsNext: 205650000 }, + { points: 205650000, level: 145, pointsNext: 209450000 }, + { points: 209450000, level: 146, pointsNext: 213300000 }, + { points: 213300000, level: 147, pointsNext: 217200000 }, + { points: 217200000, level: 148, pointsNext: 221150000 }, + { points: 221150000, level: 149, pointsNext: 225150000 }, + { points: 225150000, level: 150, pointsNext: 229200000 }, + { points: 229200000, level: 151, pointsNext: 233300000 }, + { points: 233300000, level: 152, pointsNext: 237450000 }, + { points: 237450000, level: 153, pointsNext: 241650000 }, + { points: 241650000, level: 154, pointsNext: 245900000 }, + { points: 245900000, level: 155, pointsNext: 250200000 }, + { points: 250200000, level: 156, pointsNext: 254550000 }, + { points: 254550000, level: 157, pointsNext: 258950000 }, + { points: 258950000, level: 158, pointsNext: 263400000 }, + { points: 263400000, level: 159, pointsNext: 267900000 }, + { points: 267900000, level: 160, pointsNext: 272500000 }, + { points: 272500000, level: 161, pointsNext: 277200000 }, + { points: 277200000, level: 162, pointsNext: 282000000 }, + { points: 282000000, level: 163, pointsNext: 286900000 }, + { points: 286900000, level: 164, pointsNext: 291900000 }, + { points: 291900000, level: 165, pointsNext: 297000000 }, + { points: 297000000, level: 166, pointsNext: 302200000 }, + { points: 302200000, level: 167, pointsNext: 307500000 }, + { points: 307500000, level: 168, pointsNext: 312900000 }, + { points: 312900000, level: 169, pointsNext: 318400000 }, + { points: 318400000, level: 170, pointsNext: 324000000 }, + { points: 324000000, level: 171, pointsNext: 329700000 }, + { points: 329700000, level: 172, pointsNext: 335500000 }, + { points: 335500000, level: 173, pointsNext: 341400000 }, + { points: 341400000, level: 174, pointsNext: 347400000 }, + { points: 347400000, level: 175, pointsNext: 353500000 }, + { points: 353500000, level: 176, pointsNext: 359700000 }, + { points: 359700000, level: 177, pointsNext: 366000000 }, + { points: 366000000, level: 178, pointsNext: 372400000 }, + { points: 372400000, level: 179, pointsNext: 378900000 }, + { points: 378900000, level: 180, pointsNext: 385500000 }, + { points: 385500000, level: 181, pointsNext: 392200000 }, + { points: 392200000, level: 182, pointsNext: 399000000 }, + { points: 399000000, level: 183, pointsNext: 405900000 }, + { points: 405900000, level: 184, pointsNext: 412900000 }, + { points: 412900000, level: 185, pointsNext: 420000000 }, + { points: 420000000, level: 186, pointsNext: 427200000 }, + { points: 427200000, level: 187, pointsNext: 434500000 }, + { points: 434500000, level: 188, pointsNext: 441900000 }, + { points: 441900000, level: 189, pointsNext: 449400000 }, + { points: 449400000, level: 190, pointsNext: 457000000 }, + { points: 457000000, level: 191, pointsNext: 464700000 }, + { points: 464700000, level: 192, pointsNext: 472500000 }, + { points: 472500000, level: 193, pointsNext: 480400000 }, + { points: 480400000, level: 194, pointsNext: 488400000 }, + { points: 488400000, level: 195, pointsNext: 496500000 }, + { points: 496500000, level: 196, pointsNext: 504700000 }, + { points: 504700000, level: 197, pointsNext: 513000000 }, + { points: 513000000, level: 198, pointsNext: 521400000 }, + { points: 521400000, level: 199, pointsNext: 529900000 }, + { points: 529900000, level: 200, pointsNext: 538500000 }, ]; export function getLevelForPoints(points: number): LevelData { From 187a2821d93a67e6ae5d44ef8c425eea6184f97a Mon Sep 17 00:00:00 2001 From: lulunac27a Date: Sat, 3 Feb 2024 08:35:12 -0600 Subject: [PATCH 3/3] Fix failed test --- tests/levels.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/levels.test.ts b/tests/levels.test.ts index e749561..54f2c7d 100644 --- a/tests/levels.test.ts +++ b/tests/levels.test.ts @@ -56,7 +56,7 @@ describe('getLevelForPoints', () => { it('should return 110 (level) if points are 104150000', () => { const actual = getLevelForPoints(104150000); - const expected = { points: 104150000, level: 110, pointsNext: 106150000 }; + const expected = { points: 104150000, level: 110, pointsNext: 106200000 }; expect(actual).toStrictEqual(expected); }); });