Files
roll-room/pyground/sugar/TestSugarRushGrid.py
2026-04-23 16:58:11 +08:00

47 lines
1.3 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import unittest
from SugarRush1000 import SugarRush1000
def checkGrid(grid):
total_scotter_count = 0
for col in range(7):
scotter_count = 0
for row in range(7):
if grid[row][col] == "S":
scotter_count += 1
total_scotter_count += 1
if scotter_count > 1:
print(f"col{col} has {scotter_count} scotter")
return False
if total_scotter_count > 7:
print(f"total scotter count {total_scotter_count} > 7")
return False
return True
class TestSugarRushLogic(unittest.TestCase):
def test_scotter_rule(self):
game = SugarRush1000(balance=100000, bet=1)
# 1. 触发
for _ in range(10000):
result = game.doSpin()
assert checkGrid(result['grid'])
print("✅ 测试通过生成scotter规则正常")
def test_free_spin_scotter_rule(self):
game = SugarRush1000(balance=100000, bet=1)
for _ in range(10000):
game.buy_free_spins('standard')
result = game.doSpin()
assert checkGrid(result['grid'])
print("✅ 测试通过免费旋转scotter规则正常")
if __name__ == "__main__":
unittest.main(argv=["first-arg-is-ignored"], exit=False)