-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgame_state.py
More file actions
63 lines (50 loc) · 1.99 KB
/
game_state.py
File metadata and controls
63 lines (50 loc) · 1.99 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
import random
class Number:
def apply(self, player, game_state):
player.number_cards_drawn.append(game_state.card["Value"])
class Freeze:
def apply(self, player, game_state):
player.is_turn_over = True
# TODO: Apply freeze to other player.
class SecondChance:
def apply(self, player, game_state):
player.second_chance = True
class FlipThree:
def apply(self, player, game_state):
pass
# TODO: Create the flip three function.
class Modifier:
def apply(self, player, game_state):
player.score += int(game_state.card["Value"][1])
class Multiplier:
def apply(self, player, game_state):
player.multiplier = 2
class GameState:
def __init__(self):
self.player_score = 0
self.npc_score = 0
self.is_game_over = False
self.discard_pile = []
self.deck = []
self.card = ""
def create_deck(self):
# Generates a standard Flip7 deck with number cards 1 - 12, point modifiers, multiplier, and action cards.
deck = []
# Add the 78 number cards to the deck.
for i in range (1, 13):
for j in range (1, i):
deck.append({"Type": Number(), "Value": i})
# Add the nine action cards to the deck.
for i in range (1, 4):
deck.append({"Type": Freeze(), "Value": "FREEZE!"})
deck.append({"Type": SecondChance(), "Value": "SECOND CHANCE!"})
deck.append({"Type": FlipThree(), "Value": "FLIP THREE!"})
# Add the five additive point modifier cards and one multiplier point modifier card to the deck.
deck.append({"Type": Modifier(), "Value": "+2"})
deck.append({"Type": Modifier(), "Value": "+4"})
deck.append({"Type": Modifier(), "Value": "+6"})
deck.append({"Type": Modifier(), "Value": "+8"})
deck.append({"Type": Modifier(), "Value": "+10"})
deck.append({"Type": Multiplier(), "Value": "x2"})
random.shuffle(deck)
return deck