Kennedy Parker
🎨𝖆𝖗𝖙𝖎𝖘𝖙🎨
- Joined
- Jul 9, 2015
- Posts
- 35,889
- Reaction score
- 84,826
- Location
- The Office 💼
- AFL Club
- Sydney
- Other Teams
- Rabbitohs
Some added documentation
I've added the variable transCount under the class of 'sim_game' which is essentially a counter between a reset of play i.e. to start the quarter or after a goal to return the ball to centre for the ruck contest.
PlayBook() defines the function of the various plays I've added into the code and their respective effects on the movement of the ball
Generate_Play() invokes instances of PlayBook(), it makes the play go to a hitout if transCount = 0 i.e. play has reset or randomises according to a discrete probability distribution.
Full code: https://www.dropbox.com/s/zckpgkewi5og8cr/9_OCT.txt?dl=0
I've added the variable transCount under the class of 'sim_game' which is essentially a counter between a reset of play i.e. to start the quarter or after a goal to return the ball to centre for the ruck contest.
PlayBook() defines the function of the various plays I've added into the code and their respective effects on the movement of the ball
Generate_Play() invokes instances of PlayBook(), it makes the play go to a hitout if transCount = 0 i.e. play has reset or randomises according to a discrete probability distribution.
Python:
class sim_game(object):
game_minutes = 0
game_seconds = 0
QTR = 1
speed = 8
homeTeam = "Home Sample"
homeTeamShort = "HOM"
home_goals = 0
home_behinds = 0
home_score = 0
awayTeam = "Away Sample"
awayTeamShort = "AWY"
away_goals = 0
away_behinds = 0
away_score = 0
play_posLine = 0
play_posCol = 0
[B]transCount = 0[/B]
def GamePlayTime():
if sim_game.QTR <= 4 and sim_game.game_minutes <= 25:
global match_status
match_status = "In Progress"
sim_game.game_seconds += sim_game.speed
pygame.time.delay(100)
else:
match_status = "Finished"
if sim_game.game_seconds >= 60:
sim_game.game_minutes += 1
sim_game.game_seconds -= 60
if sim_game.game_minutes >= 25:
sim_game.QTR += 1
sim_game.game_minutes = 0
sim_game.game_seconds = 0
sim_game.play_posLine = 0
sim_game.play_posCol = 0
sim_game.transCount = 0
def PlayBook(play_type, movement):
comm_display = myfont_game.render(play_type, 1, White)
win.blit(comm_display, (30, 360))
if possession == "Home":
sim_game.play_posLine += movement
elif possession == "Away":
sim_game.play_posLine -= movement
def Generate_Play():
if sim_game.transCount == 0:
sim_game.PlayBook("HITOUT", 0)
else:
rand_direction = random.randint(0,1)
movementRoll = random.randint(1,100)
if movementRoll > 45:
Play_A = sim_game.PlayBook("Hold up Play", 0)
elif 30 < movementRoll <= 45:
Play_B = sim_game.PlayBook("Short Kick", rand_direction)
elif 15 < movementRoll <= 30:
Play_C = sim_game.PlayBook("Handball", rand_direction)
elif 8 < movementRoll <= 15:
Play_D = sim_game.PlayBook("Run And Bounce", 1)
elif 3 < movementRoll <= 8:
Play_E = sim_game.PlayBook("Long Kick", 2)
else:
Play_F = sim_game.PlayBook("TORP", 3)
Full code: https://www.dropbox.com/s/zckpgkewi5og8cr/9_OCT.txt?dl=0



