Skip to content

Instantly share code, notes, and snippets.

@sofar
Created March 13, 2016 06:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sofar/f82b93d2efc0c04f518f to your computer and use it in GitHub Desktop.
Save sofar/f82b93d2efc0c04f518f to your computer and use it in GitHub Desktop.
The ABM effect, visualized.
5% after 2 abm cycles with 197 dice rolls
25% after 7 abm cycles with 626 dice rolls
50% after 14 abm cycles with 1048 dice rolls
75% after 23 abm cycles with 1381 dice rolls
95% after 39 abm cycles with 1573 dice rolls
100% after 71 abm cycles with 1622 dice rolls
8 12 5 8 15 10 7 10 10 15 22 9 6 29 15 23 5 5 7 11 1 21 6 6 9 44 14 9 16 7 10 45 28 23 11 29 17 19 28 3 28 24 27 2 10 14 16 9 20 8 11 27 3 16 42 5 20 1 24 13 20 38 23 19 2 21 33 12 13 9 8 1 2 17 71 2 24 24 39 8 15 35 5 24 17 42 29 15 35 8 24 3 7 22 4 6 22 2 18 5
--[[
ABM calculation helper -- by sofar. WTFPL or MIT
--]]
local nodes = {}
local nodecount = 100
local count = 0
local abms = 0
local rolls = 0
local chance = 16
local lim = 0
for n = 1, nodecount do
nodes[n] = 0
end
local function roll()
while true do
abms = abms + 1
for n = 1, nodecount do
if nodes[n] == 0 then
rolls = rolls + 1
if math.random(1, chance) == 1 then
nodes[n] = abms
count = count + 1
end
end
end
if count >= 5 and lim == 0 then
print(" 5% after " .. abms .. " abm cycles with " .. rolls .. " dice rolls")
lim = 5
end
if count >= 25 and lim == 5 then
print(" 25% after " .. abms .. " abm cycles with " .. rolls .. " dice rolls")
lim = 25
end
if count >= 50 and lim == 25 then
print(" 50% after " .. abms .. " abm cycles with " .. rolls .. " dice rolls")
lim = 50
end
if count >= 75 and lim == 50 then
print(" 75% after " .. abms .. " abm cycles with " .. rolls .. " dice rolls")
lim = 75
end
if count >= 95 and lim == 75 then
print(" 95% after " .. abms .. " abm cycles with " .. rolls .. " dice rolls")
lim = 95
end
if count >= 100 then
print("100% after " .. abms .. " abm cycles with " .. rolls .. " dice rolls")
local s = ""
for n = 1, nodecount do
s = s .. nodes[n] .. " "
end
print(s)
return
end
end
end
roll()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment