破解 Balatro 的数值增长:不可能达成的盲注背后的代码

这款游戏

Balatro
扑克类 Roguelike 游戏。
https://store.steampowered.com/app/2379780/Balatro/

我的 Reddit 帖子

深究 Balatro 无法通关的底注
86 个赞,18 条评论。
https://www.reddit.com/r/balatro/comments/1ay74s2/balatros_unbeatable_ante_a_closer_look/

总结

  1. Balatro 从底注 11 开始难度会大幅飙升。
  2. 无尽模式真的是无限的,你其实无法真正“通关这款游戏”。

动机

游戏达到一定底注等级后会变得极其困难。我常常组好了一套配合默契的牌组,结果一进入下一关,盲注就突然暴涨到让人觉得根本不可能过关的地步。我很好奇这款游戏是怎么计算盲注数值的。

我从 Balatro 的游戏文件中提取了 Lua 文件。使用关键词“300”(第一回合的初始盲注数值),我找到了 **function get_blind_amount(ante)**,它位于 **misc_functions.lua** 中。

发现

以下是完整的函数:

function get_blind_amount(ante)
  local k = 0.75
  if not G.GAME.modifiers.scaling or G.GAME.modifiers.scaling == 1 then 
    local amounts = {
      300,  800, 2800,  6000,  11000,  20000,   35000,  50000
    }
    if ante < 1 then return 100 end
    if ante <= 8 then return amounts[ante] end
    local a, b, c, d = amounts[8],1.6,ante-8, 1 + 0.2*(ante-8)
    local amount = math.floor(a*(b+(k*c)^d)^c)
    amount = amount - amount%(10^math.floor(math.log10(amount)-1))
    return amount
  elseif G.GAME.modifiers.scaling == 2 then 
    local amounts = {
      300,  1000, 3200,  9000,  18000,  32000,  56000,  90000
    }
    if ante < 1 then return 100 end
    if ante <= 8 then return amounts[ante] end
    local a, b, c, d = amounts[8],1.6,ante-8, 1 + 0.2*(ante-8)
    local amount = math.floor(a*(b+(k*c)^d)^c)
    amount = amount - amount%(10^math.floor(math.log10(amount)-1))
    return amount
  elseif G.GAME.modifiers.scaling == 3 then 
    local amounts = {
      300,  1200, 3600,  10000,  25000,  50000,  90000,  180000
    }
    if ante < 1 then return 100 end
    if ante <= 8 then return amounts[ante] end
    local a, b, c, d = amounts[8],1.6,ante-8, 1 + 0.2*(ante-8)
    local amount = math.floor(a*(b+(k*c)^d)^c)
    amount = amount - amount%(10^math.floor(math.log10(amount)-1))
    return amount
  end
end

拆解一下这个函数:

  1. 代码中有三个 if 分支,根据增长指数来设定每一回合的初始数值,其中 1 最低,3 最高。例如,等离子牌组的增长指数为 2。每个分支中其余的代码完全相同,首先会根据底注 8 之前的底注等级设定一个硬编码数值(即 ante <1 和 ante ≤ 8 的条件)。
b_plasma={name = "Plasma Deck",
					stake = 1,
					unlocked = false,
					order = 14,
					pos = {x=4,y=2},
					set = "Back",
					config = {ante_scaling = 2},
					unlock_condition = {type = 'win_stake', stake=5}
					}
  1. 接着,代码会利用底注和常量设置参数 a、b、c、d,以计算 ante > 8 时的盲注数值。
    local a, b, c, d = amounts[8],1.6,ante-8, 1 + 0.2*(ante-8)
    local amount = math.floor(a*(b+(k*c)^d)^c)
    amount = amount - amount%(10^math.floor(math.log10(amount)-1))

写成数学表达式。增长指数为 3 时,a=180,000a = 180{,}000:

k=0.75,b=1.6c=n−8,d=1+0.2(n−8)A=⌊a(b+(kc)d)c⌋A′=A−(A mod 10⌊log⁡10(A)−1⌋)\begin{gathered} k = 0.75,\quad b = 1.6 \\ c = n - 8,\quad d = 1 + 0.2(n - 8) \\ A = \left\lfloor a \left(b + (k c)^d\right)^c \right\rfloor \\ A' = A - \left(A \bmod 10^{\left\lfloor \log_{10}(A) - 1 \right\rfloor}\right) \end{gathered}
  1. 当底注(n)趋近于无穷大时,由于 c 和 d 都是底注的线性函数,A 的增长速度实际上超越了指数级,进入了迭代幂次的领域。我觉得这个概念很有意思,关于这个高阶数学术语的更多信息可以在维基百科上找到。
n nn=3nn^{\,n^n} = {}^{3}n

ante = 8

观察这条曲线可以发现,在无尽模式从 9 开始之前,盲注数值都还在可控范围内。

ante = 11

达到 11 之后,难度迅速攀升。看一眼图表就能发现盲注数值直冲天际。

讨论

还有一些问题有待解答:

  1. 从理论上讲,玩家最高能达到第几级底注?
    1. 考虑到 Lua 最大的正浮点数大约是 1.8e308,而在底注 38 级时,盲注数值为 ~1e289。这意味着到了底注 39,这个数字就会超出程序的计算能力。如果有人打通了第 38 级会发生什么?我会测试一下并更新这篇文章。
  2. 拿到极其幸运的种子时,玩家最高能打到第几级底注?
    1. 在观察了盲注数值的增长之后,同样需要考虑玩家牌组的成长。正如这个视频 https://www.bilibili.com/video/BV1jH4y1J7Pv/ 所展示的,利用男爵 + 哑剧演员 + 头脑风暴达到 1e75 是可行的。我最初的假设是,玩家每个回合只能让牌组呈指数级增长,因此无法超越游戏设定的上限。

你有什么想法?