-
Notifications
You must be signed in to change notification settings - Fork 0
/
table_schedule.py
84 lines (78 loc) · 2.92 KB
/
table_schedule.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
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
from classes import Table, Bank, Player, Deck
from rules import shuffle_cards
# THIS FUNCTION CREATE TABLES ACCORDING TO THE NR OF PLAYER BY ARITHMETIC // AND % OPERATORS FOR REMINDER AND QUOTIENT
def create_tables(num_of_tables, num):
tables = []
i = 0
while i+1 <= num_of_tables:
table = Table()
bank = Bank()
if i + 1 is num_of_tables:
if num%3 == 0:
for m in range(3):
print("Insert the name of player {}".format(i*3 + m + 1))
name = input()
player = Player()
player.name = name
deck = Deck()
player.decks.append(deck)
table.players.append(player)
table.hand = shuffle_cards()
table.id = i + 1
bank.name = "Bank"
bank.status = False
table.bank = bank
tables.append(table)
if (i*3 + m + 1) == num:
break
if (num-i*3)%2 == 0 and (num-i*3)//2 == 1:
for m in range(2):
print("Insert the name of player {}".format(i*3 + m + 1))
name = input()
player = Player()
player.name = name
deck = Deck()
player.decks.append(deck)
table.players.append(player)
table.hand = shuffle_cards()
table.id = i + 1
bank.name = "Bank"
bank.status = False
table.bank = bank
tables.append(table)
if i*3 + m + 1 == num:
break
if ((num-3*i)//1) == 1:
for m in range(1):
print("Insert the name of player {}".format(i*3 + m + 1))
name = input()
player = Player()
player.name = name
deck = Deck()
player.decks.append(deck)
table.players.append(player)
table.hand = shuffle_cards()
table.id = i + 1
bank.name = "Bank"
bank.status = False
table.bank = bank
tables.append(table)
if (i*3 + m + 1) == num:
break
else:
for m in range(3):
print("Insert the name of player {}".format(i*3 + m + 1))
name = input()
player = Player()
player.name = name
deck = Deck()
player.decks.append(deck)
table.players.append(player)
table.hand = shuffle_cards()
table.id = i + 1
bank.name = "Bank"
bank.status = False
table.bank = bank
tables.append(table)
i = i + 1
return tables