Files
kubn-cfr/tests/test_strat.py
2025-11-28 17:19:59 +08:00

30 lines
780 B
Python

import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from src.cfr.info_set import InfoSet
def demo_strategy():
info_set = InfoSet(act_cnt=2)
turn = [
([10.0, 5.0], 1.0, "BT 0"),
([15.0, 20.0], 1.0, "CL 0"),
([9.0, 25.0], 1.0, "CL 1"),
([5.0, 30.0], 1.0, "CL 1"),
]
for reg, wgt, str in turn:
info_set.regret_sum = reg[:]
cur_stra = info_set.get_strat(wgt)
avg_stra = info_set.get_avg_strat()
print(f"{str}")
print(f" sum_regret: {reg}")
print(f" cur_strategy: [CK/FD: {cur_stra[0]:.3f}, BT/CL: {cur_stra[1]:.3f}]")
print(f" avg_strategy: [CK/FD: {avg_stra[0]:.3f}, BT/CL: {avg_stra[1]:.3f}]")
print()
if __name__ == "__main__":
demo_strategy()