-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbridge.pyi
More file actions
258 lines (222 loc) · 7.65 KB
/
Copy pathbridge.pyi
File metadata and controls
258 lines (222 loc) · 7.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
"""
A stub file for bridge library.
"""
from enum import IntEnum
from typing import Dict, List, Tuple, Optional, overload
Player = int
Action = int
class Seat(IntEnum):
NORTH = ...
EAST = ...
SOUTH = ...
WEST = ...
class Denomination(IntEnum):
INVALID_DENOMINATION = ...
CLUBS_TRUMP = ...
DIAMONDS_TRUMP = ...
HEARTS_TRUMP = ...
SPADES_TRUMP = ...
NO_TRUMP = ...
class Suit(IntEnum):
INVALID_SUIT = ...
CLUBS_SUIT = ...
DIAMONDS_SUIT = ...
HEARTS_SUIT = ...
SPADES_SUIT = ...
class OtherCalls(IntEnum):
NOT_OTHER_CALL = ...
PASS = ...
DOUBLE = ...
REDOUBLE = ...
class DoubleStatus(IntEnum):
UNDOUBLED = ...
DOUBLED = ...
REDOUBLED = ...
class Contract:
level: int
denomination: Denomination
double_status: DoubleStatus
declarer: Player
def index(self) -> int: ...
def score(contract: Contract, declarer_tricks: int, is_vulnerable: bool) -> int: ...
def bid_index(level: int, denomination: Denomination) -> int: ...
def bid_level(bid_: int) -> int: ...
def bid_denomination(bid_: int) -> int: ...
def call_string(call: int) -> str: ...
def card_suit(card: int) -> int: ...
def card_rank(card: int) -> int: ...
def card_string(card: int) -> str: ...
def card_index(suit: int, rank: int) -> int: ...
def partnership(player: Player) -> int: ...
def partner(player: Player) -> int: ...
example_deals: List[List[int]]
example_ddts: List[List[int]]
NUM_PLAYERS: int
NUM_DENOMINATIONS: int
NUM_CARDS: int
NUM_BID_LEVELS: int
NUM_BIDS: int
NUM_CALLS: int
NUM_OTHER_CALLS: int
NUM_SUITS: int
NUM_DOUBLE_STATUS: int
NUM_PARTNERSHIPS: int
NUM_CARDS_PER_SUIT: int
NUM_CARDS_PER_HAND: int
NUM_CONTRACTS: int
NUM_VULNERABILITIES: int
NUM_TRICKS: int
BIDDING_ACTION_BASE: int
class BridgeCard:
def __init__(self, suit: int, rank: int): ...
def is_valid(self) -> bool: ...
def suit(self) -> int: ...
def rank(self) -> int: ...
def index(self) -> int: ...
class BridgeHand:
def __init__(self): ...
def cards(self) -> List[BridgeCard]: ...
def add_card(self, card: BridgeCard): ...
def remove_from_hand(
self, suit: Suit, rank: int, played_cards: List[BridgeCard]
): ...
def is_full_hand(self) -> bool: ...
def high_card_points(self) -> int: ...
def control_value(self) -> int: ...
def zar_high_card_points(self) -> int: ...
def is_card_in_hand(self, card: BridgeCard) -> bool: ...
def cards_by_suits(self) -> List[List[BridgeCard]]: ...
class MoveType(IntEnum):
INVALID = ...
AUCTION = ...
PLAY = ...
DEAL = ...
class BridgeMove:
@overload
def __init__(self): ...
@overload
def __init__(self, level: int, denomination: Denomination): ...
@overload
def __init__(self, move_type: MoveType, suit: Suit, rank: int): ...
@overload
def __init__(self, other_call: OtherCalls): ...
def move_type(self) -> MoveType: ...
def is_bid(self) -> bool: ...
def bid_level(self) -> int: ...
def bid_denomination(self) -> Denomination: ...
def card_suit(self) -> Suit: ...
def card_rank(self) -> int: ...
def other_call(self) -> OtherCalls: ...
class BridgeHistoryItem:
move: BridgeMove
player: Player
deal_to_player: Player
suit: Suit
rank: int
level: int
denomination: Denomination
other_call: OtherCalls
class BridgeGame:
def __init__(self, params: Dict[str, str]):
"""
A bridge game.
Acceptable parameters:
"is_dealer_vulnerable": Whether the dealer side is vulnerable. (default false).
"is_non_dealer_vulnerable": Whether the non-dealer side is vulnerable. (default false).
"dealer": The dealer of the game, first player to make a call in auction phase.
"seed": Pseudo-random number generator seed. (default -1)
Args:
params: A dict of parameters.
"""
def num_distinct_actions(self) -> int: ...
def max_chance_outcomes(self) -> int: ...
def max_utility(self) -> int: ...
def min_utility(self) -> int: ...
def max_game_length(self) -> int: ...
def min_game_length(self) -> int: ...
def parameters(self) -> Dict[str, str]: ...
def new_initial_state(self) -> BridgeState: ...
def is_dealer_vulnerable(self) -> bool: ...
def is_non_dealer_vulnerable(self) -> bool: ...
def is_player_vulnerable(self) -> bool: ...
def is_partnership_vulnerable(self) -> bool: ...
def dealer(self) -> Player: ...
def get_move(self, uid: int) -> BridgeMove: ...
def get_chance_outcome(self, uid: int) -> BridgeMove: ...
def pick_random_chance(
self, chance_outcomes: Tuple[List[BridgeMove], List[float]]
) -> BridgeMove: ...
def get_move_uid(self, move: BridgeMove) -> int: ...
default_game: BridgeGame
class Phase(IntEnum):
DEAL = ...
AUCTION = ...
PLAY = ...
GAME_OVER = ...
class BridgeState:
def __init__(self, game: BridgeGame): ...
def hands(self) -> List[BridgeHand]: ...
def history(self) -> List[BridgeHistoryItem]: ...
def current_player(self) -> Player: ...
def apply_move(self, move: BridgeMove): ...
def move_is_legal(self, move: BridgeMove) -> bool: ...
def is_terminal(self) -> bool: ...
def parent_game(self) -> BridgeGame: ...
def chance_outcome_prob(self, move: BridgeMove) -> float: ...
def apply_random_chance(self): ...
def current_phase(self) -> Phase: ...
def num_declarer_tricks(self) -> int: ...
@overload
def legal_moves(self, player: Player) -> List[BridgeMove]: ...
@overload
def legal_moves(self) -> List[BridgeMove]: ...
def score_for_contracts(
self, player: Player, contracts: List[int]
) -> List[int]: ...
def double_dummy_results(self, dds_order=False) -> List[List[int]]: ...
def uid_history(self) -> List[int]: ...
def is_chance_node(self) -> bool: ...
def num_cards_played(self) -> int: ...
def clone(self) -> BridgeState: ...
def scores(self) -> List[int]: ...
def get_contract(self) -> Contract: ...
def deal_history(self) -> List[BridgeHistoryItem]: ...
def auction_history(self) -> List[BridgeHistoryItem]: ...
def play_history(self) -> List[BridgeHistoryItem]: ...
def is_dummy_acting(self) -> bool: ...
def get_dummy(self) -> int: ...
class BridgeObservation:
@overload
def __init__(self, state: BridgeState, observing_player: Player): ...
@overload
def __init__(self, state: BridgeState): ...
def cur_player_offset(self) -> int: ...
def auction_history(self) -> List[BridgeHistoryItem]: ...
def hands(self) -> List[BridgeHand]: ...
def parent_game(self) -> BridgeGame: ...
def legal_moves(self) -> List[BridgeMove]: ...
def is_player_vulnerable(self) -> bool: ...
def is_opponent_vulnerable(self) -> bool: ...
class ObservationEncoder: ...
class EncoderType(IntEnum):
CANONICAL = ...
class CanonicalEncoder(ObservationEncoder):
def __init__(self, game: BridgeGame): ...
def shape(self) -> List[int]: ...
def encode(self, obs: BridgeObservation) -> List[int]: ...
def type(self) -> EncoderType: ...
class PBEEncoder(ObservationEncoder):
def __init__(self, game: BridgeGame) -> None: ...
def shape(self) -> List[int]: ...
def encode(self, obs: BridgeObservation) -> List[int]:...
def type(self)->EncoderType:...
class JPSEncoder(ObservationEncoder):
def __init__(self, game: BridgeGame) -> None: ...
def shape(self) -> List[int]: ...
def encode(self, obs: BridgeObservation) -> List[int]: ...
def type(self) -> EncoderType: ...
def get_imp(score1: int, score2: int) -> int: ...
ALL_SUITS: List[Suit]
ALL_DENOMINATIONS: List[Denomination]
ALL_SEATS: List[Seat]
default_game_params : Dict[str, str]