Extend profiles from 280 to 312 bytes with legacy compatibility. Keep tower relics run-local and share the profile bankroll.
30 lines
1.1 KiB
Python
30 lines
1.1 KiB
Python
"""Generate independent evaluator vectors only; never rewrite shipping assets."""
|
|
import itertools
|
|
from pathlib import Path
|
|
import random
|
|
import struct
|
|
import sys
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
sys.path.insert(0, str(ROOT/'tools/vendor'))
|
|
from treys import Card, Evaluator
|
|
|
|
|
|
def main():
|
|
rng = random.Random(77291)
|
|
hands = [list(hand) for hand in itertools.combinations([8,9,10,11,12,13,25], 5)]
|
|
hands += [rng.sample(range(52), count) for count in (5,6,7) for _ in range(3000)]
|
|
evaluator = Evaluator()
|
|
def native(card):
|
|
return Card.new('23456789TJQKA'[card%13]+'cdhs'[card//13])
|
|
vectors = b''.join(struct.pack('<9I', len(hand), *hand, *([0]*(7-len(hand))),
|
|
evaluator.evaluate([], [native(card) for card in hand]))
|
|
for hand in hands)
|
|
target = ROOT/'build/tables/poker-vectors.bin'
|
|
target.parent.mkdir(parents=True, exist_ok=True)
|
|
target.write_bytes(struct.pack('<I', len(hands))+vectors)
|
|
print(f'Prepared {len(hands)} independent poker vectors')
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|