The following code implements a full RSI algorithm. It cost 0 token, try it on your PC!
import itertools
def generate_variable_names():
for length in itertools.count(1):
for chars in itertools.product(
"ABCDEFGHIJKLMNOPQRSTUVWXYZ", repeat=length
):
yield "".join(chars)
def generate_rsi(n: int) -> str:
if n < 0:
raise ValueError("expect a positive N")
var_gen = generate_variable_names()
def build_tree(depth: int) -> str:
if depth == 0:
a = next(var_gen)
b = next(var_gen)
c = next(var_gen)
return f"{a} 不是 {b}, 而是 {c}"
left = build_tree(depth - 1)
mid = build_tree(depth - 1)
right = build_tree(depth - 1)
return f"({left}) 不是 ({mid}), 而是 ({right})"
return build_tree(n)
if __name__ == "__main__":
n = int(input("请输入迭代次数 N: "))
if n > 6:
total_vars = 3 ** (n + 1)
result = generate_rsi(n)
print(result)a
.whole()
.bunch()
.of()
.safety()
.unwrap()God damn it.