graph-games-proto 0.3.1899__py3-none-any.whl → 0.3.1901__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 +21 -5
- {graph_games_proto-0.3.1899.dist-info → graph_games_proto-0.3.1901.dist-info}/METADATA +1 -1
- {graph_games_proto-0.3.1899.dist-info → graph_games_proto-0.3.1901.dist-info}/RECORD +5 -5
- {graph_games_proto-0.3.1899.dist-info → graph_games_proto-0.3.1901.dist-info}/WHEEL +0 -0
- {graph_games_proto-0.3.1899.dist-info → graph_games_proto-0.3.1901.dist-info}/top_level.txt +0 -0
graph_games_proto/fns.py
CHANGED
@@ -4070,6 +4070,7 @@ def calc_legal_actions3(state_kernal):
|
|
4070
4070
|
|
4071
4071
|
|
4072
4072
|
class StateKernal(PClass):
|
4073
|
+
game_config = field(type=GameConfig)
|
4073
4074
|
edges = field(type=list) # List[BiEdge]
|
4074
4075
|
decks = field(type=list) # List[Deck]
|
4075
4076
|
piles = field(type=list) # List[Pile]
|
@@ -4077,34 +4078,49 @@ class StateKernal(PClass):
|
|
4077
4078
|
player_idxs = field(type=list) # List[int]
|
4078
4079
|
history = field(type=list) # List[PublicAction]
|
4079
4080
|
player_scores = field(type=list) # List[PlayerScore]
|
4080
|
-
game_config = field(type=GameConfig)
|
4081
4081
|
uuid2edge = field(type=dict) # Dict[str, BiEdge]
|
4082
4082
|
idx2path = field(type=list) # List[Path2]
|
4083
4083
|
uuid2segment = field(type=dict) # Dict[str, Segment]
|
4084
|
+
edgeuuid2idx = field(type=dict) # Dict[str, int]
|
4085
|
+
carduuid2card = field(type=dict) # Dict[str, Card]
|
4084
4086
|
|
4085
4087
|
|
4086
4088
|
def init_state_kernal(**kwargs):
|
4089
|
+
game_config = kwargs.get('game_config')
|
4090
|
+
fig = game_config.fig
|
4091
|
+
board_config = fig.board_config
|
4092
|
+
edges = kwargs.get('edges', [])
|
4087
4093
|
uuid2edge = {}
|
4088
4094
|
idx2path = []
|
4089
4095
|
uuid2segment = {}
|
4090
|
-
for edge in
|
4096
|
+
edgeuuid2idx = {edge.uuid: idx for idx, edge in enumerate(edges)}
|
4097
|
+
for edge in edges:
|
4091
4098
|
uuid2edge[edge.uuid] = edge
|
4092
4099
|
for path in edge.paths:
|
4093
4100
|
idx2path.append(path)
|
4094
4101
|
for segment in path.segments:
|
4095
4102
|
uuid2segment[segment.uuid] = segment
|
4103
|
+
|
4104
|
+
carduuid2card = {}
|
4105
|
+
for dek in board_config.deks:
|
4106
|
+
cards = generate_cards(dek)
|
4107
|
+
for card in cards:
|
4108
|
+
carduuid2card[card.uuid] = card
|
4109
|
+
|
4096
4110
|
return StateKernal(
|
4097
|
-
|
4111
|
+
game_config=game_config,
|
4112
|
+
edges=edges,
|
4098
4113
|
decks=kwargs.get('decks'),
|
4099
4114
|
piles=kwargs.get('piles'),
|
4100
4115
|
players=kwargs.get('players'),
|
4101
4116
|
player_idxs=kwargs.get('player_idxs'),
|
4102
4117
|
history=kwargs.get('history'),
|
4103
4118
|
player_scores=kwargs.get('player_scores'),
|
4104
|
-
game_config=kwargs.get('game_config'),
|
4105
4119
|
uuid2edge=uuid2edge,
|
4106
4120
|
idx2path=idx2path,
|
4107
4121
|
uuid2segment=uuid2segment,
|
4122
|
+
edgeuuid2idx=edgeuuid2idx,
|
4123
|
+
carduuid2card=carduuid2card,
|
4108
4124
|
)
|
4109
4125
|
|
4110
4126
|
|
@@ -4120,6 +4136,7 @@ def getnextstate2(s, a, log=False):
|
|
4120
4136
|
s = run_state_action_hooks(s, a, EMPTY_LEGAL_ACTIONS_HOOKS, log)
|
4121
4137
|
|
4122
4138
|
state_kernal = init_state_kernal(
|
4139
|
+
game_config=s.game_config,
|
4123
4140
|
edges=s.edges,
|
4124
4141
|
decks=s.decks,
|
4125
4142
|
piles=s.piles,
|
@@ -4127,7 +4144,6 @@ def getnextstate2(s, a, log=False):
|
|
4127
4144
|
player_idxs=s.player_idxs,
|
4128
4145
|
history=s.history,
|
4129
4146
|
player_scores=s.player_scores,
|
4130
|
-
game_config=s.game_config,
|
4131
4147
|
)
|
4132
4148
|
s = s.set(legal_actions_3=calc_legal_actions3(state_kernal))
|
4133
4149
|
|
@@ -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=7Ffq77o_6bB4uE-8zwmgeWj8B6J0Xf69YVWqAfMKg6M,188345
|
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.1901.dist-info/METADATA,sha256=Dgpx_JgPd1T7zH2mSEPUE39jIoQJF-lfD_iRCEzKNNc,188
|
7
|
+
graph_games_proto-0.3.1901.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
8
|
+
graph_games_proto-0.3.1901.dist-info/top_level.txt,sha256=-4QSrBMf_MM4BGsr2QXBpqDx8c8k_OPnzGyFjqjakes,18
|
9
|
+
graph_games_proto-0.3.1901.dist-info/RECORD,,
|
File without changes
|
File without changes
|