graph-games-proto 0.3.1864__py3-none-any.whl → 0.3.1866__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 +22 -266
- {graph_games_proto-0.3.1864.dist-info → graph_games_proto-0.3.1866.dist-info}/METADATA +1 -1
- {graph_games_proto-0.3.1864.dist-info → graph_games_proto-0.3.1866.dist-info}/RECORD +5 -5
- {graph_games_proto-0.3.1864.dist-info → graph_games_proto-0.3.1866.dist-info}/WHEEL +0 -0
- {graph_games_proto-0.3.1864.dist-info → graph_games_proto-0.3.1866.dist-info}/top_level.txt +0 -0
graph_games_proto/fns.py
CHANGED
@@ -1009,18 +1009,9 @@ class ActionDrawUnit:
|
|
1009
1009
|
# fig::Fig
|
1010
1010
|
# logged_game_uuid::UUID
|
1011
1011
|
# to_play::Vector{Int}
|
1012
|
-
# num_route_cards::Int
|
1013
|
-
# num_route_discards::Int
|
1014
|
-
# num_unit_cards::Int
|
1015
|
-
# num_unit_discards::Int
|
1016
|
-
# faceup_spots::Vector{Union{Nothing,Int}}
|
1017
|
-
# player_hands::Vector{PublicPlayerInfo}
|
1018
|
-
# captured_segments::Vector{CapturedSegment}
|
1019
|
-
# captured_points::Vector{CapturedPoint}
|
1020
1012
|
# last_to_play::Union{Nothing,Int}
|
1021
1013
|
# terminal::Bool
|
1022
1014
|
# winners::Vector{Int}
|
1023
|
-
# market_refills::Vector{MarketRefill}
|
1024
1015
|
|
1025
1016
|
|
1026
1017
|
class AltAction(PClass):
|
@@ -2192,12 +2183,8 @@ class State(PClass):
|
|
2192
2183
|
route_cards = field(type=PVector) # List[int]
|
2193
2184
|
route_discards = field(type=PVector) # List[int]
|
2194
2185
|
player_hands = field(type=PVector) # List[PlayerInfo]
|
2195
|
-
unit_cards = field(type=PVector) # List[int]
|
2196
|
-
faceup_spots = field(type=PVector) # List[Union{Nothing, int}]
|
2197
|
-
unit_discards = field(type=PVector) # List[int]
|
2198
2186
|
last_to_play = field(type=(int, type(None)), initial=None)
|
2199
2187
|
winners = field(type=list) # List[int]
|
2200
|
-
# market_refills::Vector{MarketRefill}
|
2201
2188
|
def __todict__(self):
|
2202
2189
|
return {
|
2203
2190
|
"uuid2edge": {k: v.__todict__() for k, v in self.uuid2edge.items()},
|
@@ -2233,9 +2220,6 @@ class State(PClass):
|
|
2233
2220
|
"route_cards": list(self.route_cards),
|
2234
2221
|
"route_discards": list(self.route_discards),
|
2235
2222
|
"player_hands": [x.__todict__() for x in self.player_hands],
|
2236
|
-
"unit_cards": list(self.unit_cards),
|
2237
|
-
"faceup_spots": list(self.faceup_spots),
|
2238
|
-
"unit_discards": list(self.unit_discards),
|
2239
2223
|
"last_to_play": self.last_to_play,
|
2240
2224
|
"winners": self.winners,
|
2241
2225
|
}
|
@@ -2275,9 +2259,6 @@ class State(PClass):
|
|
2275
2259
|
route_cards=pvector(d["route_cards"]),
|
2276
2260
|
route_discards=pvector(d["route_discards"]),
|
2277
2261
|
player_hands=pvector([PlayerInfo.__fromdict__(h) for h in d["player_hands"]]),
|
2278
|
-
unit_cards=pvector(d["unit_cards"]),
|
2279
|
-
faceup_spots=pvector(d["faceup_spots"]),
|
2280
|
-
unit_discards=pvector(d["unit_discards"]),
|
2281
2262
|
last_to_play=d.get("last_to_play"),
|
2282
2263
|
winners=d["winners"],
|
2283
2264
|
)
|
@@ -2479,70 +2460,6 @@ class ScoreItem(PClass):
|
|
2479
2460
|
)
|
2480
2461
|
|
2481
2462
|
|
2482
|
-
# Implementing the following GraphQL type:
|
2483
|
-
# type PublicPlayerInfo {
|
2484
|
-
# final_score: PlayerScore
|
2485
|
-
# longest_trail: [Int]!
|
2486
|
-
# longest_trail_len: Int!
|
2487
|
-
# num_pieces: Int!
|
2488
|
-
# num_route_cards: Int!
|
2489
|
-
# num_unit_cards: Int!
|
2490
|
-
# paths: [Int]!
|
2491
|
-
# route_statuses: [RouteStatus]
|
2492
|
-
# score: Int!
|
2493
|
-
# }
|
2494
|
-
class PublicPlayerInfo(PClass):
|
2495
|
-
final_score = field(type=(PlayerScore, type(None)), initial=None) # Union{Nothing, PlayerScore}
|
2496
|
-
longest_trail = field(type=list) # List[int]
|
2497
|
-
longest_trail_len = field(type=int)
|
2498
|
-
num_pieces = field(type=int)
|
2499
|
-
num_route_cards = field(type=int)
|
2500
|
-
num_new_route_cards = field(type=int)
|
2501
|
-
num_unit_cards = field(type=int)
|
2502
|
-
paths = field(type=list) # List[int]
|
2503
|
-
points = field(type=list) # List[UUID]
|
2504
|
-
tokens = field(type=list) # List[UUID]
|
2505
|
-
route_statuses = field(type=list) # List[RouteStatus]
|
2506
|
-
score = field(type=int)
|
2507
|
-
num_point_pieces = field(type=int, initial=0) # Added to match PlayerInfo
|
2508
|
-
completed_clusters = field(type=list, initial=[]) # Added to match PlayerInfo
|
2509
|
-
def __todict__(self):
|
2510
|
-
return {
|
2511
|
-
"final_score": self.final_score.__todict__() if self.final_score else None,
|
2512
|
-
"longest_trail": self.longest_trail,
|
2513
|
-
"longest_trail_len": self.longest_trail_len,
|
2514
|
-
"num_pieces": self.num_pieces,
|
2515
|
-
"num_route_cards": self.num_route_cards,
|
2516
|
-
"num_new_route_cards": self.num_new_route_cards,
|
2517
|
-
"num_unit_cards": self.num_unit_cards,
|
2518
|
-
"paths": self.paths,
|
2519
|
-
"points": self.points,
|
2520
|
-
"tokens": self.tokens,
|
2521
|
-
"route_statuses": [x.__todict__() for x in self.route_statuses],
|
2522
|
-
"score": self.score,
|
2523
|
-
"num_point_pieces": self.num_point_pieces,
|
2524
|
-
"completed_clusters": self.completed_clusters,
|
2525
|
-
}
|
2526
|
-
@staticmethod
|
2527
|
-
def __fromdict__(d):
|
2528
|
-
return PublicPlayerInfo(
|
2529
|
-
final_score=PlayerScore.__fromdict__(d["final_score"]) if d.get("final_score") else None,
|
2530
|
-
longest_trail=d["longest_trail"],
|
2531
|
-
longest_trail_len=d["longest_trail_len"],
|
2532
|
-
num_pieces=d["num_pieces"],
|
2533
|
-
num_route_cards=d["num_route_cards"],
|
2534
|
-
num_new_route_cards=d["num_new_route_cards"],
|
2535
|
-
num_unit_cards=d["num_unit_cards"],
|
2536
|
-
paths=d["paths"],
|
2537
|
-
points=d["points"],
|
2538
|
-
tokens=d["tokens"],
|
2539
|
-
route_statuses=[RouteStatus.__fromdict__(x) for x in d["route_statuses"]],
|
2540
|
-
score=d["score"],
|
2541
|
-
num_point_pieces=d.get("num_point_pieces", 0),
|
2542
|
-
completed_clusters=d.get("completed_clusters", []),
|
2543
|
-
)
|
2544
|
-
|
2545
|
-
|
2546
2463
|
class AllottedTime(PClass):
|
2547
2464
|
seconds = field(type=int)
|
2548
2465
|
since_action_idx = field(type=int)
|
@@ -2598,20 +2515,10 @@ class PublicState(PClass):
|
|
2598
2515
|
piles = field(type=list) # List[Pile]
|
2599
2516
|
player_idxs = field(type=list) # List[int]
|
2600
2517
|
initial_to_play = field(type=list) # List[int]
|
2601
|
-
to_play = field(type=list) # List[int]
|
2602
|
-
unit_discards = field(type=list) # List[int]
|
2603
|
-
num_route_cards = field(type=int)
|
2604
|
-
num_route_discards = field(type=int)
|
2605
|
-
num_unit_cards = field(type=int)
|
2606
|
-
num_unit_discards = field(type=int)
|
2607
|
-
faceup_spots = field(type=list) # List[Union{Nothing, int}]
|
2608
2518
|
players = field(type=list) # List[PublicPlayer]
|
2609
|
-
player_hands = field(type=list) # List[PublicPlayerInfo]
|
2610
2519
|
last_to_play = field(type=(int, type(None)), initial=None)
|
2611
2520
|
winners = field(type=list)
|
2612
2521
|
terminal = field(type=bool)
|
2613
|
-
captured_points = field(type=list) # List[CapturedPoint]
|
2614
|
-
captured_segments = field(type=list) # List[CapturedSegment]
|
2615
2522
|
def __todict__(self):
|
2616
2523
|
return {
|
2617
2524
|
"deadlines": [deadline.__todict__() if deadline else None for deadline in self.deadlines],
|
@@ -2633,20 +2540,10 @@ class PublicState(PClass):
|
|
2633
2540
|
"piles": [pile.__todict__() for pile in self.piles],
|
2634
2541
|
"player_idxs": self.player_idxs,
|
2635
2542
|
"initial_to_play": self.initial_to_play,
|
2636
|
-
"to_play": self.to_play,
|
2637
|
-
"unit_discards": self.unit_discards,
|
2638
|
-
"num_route_cards": self.num_route_cards,
|
2639
|
-
"num_route_discards": self.num_route_discards,
|
2640
|
-
"num_unit_cards": self.num_unit_cards,
|
2641
|
-
"num_unit_discards": self.num_unit_discards,
|
2642
|
-
"faceup_spots": self.faceup_spots,
|
2643
2543
|
"players": [x.__todict__() for x in self.players],
|
2644
|
-
"player_hands": [x.__todict__() for x in self.player_hands],
|
2645
2544
|
"last_to_play": self.last_to_play,
|
2646
2545
|
"winners": self.winners,
|
2647
2546
|
"terminal": self.terminal,
|
2648
|
-
"captured_points": [x.__todict__() for x in self.captured_points],
|
2649
|
-
"captured_segments": [x.__todict__() for x in self.captured_segments],
|
2650
2547
|
}
|
2651
2548
|
@staticmethod
|
2652
2549
|
def __fromdict__(d):
|
@@ -2670,25 +2567,11 @@ class PublicState(PClass):
|
|
2670
2567
|
piles=[Pile.__fromdict__(x) for x in d["piles"]],
|
2671
2568
|
player_idxs=d["player_idxs"],
|
2672
2569
|
initial_to_play=d["initial_to_play"],
|
2673
|
-
to_play=d["to_play"],
|
2674
|
-
unit_discards=d["unit_discards"],
|
2675
|
-
num_route_cards=d["num_route_cards"],
|
2676
|
-
num_route_discards=d["num_route_discards"],
|
2677
|
-
num_unit_cards=d["num_unit_cards"],
|
2678
|
-
num_unit_discards=d["num_unit_discards"],
|
2679
|
-
faceup_spots=d["faceup_spots"],
|
2680
2570
|
players=[PublicPlayer.__fromdict__(x) for x in d["players"]],
|
2681
|
-
player_hands=[PublicPlayerInfo.__fromdict__(x) for x in d["player_hands"]],
|
2682
2571
|
last_to_play=d.get("last_to_play"),
|
2683
2572
|
winners=d["winners"],
|
2684
2573
|
terminal=d["terminal"],
|
2685
|
-
captured_points=[CapturedPoint.__fromdict__(x) for x in d["captured_points"]],
|
2686
|
-
captured_segments=[CapturedSegment.__fromdict__(x) for x in d["captured_segments"]],
|
2687
2574
|
)
|
2688
|
-
# fig::Fig
|
2689
|
-
# captured_segments::Vector{CapturedSegment}
|
2690
|
-
# captured_points::Vector{CapturedPoint}
|
2691
|
-
# market_refills::Vector{MarketRefill}
|
2692
2575
|
|
2693
2576
|
|
2694
2577
|
class PlayerState(PClass):
|
@@ -3001,9 +2884,6 @@ def getinitialstate(game_config):
|
|
3001
2884
|
route_cards=pvector(route_cards),
|
3002
2885
|
route_discards=pvector([]),
|
3003
2886
|
player_hands=pvector(player_hands),
|
3004
|
-
unit_cards=pvector(unit_cards),
|
3005
|
-
unit_discards=pvector([]),
|
3006
|
-
faceup_spots=pvector(faceup_spots),
|
3007
2887
|
last_to_play=None,
|
3008
2888
|
winners=[],
|
3009
2889
|
terminal=False,
|
@@ -3024,9 +2904,12 @@ def run_state_hooks(state, hooks, log=False):
|
|
3024
2904
|
def run_accept_action_hooks(state, action, hooks, log=False):
|
3025
2905
|
# Just like "run_state_action_hooks", but returns immediately returns True if any hook returns True, otherwise returns False
|
3026
2906
|
for hook in hooks:
|
3027
|
-
|
3028
|
-
|
3029
|
-
|
2907
|
+
is_accepted, reason = run_state_action_hook(state, action, hook, log)
|
2908
|
+
if is_accepted is not None and is_accepted:
|
2909
|
+
return True, reason
|
2910
|
+
elif is_accepted is not None and not is_accepted:
|
2911
|
+
return False, reason
|
2912
|
+
return False, "No hook accepted the action"
|
3030
2913
|
|
3031
2914
|
|
3032
2915
|
def run_state_action_hooks(state, action, hooks, log=False):
|
@@ -3887,19 +3770,19 @@ def append_to_legal_actions(game, legal_action):
|
|
3887
3770
|
|
3888
3771
|
|
3889
3772
|
def default_accept_action(game, action):
|
3890
|
-
if not game or not action or not action.legal_action:
|
3891
|
-
return False
|
3892
3773
|
|
3893
3774
|
# Returns true if action.legal_action is found in game.legal_actions_2
|
3894
3775
|
# The comparision is by value, not by reference
|
3895
3776
|
if action.legal_action not in game.legal_actions_2:
|
3896
|
-
return False
|
3777
|
+
return False, "Action not found in legal actions"
|
3897
3778
|
|
3898
3779
|
# Check if "action.move_pieces_to_path" is not None
|
3899
3780
|
if action.move_pieces_to_path:
|
3900
|
-
|
3781
|
+
is_legal = is_move_pieces_to_path_action_legal(game, action)
|
3782
|
+
if not is_legal:
|
3783
|
+
return False, "Move pieces to path action is not legal"
|
3901
3784
|
|
3902
|
-
return True
|
3785
|
+
return True, "Action is legal"
|
3903
3786
|
|
3904
3787
|
|
3905
3788
|
def is_move_pieces_to_path_action_legal(game, action):
|
@@ -4413,8 +4296,9 @@ def isactionlegal2(s, a):
|
|
4413
4296
|
|
4414
4297
|
|
4415
4298
|
def getnextstate2(s, a, log=False):
|
4416
|
-
|
4417
|
-
|
4299
|
+
is_legal, reason = isactionlegal2(s, a)
|
4300
|
+
if not is_legal:
|
4301
|
+
raise ValueError(f"Action is not legal: {a}. Reason: {reason}")
|
4418
4302
|
s = run_state_action_hooks(s, a, AFTER_ACCEPT_ACTION_HOOKS, log)
|
4419
4303
|
s = run_state_action_hooks(s, a, HANDLE_ACTION_HOOKS, log)
|
4420
4304
|
s = run_state_hooks(s, HANDLE_SCORING_HOOKS, log)
|
@@ -4586,20 +4470,10 @@ def getpublicstate(s):
|
|
4586
4470
|
piles=s.piles,
|
4587
4471
|
player_idxs=s.player_idxs,
|
4588
4472
|
initial_to_play=s.initial_to_play,
|
4589
|
-
to_play=gettoplay(s),
|
4590
|
-
unit_discards=list(s.unit_discards),
|
4591
|
-
num_route_cards=len(s.route_cards),
|
4592
|
-
num_route_discards=len(s.route_discards),
|
4593
|
-
num_unit_cards=len(s.unit_cards),
|
4594
|
-
num_unit_discards=len(s.unit_discards),
|
4595
|
-
faceup_spots=list(s.faceup_spots),
|
4596
4473
|
players=[getpublicplayer(s, p) for p in s.players],
|
4597
|
-
player_hands=[getpublicplayerinfo(s, p) for p in s.player_hands],
|
4598
4474
|
last_to_play=s.last_to_play,
|
4599
4475
|
winners=s.winners,
|
4600
4476
|
terminal=s.terminal,
|
4601
|
-
captured_points=getcapturedpoints(s),
|
4602
|
-
captured_segments=getcapturedsegments(s),
|
4603
4477
|
)
|
4604
4478
|
|
4605
4479
|
|
@@ -4631,31 +4505,6 @@ def getpublicplayer(s, p):
|
|
4631
4505
|
)
|
4632
4506
|
|
4633
4507
|
|
4634
|
-
@dispatch(State, PlayerInfo)
|
4635
|
-
def getpublicplayerinfo(s, p):
|
4636
|
-
# if s.terminal
|
4637
|
-
# route_statuses = getroutestatuses(p)
|
4638
|
-
# else
|
4639
|
-
# route_statuses = []
|
4640
|
-
# end
|
4641
|
-
return PublicPlayerInfo(
|
4642
|
-
final_score=p.final_score,
|
4643
|
-
longest_trail=p.longest_trail,
|
4644
|
-
longest_trail_len=p.longest_trail_len,
|
4645
|
-
num_pieces=p.num_pieces,
|
4646
|
-
num_route_cards=len(p.route_cards),
|
4647
|
-
num_new_route_cards=len(p.new_route_cards),
|
4648
|
-
num_unit_cards=len(p.unit_cards),
|
4649
|
-
paths=p.paths,
|
4650
|
-
points=p.points,
|
4651
|
-
tokens=p.tokens,
|
4652
|
-
route_statuses=[], # TODO: implement!
|
4653
|
-
score=getpublicscore(s, p.player_idx),
|
4654
|
-
num_point_pieces=p.num_point_pieces,
|
4655
|
-
completed_clusters=p.completed_clusters,
|
4656
|
-
)
|
4657
|
-
|
4658
|
-
|
4659
4508
|
# Implementing the following Julia function:
|
4660
4509
|
# function getpublicscore(s::State, player_idx::Int)
|
4661
4510
|
# addends = Int[]
|
@@ -4974,17 +4823,6 @@ def getrouteoptionsets(s, player_idx, min_required):
|
|
4974
4823
|
# min_initial_routes = getsettingvalue(s.fig, :min_initial_routes)
|
4975
4824
|
# min_chosen_routes = getsettingvalue(s.fig, :min_chosen_routes)
|
4976
4825
|
|
4977
|
-
# # Initial Route Card Discard
|
4978
|
-
# if getsettingvalue(s, :action_route_discard) && length(s.action_history) < s.game_config.num_players
|
4979
|
-
# return [
|
4980
|
-
# ActionSpec(
|
4981
|
-
# player_idx=player_idx,
|
4982
|
-
# action_name=ROUTE_DISCARD,
|
4983
|
-
# return_route_option_sets=getrouteoptionsets(s, player_idx, min_initial_routes),
|
4984
|
-
# )
|
4985
|
-
# ]
|
4986
|
-
# end
|
4987
|
-
|
4988
4826
|
# action_specs = ActionSpec[]
|
4989
4827
|
# if getsettingvalue(s, :action_draw_unit_faceup) && !isempty(getvalidspotnums(s))
|
4990
4828
|
# push!(
|
@@ -5994,21 +5832,7 @@ def printaction(a, i):
|
|
5994
5832
|
# )
|
5995
5833
|
# end
|
5996
5834
|
# end
|
5997
|
-
|
5998
|
-
# # Longest trail
|
5999
|
-
# if !getsettingvalue(s, :disable_longest_path_bonus)
|
6000
|
-
# longest_path_score = getsettingvalue(s.fig, :longest_path_score)
|
6001
|
-
# if in(player_idx, s.longest_trail_player_idxs)
|
6002
|
-
# push!(
|
6003
|
-
# breakdown,
|
6004
|
-
# ScoreItem(
|
6005
|
-
# code_idx=getscorecodeidx(s.fig, :LONGEST_ROAD),
|
6006
|
-
# amount=longest_path_score,
|
6007
|
-
# )
|
6008
|
-
# )
|
6009
|
-
# end
|
6010
|
-
# end
|
6011
|
-
|
5835
|
+
#
|
6012
5836
|
# # Completed routes
|
6013
5837
|
# if getsettingvalue(s, :route_scoring)
|
6014
5838
|
# hand = s.player_hands[player_idx]
|
@@ -6241,74 +6065,6 @@ def getlegalactionspecs(s, player_idxs):
|
|
6241
6065
|
return legal_actions
|
6242
6066
|
|
6243
6067
|
|
6244
|
-
# Implementing the following Julia function:
|
6245
|
-
# function getcapturedsegments(s::State)
|
6246
|
-
# (; fig) = s
|
6247
|
-
# (; board_config) = fig
|
6248
|
-
# public_player_hands = PublicPlayerInfo.(s, s.player_hands)
|
6249
|
-
# (; board_paths) = board_config
|
6250
|
-
# captured_segments = CapturedSegment[]
|
6251
|
-
# for (player_num, player_hand) in enumerate(public_player_hands)
|
6252
|
-
# for path_num in player_hand.paths
|
6253
|
-
# link_path = board_paths[path_num].path
|
6254
|
-
# for segment in link_path.segments
|
6255
|
-
# captured_segment = CapturedSegment(
|
6256
|
-
# player_num,
|
6257
|
-
# segment.uuid,
|
6258
|
-
# )
|
6259
|
-
# push!(captured_segments, captured_segment)
|
6260
|
-
# end
|
6261
|
-
# end
|
6262
|
-
# end
|
6263
|
-
# captured_segments
|
6264
|
-
# end
|
6265
|
-
@dispatch(State)
|
6266
|
-
def getcapturedsegments(s):
|
6267
|
-
public_player_hands = [getpublicplayerinfo(s, p) for p in s.player_hands]
|
6268
|
-
board_paths = s.game_config.fig.board_config.board_paths
|
6269
|
-
captured_segments = []
|
6270
|
-
for player_idx, player_hand in enumerate(public_player_hands):
|
6271
|
-
for path_idx in player_hand.paths:
|
6272
|
-
link_path = board_paths[path_idx].path
|
6273
|
-
for segment in link_path.segments:
|
6274
|
-
captured_segment = CapturedSegment(
|
6275
|
-
player_num=(player_idx+1),
|
6276
|
-
segment_uuid=segment.uuid,
|
6277
|
-
)
|
6278
|
-
captured_segments.append(captured_segment)
|
6279
|
-
return captured_segments
|
6280
|
-
|
6281
|
-
|
6282
|
-
# Implementing the following Julia function:
|
6283
|
-
# function getcapturedpoints(s::State)
|
6284
|
-
# (; fig) = s
|
6285
|
-
# public_player_hands = PublicPlayerInfo.(s, s.player_hands)
|
6286
|
-
# captured_points = CapturedPoint[]
|
6287
|
-
# for (player_num, player_hand) in enumerate(public_player_hands)
|
6288
|
-
# for point_uuid in player_hand.points
|
6289
|
-
# captured_point = CapturedPoint(
|
6290
|
-
# player_num,
|
6291
|
-
# point_uuid,
|
6292
|
-
# )
|
6293
|
-
# push!(captured_points, captured_point)
|
6294
|
-
# end
|
6295
|
-
# end
|
6296
|
-
# captured_points
|
6297
|
-
# end
|
6298
|
-
@dispatch(State)
|
6299
|
-
def getcapturedpoints(s):
|
6300
|
-
public_player_hands = [getpublicplayerinfo(s, p) for p in s.player_hands]
|
6301
|
-
captured_points = []
|
6302
|
-
for player_idx, player_hand in enumerate(public_player_hands):
|
6303
|
-
for point_uuid in player_hand.points:
|
6304
|
-
captured_point = CapturedPoint(
|
6305
|
-
player_num=player_idx+1,
|
6306
|
-
point_uuid=point_uuid,
|
6307
|
-
)
|
6308
|
-
captured_points.append(captured_point)
|
6309
|
-
return captured_points
|
6310
|
-
|
6311
|
-
|
6312
6068
|
def json_serializer(obj):
|
6313
6069
|
if isinstance(obj, set):
|
6314
6070
|
return list(obj)
|
@@ -6552,9 +6308,9 @@ def get_imagined_state(static_board_config, player_state):
|
|
6552
6308
|
remove_card_idx(to_mutate, card_idx)
|
6553
6309
|
|
6554
6310
|
|
6555
|
-
imagined_route_card_idxs = rng.sample(possible_route_card_idxs, public_state.num_route_cards)
|
6311
|
+
# imagined_route_card_idxs = rng.sample(possible_route_card_idxs, public_state.num_route_cards)
|
6556
6312
|
remove_card_idxs(possible_route_card_idxs, imagined_route_card_idxs)
|
6557
|
-
imagined_route_discard_idxs = rng.sample(possible_route_card_idxs, public_state.num_route_discards)
|
6313
|
+
# imagined_route_discard_idxs = rng.sample(possible_route_card_idxs, public_state.num_route_discards)
|
6558
6314
|
remove_card_idxs(possible_route_card_idxs, imagined_route_discard_idxs)
|
6559
6315
|
|
6560
6316
|
imagined_route_cards = [x+1 for x in imagined_route_card_idxs]
|
@@ -6566,9 +6322,9 @@ def get_imagined_state(static_board_config, player_state):
|
|
6566
6322
|
for unit_card in my_hand.unit_cards:
|
6567
6323
|
remove_card_idx(possible_unit_card_idxs, unit_card-1)
|
6568
6324
|
|
6569
|
-
imagined_unit_card_idxs = rng.sample(possible_unit_card_idxs, public_state.num_unit_cards)
|
6570
|
-
imagined_unit_cards = [x+1 for x in imagined_unit_card_idxs]
|
6571
|
-
remove_card_idxs(possible_unit_card_idxs, imagined_unit_card_idxs)
|
6325
|
+
# imagined_unit_card_idxs = rng.sample(possible_unit_card_idxs, public_state.num_unit_cards)
|
6326
|
+
# imagined_unit_cards = [x+1 for x in imagined_unit_card_idxs]
|
6327
|
+
# remove_card_idxs(possible_unit_card_idxs, imagined_unit_card_idxs)
|
6572
6328
|
|
6573
6329
|
|
6574
6330
|
imagined_player_hands = []
|
@@ -6577,10 +6333,10 @@ def get_imagined_state(static_board_config, player_state):
|
|
6577
6333
|
if player_idx == my_hand.player_idx:
|
6578
6334
|
imagined_player_hands.append(PlayerInfo.clone(my_hand))
|
6579
6335
|
else:
|
6580
|
-
imagined_player_unit_card_idxs = rng.sample(possible_unit_card_idxs, public_player_info.num_unit_cards)
|
6336
|
+
# imagined_player_unit_card_idxs = rng.sample(possible_unit_card_idxs, public_player_info.num_unit_cards)
|
6581
6337
|
imagined_player_unit_cards = [x+1 for x in imagined_player_unit_card_idxs]
|
6582
6338
|
remove_card_idxs(possible_unit_card_idxs, imagined_player_unit_card_idxs)
|
6583
|
-
imagined_player_route_card_idxs = rng.sample(possible_route_card_idxs, public_player_info.num_route_cards)
|
6339
|
+
# imagined_player_route_card_idxs = rng.sample(possible_route_card_idxs, public_player_info.num_route_cards)
|
6584
6340
|
remove_card_idxs(possible_route_card_idxs, imagined_player_route_card_idxs)
|
6585
6341
|
imagined_player_new_route_card_idxs = rng.sample(possible_route_card_idxs, public_player_info.num_new_route_cards)
|
6586
6342
|
remove_card_idxs(possible_route_card_idxs, imagined_player_new_route_card_idxs)
|
@@ -1,9 +1,9 @@
|
|
1
1
|
graph_games_proto/__init__.py,sha256=O5XjRfe3DlxbJn4zezDvvy7cXvL4IzIRPZCL3Y-n7s8,776
|
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=5BJ0dY9mk4e0hoMBdyJyxsEvPvy8bFgP4vtdCtrnoKY,232658
|
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.1866.dist-info/METADATA,sha256=NyOtxe3kFzamm50WU8vuNk9VdjbnbuoQkgWnZNAZPm8,188
|
7
|
+
graph_games_proto-0.3.1866.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
8
|
+
graph_games_proto-0.3.1866.dist-info/top_level.txt,sha256=-4QSrBMf_MM4BGsr2QXBpqDx8c8k_OPnzGyFjqjakes,18
|
9
|
+
graph_games_proto-0.3.1866.dist-info/RECORD,,
|
File without changes
|
File without changes
|