Created
July 4, 2019 04:23
-
-
Save iboss-ptk/ce5a8ae61cc13eab97bed8893fd86895 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| const id = exp => exp | |
| const promo = exp => exp * 2 | |
| const trueCash = exp => exp * 10 | |
| const makeTotalExp = upgraders => monsters => monsters | |
| .reduce((totalExp, monster) => { | |
| const upgradedExp = upgraders | |
| .reduce((upgradedExp, upgrade) => upgrade(upgradedExp), monster.exp) | |
| return totalExp + upgradedExp | |
| }, 0) | |
| const totalExp = makeTotalExp([id]) | |
| const totalExpPromo = makeTotalExp([promo]) | |
| const totalExpTrueCash = makeTotalExp([trueCash]) | |
| const totalExpTrueCashPromo = makeTotalExp([trueCash, promo]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment