Files
Chris Proctor b8e92eedcf added demo game in chris_demo
You had some really clear planning in your commit message--
In the "chris_demo" folder I implemented a bunch of what
you planned. I suggest playing the game I built
(go into chris_demo and run python game.py), and then
carefully reading all the source code. Then, if you like
the patterns I used, copy or move whatever you want
to use into your main project folder. Also, if there
are parts of my code you don't understand, please let
me know (in a commit message or in person next time
I'm in class) and I'll be happy to explain it.
2025-12-19 15:38:03 -05:00

21 lines
506 B
Python

from card import Card
from random import shuffle
class Deck:
def __init__(self, position, hidden=True, shuffled=True):
self.position = position
self.cards = [Card(position, i, hidden=hidden) for i in range(52)]
if shuffled:
shuffle(self.cards)
def draw(self):
return self.cards.pop()
def get_agents(self):
agents = []
for card in self.cards:
agents.append(card)
agents += card.agents
return agents