mirror of
https://github.com/SashLilac/cambridge-modpack.git
synced 2024-11-22 17:09:02 -06:00
Document magic value in Tetra-X randomizer
This commit is contained in:
parent
52ee433e7f
commit
a4c6509222
@ -58,6 +58,7 @@ function TetraXRandomizer:generatePiece()
|
|||||||
-- shuffle the piece selection for the next time
|
-- shuffle the piece selection for the next time
|
||||||
self.pieceselection = {}
|
self.pieceselection = {}
|
||||||
for piece, count in pairs(self.count) do
|
for piece, count in pairs(self.count) do
|
||||||
|
-- in this case 6 = #piece types - 1, so all probabilities sum to 1
|
||||||
local probability = (self.totalcount - count) / (self.totalcount * 6)
|
local probability = (self.totalcount - count) / (self.totalcount * 6)
|
||||||
local chances = math.floor(probability * 1000 + 0.5) -- simulated "round"
|
local chances = math.floor(probability * 1000 + 0.5) -- simulated "round"
|
||||||
for _ = 1, chances do
|
for _ = 1, chances do
|
||||||
|
Loading…
Reference in New Issue
Block a user