diff --git a/tetris/components/lifegrid.lua b/tetris/components/lifegrid.lua index 214057d..37ea486 100644 --- a/tetris/components/lifegrid.lua +++ b/tetris/components/lifegrid.lua @@ -561,7 +561,7 @@ function LifeGrid:advanceLife() if (count == 3) and (newgrid[y][x] == empty) then newgrid[y][x] = { skin = "2tie", - colour = ({"R", "O", "Y", "G", "B", "C", "M"})[math.random(7)] + colour = ({"R", "O", "Y", "G", "B", "C", "M"})[love.math.random(7)] } end end diff --git a/tetris/modes/combo_challenge.lua b/tetris/modes/combo_challenge.lua index eb8b0de..7211fc3 100644 --- a/tetris/modes/combo_challenge.lua +++ b/tetris/modes/combo_challenge.lua @@ -44,7 +44,7 @@ local maps = { function ComboChallenge:new() GameMode:new() self.grid = Grid(4, 24) - self.grid:applyMap(maps[math.random(#maps)]) + self.grid:applyMap(maps[love.math.random(#maps)]) self.randomizer = BagRandomizer() self.lock_drop = false self.lock_hard_drop = false diff --git a/tetris/modes/demon_mode.lua b/tetris/modes/demon_mode.lua index 893d203..628c22b 100644 --- a/tetris/modes/demon_mode.lua +++ b/tetris/modes/demon_mode.lua @@ -27,7 +27,7 @@ function DemonModeGame:new() self.lock_drop = true self.lock_hard_drop = true self.next_queue_length = 6 - if math.random() < 1/6.66 then + if love.math.random() < 1/6.66 then self.rpc_details = "Suffering" end end diff --git a/tetris/modes/hero.lua b/tetris/modes/hero.lua index e7c67c4..a91fdfd 100644 --- a/tetris/modes/hero.lua +++ b/tetris/modes/hero.lua @@ -135,25 +135,25 @@ function TheTrueHero:advanceOneFrame(inputs, ruleset) ) and (attack_rolls < 2)) or attack_rolls == 0 do attack_rolls = attack_rolls + 1 if self.attack_number > 20 then - self.current_attack = math.random(#self.attacks) + self.current_attack = love.math.random(#self.attacks) else - self.current_attack = math.random(4) + self.current_attack = love.math.random(4) end end if self.current_attack == 1 then - self.var = math.floor(3 + math.random( + self.var = math.floor(3 + love.math.random( math.floor(self.attack_number / 4), math.floor(self.attack_number / 3) ) * self.section_times[Mod1(self.attack_number, #self.section_times)] / 342) elseif self.current_attack == 2 then - self.var = math.floor(1 + math.random( + self.var = math.floor(1 + love.math.random( math.floor(self.attack_number / 6), math.floor(self.attack_number / 4) ) * self.section_times[Mod1(self.attack_number, #self.section_times)] / 342) elseif self.current_attack == 3 then - self.var = math.max(10 - math.random( + self.var = math.max(10 - love.math.random( math.floor(self.attack_number / 8), math.floor(self.attack_number / 4) ), 3) @@ -212,7 +212,7 @@ end function TheTrueHero:advanceBottomRow(dx) if self.var <= 0 and self.current_attack == 3 then self.grid:copyBottomRow() - self.var = math.max(10 - math.random( + self.var = math.max(10 - love.math.random( math.floor(self.attack_number / 8), math.floor(self.attack_number / 4) ), 3) diff --git a/tetris/modes/marathon_wcb.lua b/tetris/modes/marathon_wcb.lua index 51d2ced..f86cebc 100644 --- a/tetris/modes/marathon_wcb.lua +++ b/tetris/modes/marathon_wcb.lua @@ -93,7 +93,7 @@ function MarathonWCBGame:shuffleColours() table.insert(temp_colours, colour) end for piece in pairs(self.ruleset.colourscheme) do - self.ruleset.colourscheme[piece] = table.remove(temp_colours, math.random(#temp_colours)) + self.ruleset.colourscheme[piece] = table.remove(temp_colours, love.math.random(#temp_colours)) end end diff --git a/tetris/modes/minesweeper.lua b/tetris/modes/minesweeper.lua index 4c5d2df..72144ce 100644 --- a/tetris/modes/minesweeper.lua +++ b/tetris/modes/minesweeper.lua @@ -33,7 +33,7 @@ end function Minesweeper:initializeGrid() self.grid = Grid(width, height + 4) self.flags = math.floor(0.15 * width * height) - self.chosen_colour = ({ "R", "O", "Y", "G", "C", "B", "M" })[math.random(7)] + self.chosen_colour = ({ "R", "O", "Y", "G", "C", "B", "M" })[love.math.random(7)] for y = 1, height do for x = 1, width do self.grid.grid[y+4][x] = { skin = "2tie", colour = self.chosen_colour } @@ -45,8 +45,8 @@ function Minesweeper:initializeMines(sel_x, sel_y) for i = 1, self.flags do local x, y repeat - x = math.random(1, width) - y = math.random(1, height) + x = love.math.random(1, width) + y = love.math.random(1, height) until not (self:isMine(x, y) or (sel_x == x and sel_y == y)) table.insert(self.mines, {x=x, y=y}) end diff --git a/tetris/modes/snake.lua b/tetris/modes/snake.lua index ab0c260..10f04a7 100644 --- a/tetris/modes/snake.lua +++ b/tetris/modes/snake.lua @@ -59,8 +59,8 @@ end function Snake:generateGem() repeat - self.gem.x = math.random(1, 25) - self.gem.y = math.random(5, 24) + self.gem.x = love.math.random(1, 25) + self.gem.y = love.math.random(5, 24) until not self:isInSnake({x=self.gem.x, y=self.gem.y}) end diff --git a/tetris/modes/stacker.lua b/tetris/modes/stacker.lua index 40cdaac..c576eac 100644 --- a/tetris/modes/stacker.lua +++ b/tetris/modes/stacker.lua @@ -55,8 +55,8 @@ function StackerGame:advanceOneFrame(inputs, ruleset) self.are = self.are - 1 return false elseif self.are == 0 then - self.position = math.random(1, 7 + self.block_width - 1) - self.direction = ({-1, 1})[math.random(2)] + self.position = love.math.random(1, 7 + self.block_width - 1) + self.direction = ({-1, 1})[love.math.random(2)] self.are = -1 end if not self.prev_inputs.up and inputs.up then diff --git a/tetris/randomizers/bag5.lua b/tetris/randomizers/bag5.lua index 7344bcb..58846e9 100644 --- a/tetris/randomizers/bag5.lua +++ b/tetris/randomizers/bag5.lua @@ -10,7 +10,7 @@ function Bag5Randomizer:generatePiece() if next(self.bag) == nil then self.bag = {"I", "J", "L", "O", "T"} end - local x = math.random(table.getn(self.bag)) + local x = love.math.random(table.getn(self.bag)) return table.remove(self.bag, x) end diff --git a/tetris/randomizers/bag5alt.lua b/tetris/randomizers/bag5alt.lua index 90cd16e..62dde76 100644 --- a/tetris/randomizers/bag5alt.lua +++ b/tetris/randomizers/bag5alt.lua @@ -11,10 +11,10 @@ function Bag5AltRandomizer:generatePiece() if next(self.bag) == nil then self.bag = {"I", "J", "L", "O", "T"} end - local x = math.random(table.getn(self.bag)) + local x = love.math.random(table.getn(self.bag)) local temp = table.remove(self.bag, x) if temp == self.prev then - local y = math.random(table.getn(self.bag)) + local y = love.math.random(table.getn(self.bag)) temp = table.remove(self.bag, y) end self.prev = temp diff --git a/tetris/randomizers/bag63.lua b/tetris/randomizers/bag63.lua index c951fe8..15cfb38 100644 --- a/tetris/randomizers/bag63.lua +++ b/tetris/randomizers/bag63.lua @@ -18,7 +18,7 @@ function Bag63Randomiser:generatePiece() "O", "O", "O", "O", "O", "O", "O", "O", "O", } end - return table.remove(self.bag, math.random(#self.bag)) + return table.remove(self.bag, love.math.random(#self.bag)) end return Bag63Randomiser \ No newline at end of file diff --git a/tetris/randomizers/bag8.lua b/tetris/randomizers/bag8.lua index 59c7dc8..90d7f77 100644 --- a/tetris/randomizers/bag8.lua +++ b/tetris/randomizers/bag8.lua @@ -5,7 +5,7 @@ local Bag7Randomizer = Randomizer:extend() function Bag7Randomizer:initialize() self.bag = {"I", "J", "L", "O", "S", "T", "Z"} self.extra = {"I", "J", "L", "O", "S", "T", "Z"} - table.insert(self.bag, table.remove(self.extra, math.random(table.getn(self.extra)))) + table.insert(self.bag, table.remove(self.extra, love.math.random(table.getn(self.extra)))) end function Bag7Randomizer:generatePiece() @@ -14,9 +14,9 @@ function Bag7Randomizer:generatePiece() end if next(self.bag) == nil then self.bag = {"I", "J", "L", "O", "S", "T", "Z"} - table.insert(self.bag, table.remove(self.extra, math.random(table.getn(self.extra)))) + table.insert(self.bag, table.remove(self.extra, love.math.random(table.getn(self.extra)))) end - local x = math.random(table.getn(self.bag)) + local x = love.math.random(table.getn(self.bag)) --print("Bag: "..table.concat(self.bag, ", ").." | Extra: "..table.concat(self.extra, ", ")) return table.remove(self.bag, x) end diff --git a/tetris/randomizers/bag_konoha.lua b/tetris/randomizers/bag_konoha.lua index cb9d78f..ace5834 100644 --- a/tetris/randomizers/bag_konoha.lua +++ b/tetris/randomizers/bag_konoha.lua @@ -14,10 +14,10 @@ function BagKonoha:generatePiece() if #self.bag == 0 then self.bag = {"I", "J", "L", "O", "T"} end - local x = math.random(#self.bag) + local x = love.math.random(#self.bag) local temp = table.remove(self.bag, x) if temp == self.prev and not self.allowrepeat then - local y = math.random(#self.bag) + local y = love.math.random(#self.bag) table.insert(self.bag, temp) -- should insert at the end of the bag, bag[y] doesnt change temp = table.remove(self.bag, y) end diff --git a/tetris/randomizers/dtet.lua b/tetris/randomizers/dtet.lua index ccdcd78..429a4c6 100644 --- a/tetris/randomizers/dtet.lua +++ b/tetris/randomizers/dtet.lua @@ -58,7 +58,7 @@ function DTETRandomizer:generatePiece() end -- pull piece from 21-bag and update drought counters - local generated = bag[math.random(#bag)] + local generated = bag[love.love.math.random(#bag)] self:updateDroughts(generated) return generated end diff --git a/tetris/randomizers/ex.lua b/tetris/randomizers/ex.lua index bd56723..1a1a48b 100644 --- a/tetris/randomizers/ex.lua +++ b/tetris/randomizers/ex.lua @@ -9,7 +9,7 @@ end function EXRandomizer:generatePiece() local shapes = {"I", "J", "L", "O", "S", "T", "Z"} for i = 1, 6 do - local x = math.random(7) + local x = love.math.random(7) if not inHistory(shapes[x], self.history) or i == 6 then return self:updateHistory(shapes[x]) end diff --git a/tetris/randomizers/history.lua b/tetris/randomizers/history.lua index 7052915..99b63ae 100644 --- a/tetris/randomizers/history.lua +++ b/tetris/randomizers/history.lua @@ -14,7 +14,7 @@ end function HistoryRandomizer:generatePiece() for i = 1, self.rolls do - local x = math.random(table.getn(self.allowed_pieces)) + local x = love.math.random(table.getn(self.allowed_pieces)) if not inHistory(self.allowed_pieces[x], self.history) or i == self.rolls then return self:updateHistory(self.allowed_pieces[x]) end diff --git a/tetris/randomizers/masterofbags.lua b/tetris/randomizers/masterofbags.lua index a3ab2d3..078c7d4 100644 --- a/tetris/randomizers/masterofbags.lua +++ b/tetris/randomizers/masterofbags.lua @@ -12,19 +12,19 @@ function MasterOfBags:initialize() end function MasterOfBags:generatePiece() - local piece=math.random(({[true]=#self.bag,[false]=#self.bag+1})[#self.bag>14]) + local piece=love.math.random(({[true]=#self.bag,[false]=#self.bag+1})[#self.bag>14]) if piece>#self.bag then self.bag={} for x=1,28 do self.bag[x]=({"I", "J", "L", "O", "S", "T", "Z"})[(x-1)%7+1] end - piece=math.random(#self.bag) + piece=love.math.random(#self.bag) end for i = 1, 6 do if not inHistory(self.bag[piece], self.history) then break end - piece=math.random(#self.bag) + piece=love.math.random(#self.bag) end self:updateHistory(self.bag[piece]) diff --git a/tetris/randomizers/mirror.lua b/tetris/randomizers/mirror.lua index dfa88da..fed5a12 100644 --- a/tetris/randomizers/mirror.lua +++ b/tetris/randomizers/mirror.lua @@ -35,7 +35,7 @@ function MirrorRandomizer:generatePiece() generated = table.remove(self.piece_stack) else repeat - generated = self.shapes[math.random(7)] + generated = self.shapes[love.math.random(7)] until not inHistory(generated, self.history) table.remove(self.history, 1) table.insert(self.history, generated) diff --git a/tetris/randomizers/nes.lua b/tetris/randomizers/nes.lua index c60c590..f0a7d76 100644 --- a/tetris/randomizers/nes.lua +++ b/tetris/randomizers/nes.lua @@ -8,9 +8,9 @@ function NES:initialize() end function NES:generatePiece() - local x = math.random(8) + local x = love.math.random(8) if x == 8 or x == self.history then - x = math.random(7) + x = love.math.random(7) end self.history = x return self.shapes[x] diff --git a/tetris/randomizers/recursive_bag.lua b/tetris/randomizers/recursive_bag.lua index 4f496f4..63d0210 100644 --- a/tetris/randomizers/recursive_bag.lua +++ b/tetris/randomizers/recursive_bag.lua @@ -10,7 +10,7 @@ function RecursiveRandomizer:generatePiece() --if next(self.bag) == nil then -- self.bag = {"I", "J", "L", "O", "S", "T", "Z"} --end - local x = math.random(table.getn(self.bag) + 1) + local x = love.math.random(table.getn(self.bag) + 1) while x == table.getn(self.bag) + 1 do --print("Refill piece pulled") table.insert(self.bag, "I") @@ -20,7 +20,7 @@ function RecursiveRandomizer:generatePiece() table.insert(self.bag, "S") table.insert(self.bag, "T") table.insert(self.bag, "Z") - x = math.random(table.getn(self.bag) + 1) + x = love.math.random(table.getn(self.bag) + 1) end --print("Number of pieces in bag: "..table.getn(self.bag)) --print("Bag: "..table.concat(self.bag, ", ")) diff --git a/tetris/randomizers/sega.lua b/tetris/randomizers/sega.lua index 48c5e1c..14fa746 100644 --- a/tetris/randomizers/sega.lua +++ b/tetris/randomizers/sega.lua @@ -6,7 +6,7 @@ function SegaRandomizer:initialize() self.bag = {"I", "J", "L", "O", "S", "T", "Z"} self.sequence = {} for i = 1, 1000 do - self.sequence[i] = self.bag[math.random(table.getn(self.bag))] + self.sequence[i] = self.bag[love.math.random(table.getn(self.bag))] end self.counter = 0 end diff --git a/tetris/randomizers/split_history.lua b/tetris/randomizers/split_history.lua index 0de0af5..db81078 100644 --- a/tetris/randomizers/split_history.lua +++ b/tetris/randomizers/split_history.lua @@ -10,11 +10,11 @@ end function SplitHistoryRandomizer:generatePiece() if self.piece_count < 2 then self.piece_count = self.piece_count + 1 - return self:updateHistory(({"L", "J", "I", "T"})[math.random(4)]) + return self:updateHistory(({"L", "J", "I", "T"})[love.math.random(4)]) else local shapes = {"I", "J", "L", "O", "S", "T", "Z"} for i = 1, 4 do - local x = math.random(7) + local x = love.math.random(7) if not inHistory(shapes[x], self.history) or i == 4 then return self:updateHistory(shapes[x]) end diff --git a/tetris/randomizers/tetra.lua b/tetris/randomizers/tetra.lua index 7dcea7e..c81fd02 100644 --- a/tetris/randomizers/tetra.lua +++ b/tetris/randomizers/tetra.lua @@ -28,7 +28,7 @@ end function TetraXRandomizer:generatePiece() local generated = nil while true do - generated = self.pieceselection[math.random(#self.pieceselection)] + generated = self.pieceselection[love.math.random(#self.pieceselection)] if not (self.lastseen[generated] == 0 or self.lastseen[generated] == 1) then break end diff --git a/tetris/rulesets/crap.lua b/tetris/rulesets/crap.lua index 6d3a781..919fd47 100644 --- a/tetris/rulesets/crap.lua +++ b/tetris/rulesets/crap.lua @@ -8,13 +8,13 @@ CRAP.hash = "Completely Random Auto-Positioner" CRAP.world = true CRAP.colors={"C","O","M","R","G","Y","B"} CRAP.colourscheme = { - I = CRAP.colors[math.ceil(math.random(7))], - L = CRAP.colors[math.ceil(math.random(7))], - J = CRAP.colors[math.ceil(math.random(7))], - S = CRAP.colors[math.ceil(math.random(7))], - Z = CRAP.colors[math.ceil(math.random(7))], - O = CRAP.colors[math.ceil(math.random(7))], - T = CRAP.colors[math.ceil(math.random(7))], + I = CRAP.colors[math.ceil(love.math.random(7))], + L = CRAP.colors[math.ceil(love.math.random(7))], + J = CRAP.colors[math.ceil(love.math.random(7))], + S = CRAP.colors[math.ceil(love.math.random(7))], + Z = CRAP.colors[math.ceil(love.math.random(7))], + O = CRAP.colors[math.ceil(love.math.random(7))], + T = CRAP.colors[math.ceil(love.math.random(7))], } CRAP.softdrop_lock = true CRAP.harddrop_lock = false @@ -111,8 +111,8 @@ end function CRAP:attemptWallkicks(piece, new_piece, rot_dir, grid) for i=1,20 do - dx=math.floor(math.random(11))-5 - dy=math.floor(math.random(11))-5 + dx=math.floor(love.math.random(11))-5 + dy=math.floor(love.math.random(11))-5 if grid:canPlacePiece(new_piece:withOffset({x=dx, y=dy})) then self:onPieceRotate(piece, grid) piece:setRelativeRotation(rot_dir):setOffset({x=dx, y=dy}) @@ -147,13 +147,13 @@ function CRAP:get180RotationValue() return 2 end function CRAP:randomizeColours() CRAP.colourscheme = { - I = CRAP.colors[math.ceil(math.random(7))], - L = CRAP.colors[math.ceil(math.random(7))], - J = CRAP.colors[math.ceil(math.random(7))], - S = CRAP.colors[math.ceil(math.random(7))], - Z = CRAP.colors[math.ceil(math.random(7))], - O = CRAP.colors[math.ceil(math.random(7))], - T = CRAP.colors[math.ceil(math.random(7))], + I = CRAP.colors[math.ceil(love.math.random(7))], + L = CRAP.colors[math.ceil(love.math.random(7))], + J = CRAP.colors[math.ceil(love.math.random(7))], + S = CRAP.colors[math.ceil(love.math.random(7))], + Z = CRAP.colors[math.ceil(love.math.random(7))], + O = CRAP.colors[math.ceil(love.math.random(7))], + T = CRAP.colors[math.ceil(love.math.random(7))], } end diff --git a/tetris/rulesets/cultris.lua b/tetris/rulesets/cultris.lua index c7d1670..ca79be4 100644 --- a/tetris/rulesets/cultris.lua +++ b/tetris/rulesets/cultris.lua @@ -1,4 +1,4 @@ -local SRS = require 'tetris.rulesets.arika_srs' +local SRS = require 'tetris.rulesets.standard_ace' local Cultris = SRS:extend() diff --git a/tetris/rulesets/ears.lua b/tetris/rulesets/ears.lua index f0c6d73..87b8330 100644 --- a/tetris/rulesets/ears.lua +++ b/tetris/rulesets/ears.lua @@ -1,4 +1,4 @@ -local SRS = require 'tetris.rulesets.arika_srs' +local SRS = require 'tetris.rulesets.standard_ace' local EARS = SRS:extend() diff --git a/tetris/rulesets/h.lua b/tetris/rulesets/h.lua index aa40473..5ccdbbd 100644 --- a/tetris/rulesets/h.lua +++ b/tetris/rulesets/h.lua @@ -31,7 +31,7 @@ function H:attemptRotate(new_inputs, piece, grid, initial) end function H:getDefaultOrientation() - return math.random(4) + return love.math.random(4) end return H \ No newline at end of file diff --git a/tetris/rulesets/krs.lua b/tetris/rulesets/krs.lua index 12d56d5..ef36340 100644 --- a/tetris/rulesets/krs.lua +++ b/tetris/rulesets/krs.lua @@ -1,4 +1,4 @@ -local SRS = require 'tetris.rulesets.ti_srs' +local SRS = require 'tetris.rulesets.standard_ti' local KRS = SRS:extend() diff --git a/tetris/rulesets/randompieces.lua b/tetris/rulesets/randompieces.lua index 633d500..3f87b7b 100644 --- a/tetris/rulesets/randompieces.lua +++ b/tetris/rulesets/randompieces.lua @@ -23,8 +23,8 @@ function RandomPieces:generateBlockOffsets() local generated_offset = {} repeat generated_offset = { - x = math.random(-1, 1), - y = math.random(-2, 0) + x = love.math.random(-1, 1), + y = love.math.random(-2, 0) } until not containsPoint(offsets, generated_offset) offsets[i] = generated_offset diff --git a/tetris/rulesets/shirase.lua b/tetris/rulesets/shirase.lua index a95e7c9..4c5ba39 100644 --- a/tetris/rulesets/shirase.lua +++ b/tetris/rulesets/shirase.lua @@ -89,7 +89,7 @@ function Shirase:onPieceMove(piece) piece.lock_delay = 0 end function Shirase:onPieceRotate(piece) piece.lock_delay = 0 end function Shirase:getDefaultOrientation() - return math.random(4) + return love.math.random(4) end return Shirase \ No newline at end of file diff --git a/tetris/rulesets/tetra.lua b/tetris/rulesets/tetra.lua index 0f7e616..6563d3a 100644 --- a/tetris/rulesets/tetra.lua +++ b/tetris/rulesets/tetra.lua @@ -1,4 +1,4 @@ -local SRS = require 'tetris.rulesets.arika_srs' +local SRS = require 'tetris.rulesets.standard_ace' local Tetra = SRS:extend() diff --git a/tetris/rulesets/texy_world.lua b/tetris/rulesets/texy_world.lua index 21418d6..357bad4 100644 --- a/tetris/rulesets/texy_world.lua +++ b/tetris/rulesets/texy_world.lua @@ -1,4 +1,4 @@ -local SRS = require 'tetris.rulesets.ti_srs' +local SRS = require 'tetris.rulesets.standard_ti' local TexyWorld = SRS:extend() diff --git a/tetris/rulesets/tod.lua b/tetris/rulesets/tod.lua index 54ad68a..acda791 100644 --- a/tetris/rulesets/tod.lua +++ b/tetris/rulesets/tod.lua @@ -1,4 +1,4 @@ -local SRS = require 'tetris.rulesets.arika_srs' +local SRS = require 'tetris.rulesets.standard_ace' local TOD = SRS:extend() diff --git a/tetris/rulesets/trans.lua b/tetris/rulesets/trans.lua index fe45433..32774ed 100644 --- a/tetris/rulesets/trans.lua +++ b/tetris/rulesets/trans.lua @@ -35,7 +35,7 @@ end function Trans:attemptWallkicks(piece, new_piece, rot_dir, grid) local pieces = {"I", "J", "L", "O", "S", "T", "Z"} repeat - new_piece.shape = pieces[math.random(7)] + new_piece.shape = pieces[love.math.random(7)] until piece.shape ~= new_piece.shape local offsets = {{x=0, y=0}, {x=1, y=0}, {x=-1, y=0}}