From a4c650922272b38e9f5504e85119f1a2a577698c Mon Sep 17 00:00:00 2001 From: nathyong Date: Thu, 3 Dec 2020 12:56:02 +1100 Subject: [PATCH] Document magic value in Tetra-X randomizer --- tetris/randomizers/tetra.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/tetris/randomizers/tetra.lua b/tetris/randomizers/tetra.lua index 4b3f682..7dcea7e 100644 --- a/tetris/randomizers/tetra.lua +++ b/tetris/randomizers/tetra.lua @@ -58,6 +58,7 @@ function TetraXRandomizer:generatePiece() -- shuffle the piece selection for the next time self.pieceselection = {} 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 chances = math.floor(probability * 1000 + 0.5) -- simulated "round" for _ = 1, chances do