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.
This commit is contained in:
Chris Proctor
2025-12-19 15:38:03 -05:00
parent 95ae6740d3
commit b8e92eedcf
7 changed files with 265 additions and 0 deletions

20
chris_demo/deck.py Normal file
View File

@@ -0,0 +1,20 @@
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