-
Notifications
You must be signed in to change notification settings - Fork 0
/
q3.py
48 lines (44 loc) · 2.46 KB
/
q3.py
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
"""Project 3 Q3."""
from classes import Player, Table
def phasedout_is_valid_play(play, player_id, table, turn_history, phase_status,
hand, discard):
"""phasedout_is_valid_play returns validity of "play" given game status."""
curr_player = Player(player_id, phase_status[player_id], hand)
stats = Table(table, turn_history, phase_status, discard)
return stats.check_play(play, curr_player)
if __name__ == '__main__':
# Example calls to the function.
print(phasedout_is_valid_play((3, [['2S', '2S', '2C'],
['AS', '5S', '5S']]),
0,
[(None, []), (None, []),
(None, []), (None, [])],
[(0, [(2, 'JS')])],
[0, 0, 0, 0], ['AS', '2S', '2S', '2C',
'5S', '5S', '7S', '8S',
'9S', '0S', 'JS'],
None))
print(phasedout_is_valid_play((4, ('KC', (1, 0, 0))),
1,
[(None, []), (2, [['2S', '2S', 'AS', '5S',
'5S', '7S', 'JS']]),
(None, []), (None, [])],
[(0, [(2, 'JS'), (5, 'JS')]),
(1, [(1, 'XX'), (3, [['2S', '2S', 'AS',
'5S', '5S', '7S',
'JS']])])],
[0, 2, 0, 0],
['5D', '0S', 'JS', 'KC'],
'0H'))
print(phasedout_is_valid_play((5, 'JS'),
1,
[(None, []), (1, [['2S', '2S', '2C'],
['AS', '5S', '5S']]),
(None, []), (None, [])],
[(0, [(2, 'JS'), (5, 'JS')]),
(1, [(1, 'XX'),
(3, [['2S', '2S', '2C'],
['AS', '5S', '5S']])])],
[0, 1, 0, 0],
['AD', '8S', '9S', '0S', 'JS'],
'3C'))