-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Added cummulative probability handling * executed build-dev command * executed build-final command
- Loading branch information
1 parent
ca1c28d
commit 9e98208
Showing
8 changed files
with
70 additions
and
6 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* The probability that a GC or reindeer has NOT spawned | ||
*/ | ||
let chanceTotal = 1.0; | ||
let chanceTotalDeer = 1.0; | ||
|
||
export function resetChanceTotal() { | ||
chanceTotal = 1.0; | ||
} | ||
|
||
export function resetChanceTotalDeer() { | ||
chanceTotalDeer = 1.0; | ||
} | ||
|
||
export function getChanceTotal() { | ||
return chanceTotal; | ||
} | ||
|
||
export function getChanceTotalDeer() { | ||
return chanceTotalDeer; | ||
} | ||
/** | ||
* Update the probability that a cookie has not spawned | ||
* @param {number} chanceToSpawn The probablity that a GC appears | ||
*/ | ||
export function updateChanceTotal(chanceToSpawn) { | ||
chanceTotal *= 1 - chanceToSpawn; | ||
} | ||
|
||
/** | ||
* Update the probability that a reindeer has not spawned | ||
* @param {number} chanceToSpawn The probablity that a reindeer appears | ||
*/ | ||
export function updateChanceTotalDeer(chanceToSpawn) { | ||
chanceTotalDeer *= 1 - chanceToSpawn; | ||
} | ||
/** | ||
* | ||
* @returns the cummulative probability that a GC has appeared from beginning to now | ||
*/ | ||
export function getChanceFinal() { | ||
return 1 - chanceTotal; | ||
} | ||
/** | ||
* | ||
* @returns the cummulative probability that a reindeer has appeared from beginning to now | ||
*/ | ||
export function getChanceFinalDeer() { | ||
return 1 - chanceTotalDeer; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters