Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- The following is for hypothetical 4 player:
- NOTE: "previousXXX" value (see below) can be updated every seconds OR minutes depending on desired payback period.
- [
- previousMetalOutput
- previousEOutput_1
- previousEOutput_2
- previousEOutput_3
- previousEOutput_4
- metalShare = previousMetalOutput/4
- {
- currentMetalOutput
- currentEOutput_1
- currentEOutput_2
- currentEOutput_3
- currentEOutput_4
- metalDiff = currentMetalOutput -previousMetalOutput
- eDiff_1 = currentEOutput_1 -previousEOutput_1
- eDiff_2 = currentEOutput_2 -previousEOutput_2
- eDiff_3 = currentEOutput_3 -previousEOutput_3
- eDiff_4 = currentEOutput_4 -previousEOutput_4
- totalEDiff = eDiff_1 + eDiff_2 + eDiff_3 + eDiff_4
- plyr1_share = eDiff_1/totalEDiff
- plyr2_share = eDiff_2/totalEDiff
- plyr3_share = eDiff_3/totalEDiff
- plyr4_share = eDiff_4/totalEDiff
- Function_giveMetal(player_1, metalShare + plyr1_share*metalDiff)
- Function_giveMetal(player_2, metalShare + plyr2_share*metalDiff)
- Function_giveMetal(player_3, metalShare + plyr3_share*metalDiff)
- Function_giveMetal(player_4, metalShare + plyr4_share*metalDiff)
- }
- previousMetalOutput
- previousEOutput_1
- previousEOutput_2
- previousEOutput_3
- previousEOutput_4
- ]
- PROOF:
- case A: all positive E & positive Overdrive metal output
- [
- previousMetalOutput = 100
- previousEOutput_1 = 10
- previousEOutput_2 = 5
- previousEOutput_3 = 6
- previousEOutput_4 = 7
- metalShare = previousMetalOutput/4 = 25
- {
- currentMetalOutput = 120
- currentEOutput_1 = 11
- currentEOutput_2 = 10
- currentEOutput_3 = 6
- currentEOutput_4 = 10
- metalDiff = 120 - 100 = 20
- eDiff_1 = 11 - 10 = 1
- eDiff_2 = 10 - 5 = 5
- eDiff_3 = 6 - 6 = 0
- eDiff_4 = 10 - 7 = 3
- totalEDiff = 1 + 5 + 0 + 3 = 9
- plyr1_share = 1/9 = 0.1111
- plyr2_share = 5/9 = 0.5555
- plyr3_share = 0/9 = 0
- plyr4_share = 3/9 = 0.3333
- Function_giveMetal(player_1, 25 + 2.222)
- Function_giveMetal(player_2, 25 + 11.11)
- Function_giveMetal(player_3, 25 + 0)
- Function_giveMetal(player_4, 25 + 6.666)
- }
- CHECK:
- previousMetalOutput + plyr1_share + plyr2_share + plyr3_share + plyr4_share= 25 + 2.222 + 25 + 11.11 + 25 + 0 + 25 + 6.666 = 119.998
- currentMetalOutput = 120
- *value matched to 2nd decimal, no missing value*
- ]
- Case B: some positive E, some deficit E, and generally positive Overdrive metal output
- [
- previousMetalOutput = 100
- previousEOutput_1 = 10
- previousEOutput_2 = 5
- previousEOutput_3 = 6
- previousEOutput_4 = 7
- metalShare = previousMetalOutput/4 = 25
- {
- currentMetalOutput = 120
- currentEOutput_1 = 14
- currentEOutput_2 = 3
- currentEOutput_3 = 4
- currentEOutput_4 = 10
- metalDiff = 120 - 100 = 20
- eDiff_1 = 14 - 10 = 4
- eDiff_2 = 3 - 5 = -2
- eDiff_3 = 4 - 6 = -2
- eDiff_4 = 10 - 7 = 3
- totalEDiff = 4 + -2 + -2 + 3 = 3
- plyr1_share = 4/3 = 1.3333
- plyr2_share = -2/3 = -0.6666
- plyr3_share = -2/3 = -0.6666
- plyr4_share = 3/3 = 1
- Function_giveMetal(player_1, 25 + 26.666)
- Function_giveMetal(player_2, 25 + -13.332)
- Function_giveMetal(player_3, 25 + -13.332)
- Function_giveMetal(player_4, 25 + 20)
- }
- CHECK:
- previousMetalOutput + plyr1_share + plyr2_share + plyr3_share + plyr4_share= 25 + 26.666 + 25 + -13.332 + 25 + -13.332 + 25 + 20 = 120.002
- currentMetalOutput = 120
- *value matched to 2nd decimal, no missing value*
- ]
- Case C: some positive E, some negative E, and generally negative Overdrive metal output
- [
- previousMetalOutput = 100
- previousEOutput_1 = 10
- previousEOutput_2 = 5
- previousEOutput_3 = 6
- previousEOutput_4 = 7
- metalShare = previousMetalOutput/4 = 25
- {
- currentMetalOutput = 80
- currentEOutput_1 = 5
- currentEOutput_2 = 4
- currentEOutput_3 = 7
- currentEOutput_4 = 8
- metalDiff = 80 - 100 = -20
- eDiff_1 = 5 - 10 = -5
- eDiff_2 = 4 - 5 = -1
- eDiff_3 = 7 - 6 = 1
- eDiff_4 = 8 - 7 = 1
- totalEDiff = -5 + -1 + 1 + 1 = -4
- plyr1_share = -5/-4 = 1.25
- plyr2_share = -1/-4 = 0.25
- plyr3_share = 1/-4 = -0.25
- plyr4_share = 1/-4 = -0.25
- Function_giveMetal(player_1, 25 + -25)
- Function_giveMetal(player_2, 25 + -5)
- Function_giveMetal(player_3, 25 + 5)
- Function_giveMetal(player_4, 25 + 5)
- }
- CHECK:
- previousMetalOutput + plyr1_share + plyr2_share + plyr3_share + plyr4_share= 25 + -25 + 25 + -5 + 25 + 5 + 25 + 5 = 80
- currentMetalOutput = 80
- *value matched, no missing value*
- ]
- Case D: all negative E, and generally negative Overdrive metal output
- [
- previousMetalOutput = 100
- previousEOutput_1 = 10
- previousEOutput_2 = 5
- previousEOutput_3 = 6
- previousEOutput_4 = 7
- metalShare = previousMetalOutput/4 = 25
- {
- currentMetalOutput = 80
- currentEOutput_1 = 5
- currentEOutput_2 = 4
- currentEOutput_3 = 5
- currentEOutput_4 = 6
- metalDiff = 80 - 100 = -20
- eDiff_1 = 5 - 10 = -5
- eDiff_2 = 4 - 5 = -1
- eDiff_3 = 5 - 6 = -1
- eDiff_4 = 6 - 7 = -1
- totalEDiff = -5 + -1 + -1 + -1 = -8
- plyr1_share = -5/-8 = 0.625
- plyr2_share = -1/-8 = 0.125
- plyr3_share = -1/-8 = 0.125
- plyr4_share = -1/-8 = 0.125
- Function_giveMetal(player_1, 25 + -12.5)
- Function_giveMetal(player_2, 25 + -2.5)
- Function_giveMetal(player_3, 25 + -2.5)
- Function_giveMetal(player_4, 25 + -2.5)
- }
- CHECK:
- previousMetalOutput + plyr1_share + plyr2_share + plyr3_share + plyr4_share= 25 + -12.5 + 25 + -2.5 + 25 + -2.5 + 25 + -2.5 = 80
- currentMetalOutput = 80
- *value matched, no missing value*
- ]
Advertisement
Add Comment
Please, Sign In to add comment