adjust json output to arbitrary move count

This commit is contained in:
Maximilian Keßler 2023-02-28 19:10:43 +01:00
parent b1340713bd
commit 63555cfa85
Signed by: max
GPG key ID: BCC5A619923C0BA5

3
sat.py
View file

@ -56,6 +56,8 @@ def toJSON(model):
hands = [deck[4*p:4*(p+1)] for p in range(0,5)] hands = [deck[4*p:4*(p+1)] for p in range(0,5)]
actions = [] actions = []
for m in range(MOVES): for m in range(MOVES):
if model.get_py_value(dummyturn[m]):
break
if model.get_py_value(discard_any[m]): if model.get_py_value(discard_any[m]):
discarded = next(i for i in range(0,50) if model.get_py_value(discard[m][i])) discarded = next(i for i in range(0,50) if model.get_py_value(discard[m][i]))
icard = hands[m % 5].index(deck[discarded]) icard = hands[m % 5].index(deck[discarded])
@ -90,7 +92,6 @@ def toJSON(model):
"first_player": 0, "first_player": 0,
"options": { "options": {
"variant": "No Variant", "variant": "No Variant",
"allOrNothing": True
} }
} }
print(json.dumps(game)) print(json.dumps(game))