]> granicus.if.org Git - nethack/commitdiff
Convert math.random percentage computations into percent()
authorcopperwater <aosdict@gmail.com>
Sat, 29 Feb 2020 22:04:26 +0000 (17:04 -0500)
committerPasi Kallinen <paxed@alt.org>
Mon, 6 Apr 2020 16:48:28 +0000 (19:48 +0300)
21 files changed:
dat/Val-goal.lua
dat/astral.lua
dat/baalz.lua
dat/bigrm-1.lua
dat/bigrm-10.lua
dat/bigrm-8.lua
dat/knox.lua
dat/medusa-1.lua
dat/medusa-2.lua
dat/medusa-3.lua
dat/medusa-4.lua
dat/minend-2.lua
dat/minetn-1.lua
dat/minetn-2.lua
dat/minetn-5.lua
dat/minetn-7.lua
dat/nhlib.lua
dat/soko1-1.lua
dat/soko1-2.lua
dat/valley.lua
dat/wizard3.lua

index f9237e5e4a6f2c14d7633ea8d20561fc3b185b46..d929170399d85329a5dc05d7239f615f64d64eb2 100644 (file)
@@ -38,7 +38,7 @@ des.non_diggable(selection.area(00,00,34,16))
 -- Drawbridges; northern one opens from the south (portcullis) to further
 -- north (lowered span), southern one from the north to further south
 des.drawbridge({ x=17, y=02, dir="south", state="random" })
-if math.random(0, 99) < 75 then
+if percent(75) then
    des.drawbridge({ x=17, y=14, dir="north", state="open" })
 else
    des.drawbridge({ x=17, y=14, dir="north", state="random" })
index 62ea0ec160e8c8eaba9a46b24f2334c894c64500..5a3a702861dd62c74ef4a23e7eaf156c1525b459 100644 (file)
@@ -40,7 +40,7 @@ for i=1,2 do
    -- 3.6.2: 60% twice == 36% chance that both sides open up, 24% left side
    -- only, 24% right side only, 16% that neither side opens up
    local hall;
-   if math.random(0, 99) < 60 then
+   if percent(60) then
      if i == 1 then
         des.terrain(selection.area(17,14, 30,18),".")
         des.wallify()
@@ -60,7 +60,7 @@ for i=1,2 do
      -- extra monsters; was [6 + 3d4] when both wings were opened up at once
      for i=1,3 + math.random(2 - 1,2*3) do
         des.monster({ id="Angel", coord = { hall:rndcoord(1) }, align="noalign", peaceful=0 })
-        if math.random(0,99) < 50 then
+        if percent(50) then
            des.monster({ coord = { hall:rndcoord(1) }, peaceful=0 })
         end
      end
index 33eb215ee5d3655cd95822c35a47b87130eb1c69..107c987198f27c97c8511e6add51e1b0b2f9ed53 100644 (file)
@@ -33,7 +33,7 @@ des.non_diggable(selection.area(00,00,47,12))
 des.mazewalk(00,06,"west")
 des.stair("down", 44,06)
 des.door("locked",00,06)
-if math.random(0, 99) < 50 then
+if percent(50) then
    des.terrain(34,08,'-')
    des.terrain(34,04,'S')
    des.terrain(29,05,'|')
index f449e6210846d0750f59afd191e64f7692269b45..b86ca8cfeca9c1b0892664acac820c8a993af041 100644 (file)
@@ -24,7 +24,7 @@ des.map([[
 ]]);
 
 
-if math.random(0,99) < 75 then
+if percent(75) then
    local terrains = { "-", "F", "L", "T", "C" };
    local tidx = math.random(1, #terrains);
    local choice = math.random(0, 4);
index 69403d8f91e659eb102c571e74f0ec2b901de85d..e4eaf90f81a335d2af8ae007447c73f4497e1199 100644 (file)
@@ -25,7 +25,7 @@ des.map([[
 .......................................................................
 ]]);
 
-if math.random(0,99) < 40 then
+if percent(40) then
    -- occasionally it's not a fog maze
    local terrain = { "L", "}", "T", "-", "F" };
    local tidx = math.random(1, #terrain);
index 2851b780df4a85737f88e344f22797b5176124e5..500a970e75086fd5d5966cf08067b579fc047145 100644 (file)
@@ -24,7 +24,7 @@ des.map([[
                              ----------------------------------------------
 ]]);
 
-if math.random(0,99) < 40 then
+if percent(40) then
    local terrain = { "L", "}", "T", ".", "-", "C" };
    local tidx = math.random(1, #terrain);
    des.replace_terrain({ region={00,00, 74,17}, fromterrain="F", toterrain=terrain[tidx] });
index 87832a3a2c66870823a30b653373125e89759134..aa5ca4888a615ab2eea21f7cd16e70fb057d75de 100644 (file)
@@ -41,14 +41,14 @@ des.teleport_region({ region = {06,15,09,16}, dir="down" })
 --   Throne room, with Croesus on the throne
 des.region({ x1=37,y1=08,x2=46,y2=11, lit=1, type="throne", prefilled=0 })
 --   50% chance each to move throne and/or fort's entry secret door up one row
-if math.random(0, 99) < 50 then
+if percent(50) then
    des.monster({ id = "Croesus", x=43, y=10, peaceful = 0 })
 else
    des.monster({ id = "Croesus", x=43, y=09, peaceful = 0 })
    des.terrain(43,09, "\\")
    des.terrain(43,10, ".")
 end
-if math.random(0, 99) < 50 then
+if percent(50) then
    des.terrain(47,09, "S")
    des.terrain(47,10, "|")
 end
@@ -70,7 +70,7 @@ local treasury = selection.area(21,08,35,11);
 treasury:iterate(treasure_spot);
 
 --   Vault entrance also varies
-if math.random(0, 99) < 50 then
+if percent(50) then
    des.terrain(36,09, "|")
    des.terrain(36,10, "S")
 end
index 635763a5b8926ee4b00b973aa6af0ab622360773..591e404d2b5ef982a24834eb3b6b5a39a174564f 100644 (file)
@@ -58,16 +58,16 @@ des.non_diggable(selection.area(30,06,46,13))
 des.object({ id = "statue", x=36,y=10, buc="uncursed",
              montype="knight", historic=1, male = 1, name="Perseus",
              contents = function()
-                if math.random(0,99) < 75 then
+                if percent(75) then
                    des.object({ id = "shield of reflection", buc="cursed", spe=0 })
                 end
-                if math.random(0,99) < 25 then
+                if percent(25) then
                    des.object({ id = "levitation boots", spe=0 })
                 end
-                if math.random(0,99) < 50 then
+                if percent(50) then
                    des.object({ id = "scimitar", buc="blessed", spe=2 })
                 end
-                if math.random(0,99) < 50 then
+                if percent(50) then
                    des.object("sack")
                 end
              end
index 405627f63b688487523063c77ba8b0831f902474..17c2893ff145896fc746a767abf9f563305aaf31 100644 (file)
@@ -52,16 +52,16 @@ des.non_diggable(selection.area(60,02,73,17))
 des.object({ id = "statue", x=68,y=10,buc="uncursed",
                       montype="knight", historic=1, male=1,name="Perseus",
                       contents = function()
-                         if math.random(0,99) < 25 then
+                         if percent(25) then
                             des.object({ id = "shield of reflection", buc="cursed", spe=0 })
                          end
-                         if math.random(0,99) < 75 then
+                         if percent(75) then
                             des.object({ id = "levitation boots", spe=0 })
                          end
-                         if math.random(0,99) < 50 then
+                         if percent(50) then
                             des.object({ id = "scimitar", buc="blessed", spe=2 })
                          end
-                         if math.random(0,99) < 50 then
+                         if percent(50) then
                             des.object("sack")
                          end
                       end
index 65961b5e581952f032c718da62798ab0f9e5b22e..efc860ae5829de0e3daf187697eb6ac9d3466419 100644 (file)
@@ -64,16 +64,16 @@ local px, py = place:rndcoord(1);
 des.object({ id="statue",x=px, y=py, buc="uncursed",
                       montype="knight", historic=1, male=1,name="Perseus",
                       contents = function()
-                         if math.random(0,99) < 75 then
+                         if percent(75) then
                             des.object({ id = "shield of reflection", buc="cursed", spe=0 })
                          end
-                         if math.random(0,99) < 25 then
+                         if percent(25) then
                             des.object({ id = "levitation boots", spe=0 })
                          end
-                         if math.random(0,99) < 50 then
+                         if percent(50) then
                             des.object({ id = "scimitar", buc="blessed", spe=2 })
                          end
-                         if math.random(0,99) < 50 then
+                         if percent(50) then
                             des.object("sack")
                          end
                       end
index b30540c51ffb3ee1515d6f0002208e589cc03ec1..73f6df2862a3fd235d614aced338383d635a8cf8 100644 (file)
@@ -67,16 +67,16 @@ local px, py = place:rndcoord(1);
 des.object({ id="statue",x=px, y=py, buc="uncursed",
                       montype="knight", historic=1, male=1,name="Perseus",
                       contents = function()
-                         if math.random(0,99) < 75 then
+                         if percent(75) then
                             des.object({ id = "shield of reflection", buc="cursed", spe=0 })
                          end
-                         if math.random(0,99) < 25 then
+                         if percent(25) then
                             des.object({ id = "levitation boots", spe=0 })
                          end
-                         if math.random(0,99) < 50 then
+                         if percent(50) then
                             des.object({ id = "scimitar", buc="blessed", spe=2 })
                          end
-                         if math.random(0,99) < 50 then
+                         if percent(50) then
                             des.object("sack")
                          end
                       end
@@ -102,17 +102,17 @@ des.monster("kraken", 07,07)
 --
 -- the nesting dragon
 des.monster({ id = "yellow dragon", x=05, y=04, asleep=1 })
-if math.random(0,99) < 50 then
+if percent(50) then
    des.monster({ id = "baby yellow dragon", x=04,y=04, asleep=1 })
 end
-if math.random(0,99) < 25 then
+if percent(25) then
    des.monster({ id = "baby yellow dragon", x=04, y=05, asleep=1 })
 end
 des.object({ id = "egg", x=05, y=04, montype="yellow dragon" });
-if math.random(0,99) < 50 then
+if percent(50) then
    des.object({ id = "egg", x=05, y=04, montype="yellow dragon" });
 end
-if math.random(0,99) < 25 then
+if percent(25) then
    des.object({ id = "egg", x=05, y=04, montype="yellow dragon" });
 end
 --
index 39a7750eb43115f61e69d9b936cefec080f85ea9..ced2b11f6ca633a84a5641b123cd6a7622929d67 100644 (file)
@@ -31,23 +31,23 @@ des.map([[
 ---------------------------------------------------------------------------
 ]]);
 
-if math.random(0, 99) < 50 then
+if percent(50) then
    des.terrain({55,14},"-")
    des.terrain({56,14},"-")
    des.terrain({61,15},"|")
    des.terrain({52,5}, "S")
    des.door("locked", 52,5)
 end
-if math.random(0, 99) < 50 then
+if percent(50) then
    des.terrain({18,1}, "|")
    des.terrain(selection.area(7,12, 8,13), ".")
 end
-if math.random(0, 99) < 50 then
+if percent(50) then
    des.terrain({49,4}, "|")
    des.terrain({21,5}, ".")
 end
-if math.random(0, 99) < 50 then
-   if math.random(0, 99) < 50 then
+if percent(50) then
+   if percent(50) then
       des.terrain({22,1}, "|")
    else
       des.terrain({50,7}, "-")
index fd1257c0e4e79a12ed4bcebeacd78a75ab9f2c7c..39460ead31d5080549bd406b1906c190cbb68fbc 100644 (file)
@@ -89,7 +89,7 @@ des.object({ id = "corpse", montype="watch captain" })
 
 -- Rubble!
 for i=1,9 + math.random(2 - 1,2*5) do
-  if math.random(0,99) < 90 then
+  if percent(90) then
     des.object("boulder")
   end
   des.object("rock")
@@ -119,10 +119,10 @@ local inside = selection.floodfill(18,8)
 local near_temple = selection.area(17,8, 23,14) & inside
 
 for i=1,5 + math.random(1 - 1,1*10) do
-   if math.random(0, 99) < 50 then
+   if percent(50) then
       des.monster({ id = "orc-captain", coord = { inside:rndcoord(1) }, peaceful=0 });
    else
-      if math.random(0, 99) < 80 then
+      if percent(80) then
          des.monster({ id = "Uruk-hai", coord = { inside:rndcoord(1) }, peaceful=0 })
       else
          des.monster({ id = "Mordor orc", coord = { inside:rndcoord(1) }, peaceful=0 })
@@ -136,7 +136,7 @@ end
 -- these are not such a big deal
 -- to run into outside the bars
 for i=1,9 + math.random(2 - 1,2*5) do
-   if math.random(0, 99) < 90 then
+   if percent(90) then
       des.monster({ id = "hill orc", peaceful = 0 })
    else
       des.monster({ id = "goblin", peaceful = 0 })
index 7031c280f876150da74679712874b90c1f26c140..87e58a34845e12cb32c7382cb659e8351ce240b4 100644 (file)
@@ -12,7 +12,7 @@ des.room({ type = "ordinary", lit=1, x=3, y=3,
               des.feature("fountain", 17, 5)
               des.feature("fountain", 13, 8)
 
-              if math.random(0,99) < 75 then
+              if percent(75) then
                  des.room({ type = "ordinary", x=2,y=0, w=2,h=2,
                             contents = function()
                                des.door({ state="closed", wall="west" })
@@ -20,7 +20,7 @@ des.room({ type = "ordinary", lit=1, x=3, y=3,
                  })
               end
 
-              if math.random(0,99) < 75 then
+              if percent(75) then
                  des.room({ type = "ordinary", lit=0, x=5,y=0, w=2,h=2,
                             contents = function()
                                des.door({ state="closed", wall="south" })
@@ -28,7 +28,7 @@ des.room({ type = "ordinary", lit=1, x=3, y=3,
                  })
               end
 
-              if math.random(0,99) < 75 then
+              if percent(75) then
                  des.room({ type = "ordinary", x=8,y=0, w=2,h=2,
                             contents = function()
                                des.door({ state="closed", wall="east" })
@@ -36,7 +36,7 @@ des.room({ type = "ordinary", lit=1, x=3, y=3,
                  })
               end
 
-              if math.random(0,99) < 75 then
+              if percent(75) then
                  des.room({ type = "ordinary", lit=1, x=16,y=0, w=2,h=2,
                             contents = function()
                                des.door({ state="closed", wall="west" })
@@ -44,7 +44,7 @@ des.room({ type = "ordinary", lit=1, x=3, y=3,
                  })
               end
 
-              if math.random(0,99) < 75 then
+              if percent(75) then
                  des.room({ type = "ordinary", lit=0, x=19,y=0, w=2,h=2,
                             contents = function()
                                des.door({ state="closed", wall="south" })
@@ -52,7 +52,7 @@ des.room({ type = "ordinary", lit=1, x=3, y=3,
                  })
               end
 
-              if math.random(0,99) < 75 then
+              if percent(75) then
                  des.room({ type = "ordinary", x=22,y=0, w=2,h=2,
                             contents = function()
                                des.door({ state="closed", wall="south" })
@@ -61,7 +61,7 @@ des.room({ type = "ordinary", lit=1, x=3, y=3,
                  })
               end
 
-              if math.random(0,99) < 75 then
+              if percent(75) then
                  des.room({ type = "ordinary", lit=0, x=25,y=0, w=2,h=2,
                             contents = function()
                                des.door({ state="closed", wall="east" })
@@ -69,7 +69,7 @@ des.room({ type = "ordinary", lit=1, x=3, y=3,
                  })
               end
 
-              if math.random(0,99) < 75 then
+              if percent(75) then
                  des.room({ type = "ordinary", lit=1, x=2,y=5, w=2,h=2,
                             contents = function()
                                des.door({ state="closed", wall="north" })
@@ -77,7 +77,7 @@ des.room({ type = "ordinary", lit=1, x=3, y=3,
                  })
               end
 
-              if math.random(0,99) < 75 then
+              if percent(75) then
                  des.room({ type = "ordinary", lit=1, x=5,y=5, w=2,h=2,
                             contents = function()
                                des.door({ state="closed", wall="south" })
@@ -85,7 +85,7 @@ des.room({ type = "ordinary", lit=1, x=3, y=3,
                  })
               end
 
-              if math.random(0,99) < 75 then
+              if percent(75) then
                  des.room({ type = "ordinary", x=8,y=5, w=2,h=2,
                             contents = function()
                                des.door({ state="locked", wall="north" })
@@ -118,7 +118,7 @@ des.room({ type = "ordinary", lit=1, x=3, y=3,
                          end
               });
 
-              if math.random(0,99) < 75 then
+              if percent(75) then
                  des.room({ type = "ordinary", lit=0, x=7,y=10, w=3,h=3,
                             contents = function()
                                des.door({ state="locked", wall="north" })
@@ -136,7 +136,7 @@ des.room({ type = "ordinary", lit=1, x=3, y=3,
                          end
               });
 
-              if math.random(0,99) < 75 then
+              if percent(75) then
                  des.room({ type = "ordinary", lit=1, x=18,y=10, w=4,h=3,
                             contents = function()
                                des.door({ state="locked", wall="west" })
index 1f59748644de1289d751aff71f8a357e78956462..241c5b70dc93d48d345b765d1091d2e74119a362 100644 (file)
@@ -33,31 +33,31 @@ des.map([[
 -----                   ------                     -------  ---------------
 ]]);
 
-if math.random(0, 99) < 75 then
-  if math.random(0, 99) < 50 then
+if percent(75) then
+  if percent(50) then
     des.terrain(selection.line(25,8, 25,9), "|")
   else
     des.terrain(selection.line(16,13, 17,13), "-")
   end
 end
-if math.random(0, 99) < 75 then
-  if math.random(0, 99) < 50 then
+if percent(75) then
+  if percent(50) then
     des.terrain(selection.line(36,10, 36,11), "|")
   else
     des.terrain(selection.line(32,15, 33,15), "-")
   end
 end
-if math.random(0, 99) < 50 then
+if percent(50) then
   des.terrain(selection.area(21,4, 22,5), ".")
   des.terrain(selection.line(14,9, 14,10), "|")
 end
-if math.random(0, 99) < 50 then
+if percent(50) then
   des.terrain({46,13}, "|")
   des.terrain(selection.line(43,5, 47,5), "-")
   des.terrain(selection.line(42,6, 46,6), ".")
   des.terrain(selection.line(46,7, 47,7), ".")
 end
-if math.random(0,99) < 50 then
+if percent(50) then
   des.terrain(selection.area(69,11, 71,11), "-")
 end
 
index dae4a9148c1f1e6559ac0e19b84268d86f480cc0..eb4a7f56d3f515aeb6ac54b75316b492ca1fcaa0 100644 (file)
@@ -11,7 +11,7 @@ des.room({ type="ordinary", lit=1, x=3,y=3,
               des.feature("fountain", 12, 07)
               des.feature("fountain", 11, 13)
 
-              if math.random(0,99) < 75 then
+              if percent(75) then
                  des.room({ type="ordinary", x=2,y=2, w=4,h=2,
                             contents = function()
                                des.door({ state = "closed", wall="south" })
@@ -19,7 +19,7 @@ des.room({ type="ordinary", lit=1, x=3,y=3,
                  })
               end
 
-              if math.random(0,99) < 75 then
+              if percent(75) then
                  des.room({ type="ordinary", x=7,y=2, w=2,h=2,
                             contents = function()
                                des.door({ state = "closed", wall="north" })
@@ -27,7 +27,7 @@ des.room({ type="ordinary", lit=1, x=3,y=3,
                  })
               end
 
-              if math.random(0,99) < 75 then
+              if percent(75) then
                  des.room({ type="ordinary", x=7,y=5, w=2,h=2,
                             contents = function()
                                des.door({ state = "closed", wall="south" })
@@ -35,7 +35,7 @@ des.room({ type="ordinary", lit=1, x=3,y=3,
                  })
               end
 
-              if math.random(0,99) < 75 then
+              if percent(75) then
                  des.room({ type="ordinary", lit=1, x=10,y=2, w=3,h=4,
                             contents = function()
                                des.monster("gnome")
@@ -47,7 +47,7 @@ des.room({ type="ordinary", lit=1, x=3,y=3,
                  })
               end
 
-              if math.random(0,99) < 75 then
+              if percent(75) then
                  des.room({ type="ordinary", x=14,y=2, w=4,h=2,
                             contents = function()
                                des.door({ state = "closed", wall="south", pos=0 })
@@ -56,7 +56,7 @@ des.room({ type="ordinary", lit=1, x=3,y=3,
                  })
               end
 
-              if math.random(0,99) < 75 then
+              if percent(75) then
                  des.room({ type="ordinary", x=16,y=5, w=2,h=2,
                             contents = function()
                                des.door({ state = "closed", wall="south" })
@@ -64,7 +64,7 @@ des.room({ type="ordinary", lit=1, x=3,y=3,
                  })
               end
 
-              if math.random(0,99) < 75 then
+              if percent(75) then
                  des.room({ type="ordinary", lit=0, x=19,y=2, w=2,h=2,
                             contents = function()
                                des.door({ state = "locked", wall="east" })
@@ -79,7 +79,7 @@ des.room({ type="ordinary", lit=1, x=3,y=3,
                          end
               })
 
-              if math.random(0,99) < 75 then
+              if percent(75) then
                  des.room({ type="ordinary", x=2,y=7, w=2,h=2,
                             contents = function()
                                des.door({ state = "closed", wall="east" })
@@ -99,7 +99,7 @@ des.room({ type="ordinary", lit=1, x=3,y=3,
                          end
               })
 
-              if math.random(0,99) < 75 then
+              if percent(75) then
                  des.room({ type="ordinary", x=11,y=10, w=2,h=2,
                             contents = function()
                                des.door({ state = "locked", wall="west" })
@@ -114,7 +114,7 @@ des.room({ type="ordinary", lit=1, x=3,y=3,
                          end
               })
 
-              if math.random(0,99) < 75 then
+              if percent(75) then
                  des.room({ type="ordinary", x=17,y=11, w=4,h=2,
                             contents = function()
                                des.door({ state = "closed", wall="north" })
@@ -122,7 +122,7 @@ des.room({ type="ordinary", lit=1, x=3,y=3,
                  })
               end
 
-              if math.random(0,99) < 75 then
+              if percent(75) then
                  des.room({ type="ordinary", x=22,y=11, w=2,h=2,
                             contents = function()
                                des.door({ state = "closed", wall="south" })
index 983542b5b388ff0833b4bdcda27133bcde1a0c4b..a07ff4a41077b8fcadce7fc8d0519d31c74a1606 100644 (file)
@@ -39,5 +39,5 @@ end
 
 -- percent(20) returns true 20% of the time
 function percent(threshold)
-   return math.random(0,99) < threshold
+   return math.random(0, 99) < threshold
 end
index d05d5ee27e3282d3f3a5c89cfeb2ec41b78b9c09..b281975b5142d21bce5f0c04dd2f426f55c0cca9 100644 (file)
@@ -98,7 +98,7 @@ des.region({ region={18,10, 22,16}, lit = 1, type = "zoo",
             prefilled = 0, irregular = 1 });
 
 px, py = selection.rndcoord(place);
-if math.random(0, 99) < 75 then
+if percent(75) then
    des.object({ id="bag of holding", x=px, y=py,
                buc="not-cursed", achievement=1 });
 else
index 7ad218b395f3f158a2bda8c87be83b1b804c11ae..9a8002852cc8fa4a21d2bd8d380516a003a5af76 100644 (file)
@@ -100,7 +100,7 @@ des.region({ region={18,09, 22,15}, lit = 1, type = "zoo",
             prefilled = 0, irregular = 1 });
 
 px, py = selection.rndcoord(place);
-if math.random(0, 99) < 25 then
+if percent(25) then
    des.object({ id="bag of holding", x=px, y=py,
                buc="not-cursed", achievement=1 });
 else
index 5e78e71be9ef2bb77540b5b4d7eb7df31854dc66..adcd4e80f902e0418b9b3636956f03af90930528 100644 (file)
@@ -34,16 +34,16 @@ des.map([[
 
 -- Make the path somewhat unpredictable
 -- If you get "lucky", you may have to go through all three graveyards.
-if math.random(0, 99) < 50 then
+if percent(50) then
    des.terrain(selection.line(50,8, 53,8), '-')
    des.terrain(selection.line(40,8, 43,8), 'B')
 end
-if math.random(0, 99) < 50 then
+if percent(50) then
    des.terrain({ x=27, y=12, typ='|' })
    des.terrain(selection.line(27,3, 29,3), 'B')
    des.terrain({ x=28, y=2, typ='-' })
 end
-if math.random(0, 99) < 50 then
+if percent(50) then
    des.terrain(selection.line(16,10, 16,11), '|')
    des.terrain(selection.line(9,13, 14,13), 'B')
 end
index f5da689444279a8c7a7c6734cb3c146f8a81101f..a7b53a3403ce7d6518d2bf85359bca589fc985ac 100644 (file)
@@ -34,7 +34,7 @@ des.region({ region={17,06, 18,11}, lit=0, type="beehive" })
 des.region({ region={20,06,26,11},lit=0,type="ordinary",prefilled=1,
              contents = function()
                 local w = "north";
-                if math.random(0,99) < 50 then w = "west" end
+                if percent(50) then w = "west" end
                 des.door({ state="secret", wall=w })
              end
 });