Files
project_game/roll.py
2025-08-19 08:29:03 -04:00

51 lines
1.4 KiB
Python

from retro.game import Game
from random import randint
import config
class Die:
#rolls a die and returns the result for display
color = "white_on_black"
def __init__(self, position, name):
self.position = position
self.name = name
self.roll_die()
def __str__(self):
return str(self.face)
def roll_die(self):
self.face = randint(1, 6)
self.character = str(self.face)
class Roller:
display = False
def handle_keystroke(self, keystroke, game):
if keystroke == " ":
die1 = game.get_agent_by_name("die1")
die1.roll_die()
die2 = game.get_agent_by_name("die2")
die2.roll_die()
die3 = game.get_agent_by_name("die3")
die3.roll_die()
"""
three_dice = [1,3,4]
roll_score = score.RollScore().get_score(three_dice, game.state['Current Round'])
print (roll_score)
if roll_score < 21:
#is the round over?
if game.state['Current Team'] == 1:
#Add the score for the roll to the approriate team
game.state['Blue Team Score'] += roll_score
else:
game.state['Red Team Score'] += roll_score
else:
game.end()"""