老虎机赢的机会太高了
Slot Machine win chance way too high
我正在创建一个 return 比率约为 95% 的老虎机。但我觉得我赢的次数太多了。谁能证实这一点?老虎机有 3 个转盘(卷轴),每个转盘有 4 个不同的符号。获胜的机会应该是:
3x Symbol[1] : 23.6% chance (50% at first spinner, 80% second, 59% third)
3x Symbol[2] : 9.45% chance (25% at first spinner, 70% second, 54% third)
3x Symbol[3] : 1.89% chance (15% at first spinner, 60% second, 21% third)
3x Symbol[4] : 0.19% chance (10% at first spinner, 50% second, 3.8% third)
local symbol = {}
symbol[1] = {0.5, 0.8, 0.59}
symbol[2] = {0.5, 0.7, 0.54}
symbol[3] = {0.6, 0.6, 0.21}
symbol[4] = {1, 0.5, 0.038}
function chance(x)
if math.random() <= x then
return true
end
end
-- FIRST SPINNER
for i = 1, 4 do
if chance(symbol[i][1]) then
stop[1] = symbol[i]
break
end
end
-- SECOND SPINNER
for i = 1, 4 do
if stop[1] == symbol[i] then
if chance(symbol[i][2]) then
stop[2] = symbol[i]
else
-- stop[3] = some random symbol that is not equal to stop[1]
end
break
end
end
-- THIRD SPINNER
for i = 1, 4 do
if stop[1] == symbol[i] and stop[2] == symbol[i] then
if chance(symbol[i][3]) then
stop[3] = symbol[i]
else
-- stop[3] = some random symbol that is not equal to stop[2]
end
end
end
if stop[3] == nil then
-- stop[3] = some random symbol that is not equal to stop[2]
end
-- WIN SCRIPT
if stop[1] == stop[2] and stop[2] == stop[3] then
-- reward player
end
local symbol = {}
symbol[1] = {0.5, 0.8, 0.59}
symbol[2] = {0.5, 0.7, 0.54}
symbol[3] = {0.6, 0.6, 0.21}
symbol[4] = {1, 0.5, 0.038}
function chance(x)
return math.random() <= x
end
-- FIRST SPINNER
for _, sym in ipairs(symbol) do
stop[1] = sym
if chance(sym[1]) then break end
end
-- SECOND SPINNER
if chance(stop[1][2]) then
stop[2] = stop[1]
-- THIRD SPINNER
if chance(stop[1][3]) then
stop[3] = stop[1]
else
-- stop[3] = some random symbol that is not equal to stop[1]
repeat
stop[3] = symbol[math.random(4)]
until stop[3] ~= stop[1]
end
else
-- stop[2], stop[3] = some random symbols, not both equal to stop[1]
repeat
stop[2] = symbol[math.random(4)]
stop[3] = symbol[math.random(4)]
until stop[2] ~= stop[1] or stop[3] ~= stop[1]
end
-- WIN SCRIPT
if stop[1] == stop[2] and stop[2] == stop[3] then
-- reward player
end
我正在创建一个 return 比率约为 95% 的老虎机。但我觉得我赢的次数太多了。谁能证实这一点?老虎机有 3 个转盘(卷轴),每个转盘有 4 个不同的符号。获胜的机会应该是:
3x Symbol[1] : 23.6% chance (50% at first spinner, 80% second, 59% third)
3x Symbol[2] : 9.45% chance (25% at first spinner, 70% second, 54% third)
3x Symbol[3] : 1.89% chance (15% at first spinner, 60% second, 21% third)
3x Symbol[4] : 0.19% chance (10% at first spinner, 50% second, 3.8% third)
local symbol = {}
symbol[1] = {0.5, 0.8, 0.59}
symbol[2] = {0.5, 0.7, 0.54}
symbol[3] = {0.6, 0.6, 0.21}
symbol[4] = {1, 0.5, 0.038}
function chance(x)
if math.random() <= x then
return true
end
end
-- FIRST SPINNER
for i = 1, 4 do
if chance(symbol[i][1]) then
stop[1] = symbol[i]
break
end
end
-- SECOND SPINNER
for i = 1, 4 do
if stop[1] == symbol[i] then
if chance(symbol[i][2]) then
stop[2] = symbol[i]
else
-- stop[3] = some random symbol that is not equal to stop[1]
end
break
end
end
-- THIRD SPINNER
for i = 1, 4 do
if stop[1] == symbol[i] and stop[2] == symbol[i] then
if chance(symbol[i][3]) then
stop[3] = symbol[i]
else
-- stop[3] = some random symbol that is not equal to stop[2]
end
end
end
if stop[3] == nil then
-- stop[3] = some random symbol that is not equal to stop[2]
end
-- WIN SCRIPT
if stop[1] == stop[2] and stop[2] == stop[3] then
-- reward player
end
local symbol = {}
symbol[1] = {0.5, 0.8, 0.59}
symbol[2] = {0.5, 0.7, 0.54}
symbol[3] = {0.6, 0.6, 0.21}
symbol[4] = {1, 0.5, 0.038}
function chance(x)
return math.random() <= x
end
-- FIRST SPINNER
for _, sym in ipairs(symbol) do
stop[1] = sym
if chance(sym[1]) then break end
end
-- SECOND SPINNER
if chance(stop[1][2]) then
stop[2] = stop[1]
-- THIRD SPINNER
if chance(stop[1][3]) then
stop[3] = stop[1]
else
-- stop[3] = some random symbol that is not equal to stop[1]
repeat
stop[3] = symbol[math.random(4)]
until stop[3] ~= stop[1]
end
else
-- stop[2], stop[3] = some random symbols, not both equal to stop[1]
repeat
stop[2] = symbol[math.random(4)]
stop[3] = symbol[math.random(4)]
until stop[2] ~= stop[1] or stop[3] ~= stop[1]
end
-- WIN SCRIPT
if stop[1] == stop[2] and stop[2] == stop[3] then
-- reward player
end