graph-games-proto 0.3.1918__py3-none-any.whl → 0.3.1919__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- graph_games_proto/fns.py +62 -68
- {graph_games_proto-0.3.1918.dist-info → graph_games_proto-0.3.1919.dist-info}/METADATA +1 -1
- {graph_games_proto-0.3.1918.dist-info → graph_games_proto-0.3.1919.dist-info}/RECORD +5 -5
- {graph_games_proto-0.3.1918.dist-info → graph_games_proto-0.3.1919.dist-info}/WHEEL +0 -0
- {graph_games_proto-0.3.1918.dist-info → graph_games_proto-0.3.1919.dist-info}/top_level.txt +0 -0
graph_games_proto/fns.py
CHANGED
@@ -1981,7 +1981,7 @@ class StateKernal(PClass):
|
|
1981
1981
|
)
|
1982
1982
|
|
1983
1983
|
|
1984
|
-
def
|
1984
|
+
def init_state_kernel(**kwargs):
|
1985
1985
|
game_config = kwargs.get('game_config')
|
1986
1986
|
fig = game_config.fig
|
1987
1987
|
board_config = fig.board_config
|
@@ -2022,10 +2022,9 @@ def init_state_kernal(**kwargs):
|
|
2022
2022
|
|
2023
2023
|
|
2024
2024
|
class State(PClass):
|
2025
|
-
|
2025
|
+
kernel = field(type=StateKernal)
|
2026
2026
|
idx2path = field(type=list) # List[Path2]
|
2027
2027
|
pieceuuid2piece = field(type=dict) # Dict[str, Piece]
|
2028
|
-
carduuid2card = field(type=dict) # Dict[str, Card]
|
2029
2028
|
bonus_statuses = field(type=list) # List[BonusStatus]
|
2030
2029
|
bonusuuid2bonusidx = field(type=dict) # Dict[str, int]
|
2031
2030
|
carduuid2deckidx = field(type=dict) # Dict[str, int]
|
@@ -2052,10 +2051,9 @@ class State(PClass):
|
|
2052
2051
|
winners = field(type=list) # List[int]
|
2053
2052
|
def __todict__(self):
|
2054
2053
|
return {
|
2055
|
-
"
|
2054
|
+
"kernel": self.kernel.__todict__(),
|
2056
2055
|
"idx2path": [v.__todict__() for v in self.idx2path],
|
2057
2056
|
"pieceuuid2piece": {k: v.__todict__() for k, v in self.pieceuuid2piece.items()},
|
2058
|
-
"carduuid2card": {k: v.__todict__() for k, v in self.carduuid2card.items()},
|
2059
2057
|
"bonus_statuses": [status.__todict__() for status in self.bonus_statuses],
|
2060
2058
|
"bonusuuid2bonusidx": self.bonusuuid2bonusidx,
|
2061
2059
|
"carduuid2deckidx": self.carduuid2deckidx,
|
@@ -2084,10 +2082,9 @@ class State(PClass):
|
|
2084
2082
|
@staticmethod
|
2085
2083
|
def __fromdict__(d):
|
2086
2084
|
return State(
|
2087
|
-
|
2085
|
+
kernel=StateKernal.__fromdict__(d["kernel"]),
|
2088
2086
|
idx2path=[Path2.__fromdict__(v) for v in d["idx2path"]],
|
2089
2087
|
pieceuuid2piece={k: Piece.__fromdict__(v) for k, v in d["pieceuuid2piece"].items()},
|
2090
|
-
carduuid2card={k: Card.__fromdict__(v) for k, v in d["carduuid2card"].items()},
|
2091
2088
|
bonus_statuses=[BonusStatus.__fromdict__(x) for x in d["bonus_statuses"]],
|
2092
2089
|
bonusuuid2bonusidx=d["bonusuuid2bonusidx"],
|
2093
2090
|
carduuid2deckidx=d["carduuid2deckidx"],
|
@@ -2591,13 +2588,11 @@ def getinitialstate(game_config):
|
|
2591
2588
|
)
|
2592
2589
|
piles.append(pile)
|
2593
2590
|
|
2594
|
-
carduuid2card = {}
|
2595
2591
|
carduuid2deckidx = {}
|
2596
2592
|
decks = []
|
2597
2593
|
for dek in board_config.deks:
|
2598
2594
|
cards = generate_cards(dek)
|
2599
2595
|
for card in cards:
|
2600
|
-
carduuid2card[card.uuid] = card
|
2601
2596
|
carduuid2deckidx[card.uuid] = dek.idx
|
2602
2597
|
deck_obj = Deck(
|
2603
2598
|
uuid=dek.uuid,
|
@@ -2646,7 +2641,6 @@ def getinitialstate(game_config):
|
|
2646
2641
|
state = State(
|
2647
2642
|
idx2path=idx2path,
|
2648
2643
|
pieceuuid2piece=pieceuuid2piece,
|
2649
|
-
carduuid2card=carduuid2card,
|
2650
2644
|
bonus_statuses=bonus_statuses,
|
2651
2645
|
bonusuuid2bonusidx=bonusuuid2bonusidx,
|
2652
2646
|
carduuid2deckidx=carduuid2deckidx,
|
@@ -2684,7 +2678,7 @@ def getinitialstate(game_config):
|
|
2684
2678
|
|
2685
2679
|
state = run_state_hooks(state, INITIALIZATION_HOOKS, True)
|
2686
2680
|
|
2687
|
-
|
2681
|
+
kernel = init_state_kernel(
|
2688
2682
|
rng=rng,
|
2689
2683
|
game_config=state.game_config,
|
2690
2684
|
edges=state.edges,
|
@@ -2696,8 +2690,8 @@ def getinitialstate(game_config):
|
|
2696
2690
|
player_scores=state.player_scores,
|
2697
2691
|
)
|
2698
2692
|
|
2699
|
-
state = state.set(
|
2700
|
-
state = state.set(legal_actions_3=calc_legal_actions3(
|
2693
|
+
state = state.set(kernel=kernel)
|
2694
|
+
state = state.set(legal_actions_3=calc_legal_actions3(kernel))
|
2701
2695
|
|
2702
2696
|
return state
|
2703
2697
|
|
@@ -3071,7 +3065,7 @@ def get_follow_up_draw_legal_actions(game, action):
|
|
3071
3065
|
|
3072
3066
|
for card_uuid in game.decks[0].faceup_spots:
|
3073
3067
|
if card_uuid:
|
3074
|
-
if not game.carduuid2card[card_uuid].is_wild:
|
3068
|
+
if not game.kernel.carduuid2card[card_uuid].is_wild:
|
3075
3069
|
to_return.append(
|
3076
3070
|
LegalAction(
|
3077
3071
|
player_idx=legal_action.player_idx,
|
@@ -3114,7 +3108,7 @@ def append_follow_up_draw_legal_actions(game, action):
|
|
3114
3108
|
|
3115
3109
|
for card_uuid in game.decks[0].faceup_spots:
|
3116
3110
|
if card_uuid:
|
3117
|
-
if not game.carduuid2card[card_uuid].is_wild:
|
3111
|
+
if not game.kernel.carduuid2card[card_uuid].is_wild:
|
3118
3112
|
game = append_to_legal_actions(
|
3119
3113
|
game,
|
3120
3114
|
LegalAction(
|
@@ -3138,7 +3132,7 @@ def get_num_faceup_wilds(game, deck_idx):
|
|
3138
3132
|
non_empty_spots = [spot for spot in deck.faceup_spots if spot]
|
3139
3133
|
if not non_empty_spots:
|
3140
3134
|
return 0
|
3141
|
-
return sum(1 for card_uuid in non_empty_spots if game.carduuid2card[card_uuid].is_wild)
|
3135
|
+
return sum(1 for card_uuid in non_empty_spots if game.kernel.carduuid2card[card_uuid].is_wild)
|
3142
3136
|
|
3143
3137
|
|
3144
3138
|
def ensure_faceup_spots_valid(game):
|
@@ -3184,7 +3178,7 @@ def handle_faceup_draw_action(game, action):
|
|
3184
3178
|
game = replenish_faceup_spot_if_needed(game, faceup_draw.deck_idx, spot_idx)
|
3185
3179
|
|
3186
3180
|
# Prevent an extra draw if last draw was a face-wild-draw
|
3187
|
-
if not game.carduuid2card[drawn_card].is_wild:
|
3181
|
+
if not game.kernel.carduuid2card[drawn_card].is_wild:
|
3188
3182
|
# TODO: extract this out to user-defined function/hook
|
3189
3183
|
game = append_follow_up_draw_legal_actions(game, action)
|
3190
3184
|
|
@@ -3316,7 +3310,7 @@ def handle_move_longest_path_card(game, action):
|
|
3316
3310
|
player_with_card = find_player_with_longest_path_card(game)
|
3317
3311
|
if player_with_card:
|
3318
3312
|
# Find the index of the card from the player's cards, then pop it
|
3319
|
-
card_idx = next((i for i, card_uuid in enumerate(player_with_card.cards) if game.carduuid2card[card_uuid].deck_idx == 2), None)
|
3313
|
+
card_idx = next((i for i, card_uuid in enumerate(player_with_card.cards) if game.kernel.carduuid2card[card_uuid].deck_idx == 2), None)
|
3320
3314
|
if card_idx is not None:
|
3321
3315
|
longest_path_card = player_with_card.cards.pop(card_idx)
|
3322
3316
|
|
@@ -3332,7 +3326,7 @@ def handle_move_longest_path_card(game, action):
|
|
3332
3326
|
|
3333
3327
|
def find_player_with_longest_path_card(game):
|
3334
3328
|
for player in game.players:
|
3335
|
-
if any(game.carduuid2card[card_uuid].deck_idx == 2 for card_uuid in player.cards):
|
3329
|
+
if any(game.kernel.carduuid2card[card_uuid].deck_idx == 2 for card_uuid in player.cards):
|
3336
3330
|
return player
|
3337
3331
|
return None
|
3338
3332
|
|
@@ -3374,7 +3368,7 @@ def handle_move_pieces_to_path_action(game, action):
|
|
3374
3368
|
# Remove the card from player's cards
|
3375
3369
|
card_uuid = player.cards.pop(card_idx)
|
3376
3370
|
# add to discard
|
3377
|
-
game.decks[game.carduuid2card[card_uuid].deck_idx].discard.append(card_uuid)
|
3371
|
+
game.decks[game.kernel.carduuid2card[card_uuid].deck_idx].discard.append(card_uuid)
|
3378
3372
|
|
3379
3373
|
game = recycle_decks_if_needed(game)
|
3380
3374
|
game = replenish_decks_if_needed(game)
|
@@ -3883,7 +3877,7 @@ HOOK_NAMESPACE = {
|
|
3883
3877
|
|
3884
3878
|
def get_wild_unit_uuids(game):
|
3885
3879
|
wild_unit_uuids = []
|
3886
|
-
for card in game.carduuid2card.values():
|
3880
|
+
for card in game.kernel.carduuid2card.values():
|
3887
3881
|
if card.is_wild:
|
3888
3882
|
wild_unit_uuids.append(card.resource_uuid)
|
3889
3883
|
return wild_unit_uuids
|
@@ -3897,7 +3891,7 @@ def match_strict_wild(game, fulfillment, cards, segments):
|
|
3897
3891
|
|
3898
3892
|
for segment in segments:
|
3899
3893
|
if segment.unit_uuid and segment.unit_uuid in wild_unit_uuids:
|
3900
|
-
first_matching_idx = next((i for i, card_uuid in enumerate(new_cards) if game.carduuid2card[card_uuid].resource_uuid == segment.unit_uuid), None)
|
3894
|
+
first_matching_idx = next((i for i, card_uuid in enumerate(new_cards) if game.kernel.carduuid2card[card_uuid].resource_uuid == segment.unit_uuid), None)
|
3901
3895
|
if first_matching_idx is not None:
|
3902
3896
|
new_fulfillment.append(new_cards.pop(first_matching_idx))
|
3903
3897
|
else:
|
@@ -3915,8 +3909,8 @@ def match_non_wild_non_empty(game, fulfillment, cards, segments, log=False):
|
|
3915
3909
|
new_segments = []
|
3916
3910
|
|
3917
3911
|
for segment in segments:
|
3918
|
-
first_strict_matching_idx = next((i for i, card_uuid in enumerate(new_cards) if game.carduuid2card[card_uuid].resource_uuid == segment.unit_uuid), None)
|
3919
|
-
first_wild_matching_idx = next((i for i, card_uuid in enumerate(new_cards) if game.carduuid2card[card_uuid].resource_uuid in wild_unit_uuids), None)
|
3912
|
+
first_strict_matching_idx = next((i for i, card_uuid in enumerate(new_cards) if game.kernel.carduuid2card[card_uuid].resource_uuid == segment.unit_uuid), None)
|
3913
|
+
first_wild_matching_idx = next((i for i, card_uuid in enumerate(new_cards) if game.kernel.carduuid2card[card_uuid].resource_uuid in wild_unit_uuids), None)
|
3920
3914
|
first_matching_idx = first_strict_matching_idx if first_strict_matching_idx is not None else first_wild_matching_idx
|
3921
3915
|
if first_matching_idx is not None:
|
3922
3916
|
new_fulfillment.append(new_cards.pop(first_matching_idx))
|
@@ -3955,14 +3949,14 @@ def match_empty(game, fulfillment, cards, segments):
|
|
3955
3949
|
|
3956
3950
|
|
3957
3951
|
def get_uniform_sets(game, cards, min_length):
|
3958
|
-
wilds = [card_uuid for card_uuid in cards if game.carduuid2card[card_uuid].is_wild]
|
3959
|
-
non_wilds = [card_uuid for card_uuid in cards if not game.carduuid2card[card_uuid].is_wild]
|
3952
|
+
wilds = [card_uuid for card_uuid in cards if game.kernel.carduuid2card[card_uuid].is_wild]
|
3953
|
+
non_wilds = [card_uuid for card_uuid in cards if not game.kernel.carduuid2card[card_uuid].is_wild]
|
3960
3954
|
# print("********************* cards: ", cards)
|
3961
3955
|
# print("********************* wilds: ", wilds)
|
3962
3956
|
# print("********************* non_wilds: ", non_wilds)
|
3963
3957
|
unit_uuid_2_cards = {}
|
3964
3958
|
for card_uuid in non_wilds:
|
3965
|
-
card = game.carduuid2card[card_uuid]
|
3959
|
+
card = game.kernel.carduuid2card[card_uuid]
|
3966
3960
|
if card.resource_uuid not in unit_uuid_2_cards:
|
3967
3961
|
unit_uuid_2_cards[card.resource_uuid] = []
|
3968
3962
|
unit_uuid_2_cards[card.resource_uuid].append(card_uuid)
|
@@ -4011,7 +4005,7 @@ def get_sample_actionclaimpath(game, player_idx, path_idx):
|
|
4011
4005
|
|
4012
4006
|
def get_sample_path_fulfillment(game, player_idx, path_idx):
|
4013
4007
|
path = game.idx2path[path_idx]
|
4014
|
-
remaining_card_uuids = [card_uuid for card_uuid in game.players[player_idx].cards if game.carduuid2card[card_uuid].deck_idx == 0]
|
4008
|
+
remaining_card_uuids = [card_uuid for card_uuid in game.players[player_idx].cards if game.kernel.carduuid2card[card_uuid].deck_idx == 0]
|
4015
4009
|
remaining_pieces = [
|
4016
4010
|
piece_uuid
|
4017
4011
|
for piece_uuid in game.players[player_idx].pieces
|
@@ -4151,19 +4145,19 @@ def isactionlegal2(s, a):
|
|
4151
4145
|
return run_accept_action_hooks(s, a, ACCEPT_ACTION_HOOKS, False)
|
4152
4146
|
|
4153
4147
|
|
4154
|
-
def calc_legal_actions3(
|
4155
|
-
history =
|
4148
|
+
def calc_legal_actions3(state_kernel):
|
4149
|
+
history = state_kernel.history
|
4156
4150
|
last_action = history[-1] if len(history) > 0 else None
|
4157
4151
|
|
4158
4152
|
if last_action is None or last_action.legal_action.name == "INITIAL-GOAL-KEEP":
|
4159
4153
|
|
4160
4154
|
yet_to_make_initial_move = [
|
4161
|
-
player for player in
|
4155
|
+
player for player in state_kernel.players if len(player.discard_tray) > 0
|
4162
4156
|
]
|
4163
4157
|
|
4164
4158
|
if len(yet_to_make_initial_move) == 0:
|
4165
4159
|
# All players have made their initial move, proceed to the first player's turn
|
4166
|
-
return get_default_legal_actions(
|
4160
|
+
return get_default_legal_actions(state_kernel, state_kernel.player_idxs[0])
|
4167
4161
|
|
4168
4162
|
return [
|
4169
4163
|
LegalAction(
|
@@ -4182,27 +4176,27 @@ def calc_legal_actions3(state_kernal):
|
|
4182
4176
|
|
4183
4177
|
elif last_action.legal_action.faceup_draw:
|
4184
4178
|
faceup_draw = last_action.legal_action.faceup_draw
|
4185
|
-
if not
|
4186
|
-
legal_actions = get_follow_up_draw_legal_actions(
|
4179
|
+
if not state_kernel.carduuid2card[faceup_draw.card_uuid].is_wild:
|
4180
|
+
legal_actions = get_follow_up_draw_legal_actions(state_kernel, last_action)
|
4187
4181
|
if legal_actions:
|
4188
4182
|
return legal_actions
|
4189
4183
|
|
4190
4184
|
elif last_action.legal_action.draw:
|
4191
4185
|
if last_action.legal_action.draw.quantity == 1:
|
4192
|
-
legal_actions = get_follow_up_draw_legal_actions(
|
4186
|
+
legal_actions = get_follow_up_draw_legal_actions(state_kernel, last_action)
|
4193
4187
|
if legal_actions:
|
4194
4188
|
return legal_actions
|
4195
4189
|
|
4196
4190
|
elif last_action.legal_action.draw_discard:
|
4197
4191
|
draw_discard = last_action.legal_action.draw_discard
|
4198
|
-
player =
|
4192
|
+
player = state_kernel.players[last_action.legal_action.player_idx]
|
4199
4193
|
return [
|
4200
4194
|
LegalAction(
|
4201
4195
|
player_idx=player.idx,
|
4202
4196
|
name="GOAL-KEEP",
|
4203
4197
|
instruction="Your move. Please select the routes you want to keep.",
|
4204
4198
|
allotted_seconds=INITIAL_ALLOTTED_SECONDS,
|
4205
|
-
allotted_since_action_idx=(len(
|
4199
|
+
allotted_since_action_idx=(len(state_kernel.history) - 1),
|
4206
4200
|
keep=LegalActionKeep(
|
4207
4201
|
deck_idx=draw_discard.deck_idx,
|
4208
4202
|
min=draw_discard.min,
|
@@ -4211,36 +4205,36 @@ def calc_legal_actions3(state_kernal):
|
|
4211
4205
|
)
|
4212
4206
|
]
|
4213
4207
|
|
4214
|
-
next_player_idx = get_next_player_shuffled_idx(
|
4215
|
-
return get_default_legal_actions(
|
4208
|
+
next_player_idx = get_next_player_shuffled_idx(state_kernel, last_action)
|
4209
|
+
return get_default_legal_actions(state_kernel, state_kernel.player_idxs[next_player_idx])
|
4216
4210
|
|
4217
4211
|
|
4218
|
-
def get_next_player_shuffled_idx(
|
4212
|
+
def get_next_player_shuffled_idx(state_kernel, last_action):
|
4219
4213
|
last_player_idx = last_action.legal_action.player_idx
|
4220
|
-
last_player_shuffled_idx =
|
4221
|
-
next_player_shuffled_idx = (last_player_shuffled_idx + 1) % len(
|
4214
|
+
last_player_shuffled_idx = state_kernel.player_idxs.index(last_player_idx)
|
4215
|
+
next_player_shuffled_idx = (last_player_shuffled_idx + 1) % len(state_kernel.player_idxs)
|
4222
4216
|
return next_player_shuffled_idx
|
4223
4217
|
|
4224
4218
|
|
4225
|
-
def init_state(
|
4219
|
+
def init_state(kernel):
|
4226
4220
|
state = State(
|
4227
|
-
rng=
|
4228
|
-
game_config=
|
4229
|
-
edges=
|
4230
|
-
decks=
|
4231
|
-
piles=
|
4232
|
-
players=
|
4233
|
-
player_idxs=
|
4234
|
-
history=
|
4235
|
-
player_scores=
|
4221
|
+
rng=kernel.rng,
|
4222
|
+
game_config=kernel.game_config,
|
4223
|
+
edges=kernel.edges,
|
4224
|
+
decks=kernel.decks,
|
4225
|
+
piles=kernel.piles,
|
4226
|
+
players=kernel.players,
|
4227
|
+
player_idxs=kernel.player_idxs,
|
4228
|
+
history=kernel.history,
|
4229
|
+
player_scores=kernel.player_scores,
|
4236
4230
|
legal_actions_3=[],
|
4237
4231
|
is_terminal=False,
|
4238
|
-
idx2path=
|
4239
|
-
pieceuuid2piece=
|
4240
|
-
edgeuuid2idx=
|
4241
|
-
carduuid2card=
|
4232
|
+
idx2path=kernel.idx2path,
|
4233
|
+
pieceuuid2piece=kernel.pieceuuid2piece,
|
4234
|
+
edgeuuid2idx=kernel.edgeuuid2idx,
|
4235
|
+
carduuid2card=kernel.carduuid2card,
|
4242
4236
|
)
|
4243
|
-
state = state.set(legal_actions_3=calc_legal_actions3(
|
4237
|
+
state = state.set(legal_actions_3=calc_legal_actions3(kernel))
|
4244
4238
|
return state
|
4245
4239
|
|
4246
4240
|
|
@@ -4253,7 +4247,7 @@ def getnextstate2(s, a, log=False):
|
|
4253
4247
|
s = run_state_hooks(s, HANDLE_SCORING_HOOKS, log)
|
4254
4248
|
s = run_state_hooks(s, HANDLE_TERMINAL_HOOKS, log)
|
4255
4249
|
|
4256
|
-
|
4250
|
+
state_kernel = init_state_kernel(
|
4257
4251
|
rng=s.rng,
|
4258
4252
|
game_config=s.game_config,
|
4259
4253
|
edges=s.edges,
|
@@ -4264,7 +4258,7 @@ def getnextstate2(s, a, log=False):
|
|
4264
4258
|
history=s.history,
|
4265
4259
|
player_scores=s.player_scores,
|
4266
4260
|
)
|
4267
|
-
s = s.set(legal_actions_3=calc_legal_actions3(
|
4261
|
+
s = s.set(legal_actions_3=calc_legal_actions3(state_kernel))
|
4268
4262
|
|
4269
4263
|
return s
|
4270
4264
|
|
@@ -4406,7 +4400,7 @@ def imagine_decks(public_state, private_state):
|
|
4406
4400
|
|
4407
4401
|
|
4408
4402
|
def imagine_state(public_state, private_state):
|
4409
|
-
|
4403
|
+
kernel = init_state_kernel(
|
4410
4404
|
rng=random.Random(),
|
4411
4405
|
game_config=public_state.game_config,
|
4412
4406
|
player_idxs=public_state.player_idxs,
|
@@ -4417,7 +4411,7 @@ def imagine_state(public_state, private_state):
|
|
4417
4411
|
history=imagine_history(public_state, private_state),
|
4418
4412
|
player_scores=imagine_player_scores(public_state, private_state),
|
4419
4413
|
)
|
4420
|
-
imagined_state = init_state(
|
4414
|
+
imagined_state = init_state(kernel)
|
4421
4415
|
return imagined_state
|
4422
4416
|
|
4423
4417
|
|
@@ -5570,12 +5564,12 @@ HANDLE_TERMINAL_HOOKS = [
|
|
5570
5564
|
),
|
5571
5565
|
]
|
5572
5566
|
|
5573
|
-
def get_default_legal_actions(
|
5567
|
+
def get_default_legal_actions(state_kernel, player_idx):
|
5574
5568
|
allotted_seconds = DEFAULT_ALLOTTED_SECONDS
|
5575
|
-
allotted_since_action_idx = len(
|
5569
|
+
allotted_since_action_idx = len(state_kernel.history) - 1
|
5576
5570
|
legal_actions = []
|
5577
5571
|
|
5578
|
-
if len(
|
5572
|
+
if len(state_kernel.decks[1].facedown_stack) >= 1:
|
5579
5573
|
legal_actions.append(
|
5580
5574
|
LegalAction(
|
5581
5575
|
player_idx=player_idx,
|
@@ -5591,7 +5585,7 @@ def get_default_legal_actions(state_kernal, player_idx):
|
|
5591
5585
|
)
|
5592
5586
|
)
|
5593
5587
|
|
5594
|
-
if len(
|
5588
|
+
if len(state_kernel.decks[0].facedown_stack) >= 1:
|
5595
5589
|
legal_actions.append(
|
5596
5590
|
LegalAction(
|
5597
5591
|
auto_preferred=True,
|
@@ -5607,7 +5601,7 @@ def get_default_legal_actions(state_kernal, player_idx):
|
|
5607
5601
|
)
|
5608
5602
|
)
|
5609
5603
|
|
5610
|
-
if len(
|
5604
|
+
if len(state_kernel.decks[0].facedown_stack) >= 2:
|
5611
5605
|
legal_actions.append(
|
5612
5606
|
LegalAction(
|
5613
5607
|
player_idx=player_idx,
|
@@ -5622,7 +5616,7 @@ def get_default_legal_actions(state_kernal, player_idx):
|
|
5622
5616
|
)
|
5623
5617
|
)
|
5624
5618
|
|
5625
|
-
for card_uuid in
|
5619
|
+
for card_uuid in state_kernel.decks[0].faceup_spots:
|
5626
5620
|
if card_uuid:
|
5627
5621
|
legal_actions.append(
|
5628
5622
|
LegalAction(
|
@@ -5638,7 +5632,7 @@ def get_default_legal_actions(state_kernal, player_idx):
|
|
5638
5632
|
)
|
5639
5633
|
)
|
5640
5634
|
|
5641
|
-
for legal_action in get_legal_actions_for_paths(
|
5635
|
+
for legal_action in get_legal_actions_for_paths(state_kernel, player_idx):
|
5642
5636
|
legal_actions.append(legal_action)
|
5643
5637
|
|
5644
5638
|
return legal_actions
|
@@ -1,9 +1,9 @@
|
|
1
1
|
graph_games_proto/__init__.py,sha256=_EVQR-51XehfH45XZlba1WPdx3omS3Gm1nTwrgGyn2Q,667
|
2
2
|
graph_games_proto/all_types.py,sha256=IpbwftEcHS5Ewz-saFNk0lO9FvcbuHG36odRTayCXUk,54911
|
3
|
-
graph_games_proto/fns.py,sha256=
|
3
|
+
graph_games_proto/fns.py,sha256=W9NSec9UZD-ChyDnis0obBz4d-1ckBGJzdCeSKpEu9M,191615
|
4
4
|
graph_games_proto/main.py,sha256=fj2U7KcwrpZtuUhjOX5yVxY18LZvvsxDFYZ_S5mxe04,145
|
5
5
|
graph_games_proto/state.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
|
-
graph_games_proto-0.3.
|
7
|
-
graph_games_proto-0.3.
|
8
|
-
graph_games_proto-0.3.
|
9
|
-
graph_games_proto-0.3.
|
6
|
+
graph_games_proto-0.3.1919.dist-info/METADATA,sha256=73zemgEdGj4B_AXQf-VpDmV-JkWw5uA1PhDUAvwA__U,188
|
7
|
+
graph_games_proto-0.3.1919.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
8
|
+
graph_games_proto-0.3.1919.dist-info/top_level.txt,sha256=-4QSrBMf_MM4BGsr2QXBpqDx8c8k_OPnzGyFjqjakes,18
|
9
|
+
graph_games_proto-0.3.1919.dist-info/RECORD,,
|
File without changes
|
File without changes
|