Remove this Banner Ad

Sim Sim update planning

🥰 Love BigFooty? Join now for free.

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.

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
 
That's correct for my approach too, but there are two different concepts of time. That's why I had both a Speed and a Game Pace option.
- One is how fast the game runs in-game (eg how many transactions occur) (in Qooty, weather is another factor affecting this)
- The other is how fast the display runs through these transactions, for the visual experience. Just a coding delay between each, to make it watchable (similar to running your video at 2x or 0.5x speed).
In this particular context, when I say speed of the game it refers to the game pace which initially made each team score 400 points until I made it significantly likely that the ball does not advance forward.

The display speed I believe I do have a time delay input so its watchable for me, but I won't be sure of how well it works until later when others beta test it.
 
A random thought I had based on your discussion - it would be interesting if captains could nominate a play style (defensive, forward press, balanced, etc) and the game would play out based on those preferences.
 
A random thought I had based on your discussion - it would be interesting if captains could nominate a play style (defensive, forward press, balanced, etc) and the game would play out based on those preferences.
Could make for an interesting dynamic if certain styles match up better than others. Would be quite complicated to adjust probabilities though
 

Log in to remove this Banner Ad

Could make for an interesting dynamic if certain styles match up better than others. Would be quite complicated to adjust probabilities though
For sure. I'm putting that well and truly in the pipe dream category. I just thought I'd raise it because I'm thoroughly enjoying your interactions with Mobbs and the thought came to mind.
 
The flow was :
1. The guy gets the ball.
2. The guy has the ball.
3. The guy either uses or loses the ball.
4. goto 1
Is my interpretation correct that there is no dice roll occurring in 1 or 2 and its simply a print function coupled with an addition to the time elapsed? Only on 3 does a random variable get selected
 
Is my interpretation correct that there is no dice roll occurring in 1 or 2 and its simply a print function coupled with an addition to the time elapsed? Only on 3 does a random variable get selected
From memory :
1. The guy gets the ball. <-- dice roll (takes mark, outmarked, free kick, etc)
2. The guy has the ball. <-- no dice roll
3. The guy either uses or loses the ball. <-- dice roll (free kick against, etc)
4. goto 1
 
Dabbled with incorporating boundary throw-ins by adding in another rank file at the end of each of the lateral ranks like Barrybran suggested

If it's -1, 0, and 1 are in-play. If it goes to -2 or 2 while in general play it just takes it to a ruck contest at the nearest field position i.e. left wing if it goes over the left boundary in the center line

If it's goes out of bounds while a shot at goal then its out of bounds on the full and no score which is currently not possible.

In a test run it didn't seem to cause much disruption

1570982229245.png
 
Making a leap in complexity now.

Incorporated boundary throw-ins and out-on-the-full with the IF statements regarding the sim_game.left_throwIn/sim_game.right_thrownIn variables when the ball travels outside of the wings as represented by -1 and 1. When it's concurrently beyond the goal-posts and outside of the wings its an out-on-the-full and turnover from the back pocket.

Python:
    def GamePlayBallPos():   
        play_restart = None
        
        if sim_game.play_posCol < -1:
            sim_game.left_throwIn = True
            sim_game.play_posCol = -1
            #print("Left Boundary Throw In")
            sim_game.transType = "Contest"
        elif sim_game.play_posCol > 1:
            sim_game.right_throwIn = True
            sim_game.play_posCol = 1
            #print("Right Boundary Throw In")
            sim_game.transType = "Contest"
        else:
            sim_game.left_throwIn = False
            sim_game.right_throwIn = False
        
        if sim_game.play_posLine >= 3:
            if sim_game.left_throwIn:
                sim_game.play_posCol = -1
                sim_game.possession = "Away"
                #print("Out on Full")

            elif sim_game.right_throwIn:
                sim_game.play_posCol = 1
                sim_game.possession = "Away"
                #print("Out on Full")

            else:
                shotRollHome = random.randint(0,1)
                if shotRollHome == 0:
                    sim_game.home_behinds += 1
                    sim_game.play_posLine = 2
                    sim_game.kickIn = True
                    sim_game.possession = "Away"

                elif shotRollHome == 1:
                    sim_game.home_goals += 1
                    play_restart = True

        if sim_game.play_posLine <= -3:
            if sim_game.left_throwIn:
                sim_game.play_posCol = -1
                sim_game.possession = "Home"
                #print("Out on Full")

            elif sim_game.right_throwIn:
                sim_game.play_posCol = 1
                sim_game.possession = "Home"
                #print("Out on Full")

            else:
                shotRollAway = random.randint(0,1)
                if shotRollAway == 0:
                    sim_game.away_behinds += 1
                    sim_game.play_posLine = -2
                    sim_game.kickIn = True
                    sim_game.possession = "Home"

                elif shotRollAway == 1:
                    sim_game.away_goals += 1
                    play_restart = True
        
        sim_game.transCount += 1
        
        if play_restart:
            sim_game.play_posLine = 0
            sim_game.play_posCol = 0
            sim_game.transCount = 0
            sim_game.transType = "Contest"

        sim_game.home_score = sim_game.home_goals * 6 + sim_game.home_behinds
        sim_game.away_score = sim_game.away_goals * 6 + sim_game.away_behinds
        
        #print(sim_game.transCount)
 
Instead of one type of dice-rolls, I've incorporated a sort of flow to the play with 3 different types of dice rolls :

Rich (BB code):
    def Generate_Play_contest():
        sim_game.speed = 5
        global possession
        if not sim_game.kickIn:
            if sim_game.possession == "None":
                possessionRoll = random.randint(0,1)       
                if possessionRoll == 0:
                    sim_game.possession = "Home"
                elif possessionRoll == 1:
                    sim_game.possession = "Away"
            sim_game.transType = "Defending"
        else:
            sim_game.transType = "Carrying"
            sim_game.kickIn = False

Generate_Play_contest() function represents the first which is a relatively straightforward roll where it's a 50-50 toss-up between whether the home team or away team wins possession. Once it's completed the roll type changes to one relating to the defensive player in line :

__> sim_game.transType = "Defending"

If it is a kick-in following a behind, a CONTEST roll will not occur and the play skips straight to the state of the player carrying the ball since a kick in situation is not contested.

Rich (BB code):
    def Generate_Play_defender():
        sim_game.speed = 3
        if sim_game.possession == "Home":
            turnoverRoll = random.randint(1,10)
            if turnoverRoll <= 2:
                sim_game.possession = "None"
                sim_game.transType = "Contest"
            elif 2 < turnoverRoll <= 5:
                sim_game.possession = "Away"
                sim_game.transType = "Defending"
            else:
                sim_game.possession = "Home"
                sim_game.transType = "Carrying"
        
        elif sim_game.possession == "Away":
            turnoverRoll = random.randint(1,10)
            if turnoverRoll <= 3:
                sim_game.possession = "None"
                sim_game.transType = "Contest"
            elif 3 < turnoverRoll <= 5:
                sim_game.possession = "Home"
                sim_game.transType = "Defending"
            else:
                sim_game.possession = "Away"
                sim_game.transType = "Carrying"
        else:
            sim_game.transType = "Contest"

Generate_Play_defender() function represents a DEFENCE roll on whether the defending player causes a turnover or not, or the ball carrier simply loses the ball without making a play.
  • A 20% chance of the ball spilling free => the next play reverts to a CONTEST roll so it's 50-50 again
  • A 30% chance of the ball being turned over => opposition now has the ball and the next play is a DEFENCE roll since the other team will scramble to get the ball back before it clears the area
  • A 50% chance of the ball carrier actually getting free and being able to make a play => the next play will progress to CARRIER roll which will actually entail the ball going somewhere
 
Full relevant block of code
Python:
    def PlayBook(play_type, movement, Max_lateralDist):
        if sim_game.possession == "Home":
            sim_game.play_posLine += movement
            Dir_lateral = random.randint(-1,1)
            sim_game.play_posCol += Dir_lateral * random.randint(0, Max_lateralDist)
        elif sim_game.possession == "Away":
            sim_game.play_posLine -= movement
            Dir_lateral = random.randint(-1,1)
            sim_game.play_posCol += Dir_lateral * random.randint(0, Max_lateralDist)
        global access_playType
        access_playType = play_type
    #
#types of dicerolls

    def Generate_Play_contest():
        sim_game.speed = 5
        global possession
        if not sim_game.kickIn:
            if sim_game.possession == "None":
                possessionRoll = random.randint(0,1)       
                if possessionRoll == 0:
                    sim_game.possession = "Home"
                elif possessionRoll == 1:
                    sim_game.possession = "Away"
            sim_game.transType = "Defending"
        else:
            sim_game.transType = "Carrying"
            sim_game.kickIn = False
    
    def Generate_Play_defender():
        sim_game.speed = 3
        if sim_game.possession == "Home":
            turnoverRoll = random.randint(1,10)
            if turnoverRoll <= 2:
                sim_game.possession = "None"
                sim_game.transType = "Contest"
            elif 2 < turnoverRoll <= 5:
                sim_game.possession = "Away"
                sim_game.transType = "Defending"
            else:
                sim_game.possession = "Home"
                sim_game.transType = "Carrying"
        
        elif sim_game.possession == "Away":
            turnoverRoll = random.randint(1,10)
            if turnoverRoll <= 3:
                sim_game.possession = "None"
                sim_game.transType = "Contest"
            elif 3 < turnoverRoll <= 5:
                sim_game.possession = "Home"
                sim_game.transType = "Defending"
            else:
                sim_game.possession = "Away"
                sim_game.transType = "Carrying"
        else:
            sim_game.transType = "Contest"

    def Generate_Play_ballCarrier():
        sim_game.speed = 8
        if sim_game.transCount == 0:
            sim_game.PlayBook("HITOUT", 0, 0)
            sim_game.transType = "Contest"
        elif sim_game.left_throwIn or sim_game.right_throwIn:
            sim_game.PlayBook("HITOUT", 0, 0)
            sim_game.transType = "Contest"
        else:
            
            isSideways = random.randint(0,1)
            movementRoll = random.randint(1,100)
            if movementRoll > 70:
                if isSideways == 0:
                    Play_A = sim_game.PlayBook("Short Kick", 1, 0)
                elif isSideways == 1:
                    Play_A = sim_game.PlayBook("Short Kick", 0, 1)
            elif 40 < movementRoll <= 70:
                if isSideways == 0:
                    Play_B = sim_game.PlayBook("Handball", 1, 0)
                elif isSideways == 1:
                    Play_B = sim_game.PlayBook("Handball", 0, 1)
            elif 20 < movementRoll <= 40:
                Play_C = sim_game.PlayBook("Run And Bounce", 1, 0)
            elif 5 < movementRoll <= 20:
                Play_D = sim_game.PlayBook("Long Kick", 2, 2)
            else:
                Play_E = sim_game.PlayBook("TORP", 3, 2)
            sim_game.transType = "Contest"

Generate_Play_ballCarrier() function is called upon when the player wins clean possession and is able to make a decision about moving the ball, if the ball happens to be out of bounds or a restart at the centre square, the sim will indicate that a hitout occurred and return the next play to a contest in order to determine who gets subsequent possession (it might even be skipping over this part, I'm not sure how stable this part of the coding is)

Otherwise, it makes a couple rolls, firstly isSideways to determine whether the player intends to move the ball forwards or sideways in the event of a short-range pass.

From there movementRoll will select a random number between 1-100 and determine the type of ball movement that has occurred, the forward distance, and maximum distance in lateral movement. As set out by the function PlayBook(play_type, movement, Max_lateralDist) [at the top of the above block]

There are currently 5 types of plays the ball carrier could make:
  • Short Kick which has a 30% chance and will move the ball a range of 1 either forwards or sideways depending on the result of: isSideways
  • Handball same effect and probability as short-kick
  • Bounce 20% chance and will definitely move the ball forward 1 unit, won't go sideways
  • Long Kick has a 15% chance and will move the ball 2 units forward and a max of 2 units laterally as defined under PlayBook(play_type, movement, Max_lateralDist)
  • Torpedo has a 5% chance of occurring and will move the 3 units forward (like when the sim makes players occasionally take shots from wing and centre) and a max of 2 units laterally
Once the CARRIER roll is done and the new ball position is recorded, the next play will by default revert it to a CONTEST roll.

Obviously some bugs need to be cleaned out, and the CONTEST roll needs to be more specific, e.g. the distinction between marks and loose balls gets, can't be having players mark handballs etc. but beginning to see the backbone of a functioning sim now.
 
Full Code at this point in time: https://www.dropbox.com/s/9ggygfrn36ko3c6/15_OCT.txt?dl=0

I tried to record a test game by writing some simple details into a txt output file: https://www.dropbox.com/s/yuik7n59krjlfkl/test.txt?dl=0

Each line contains the QUARTER, game time, Home score vs Away score, who has possession of the ball, (x,y) coordinates of the field position of the play whereby the x boundaries are between -1 and 1 / the y boundaries are between -2 and 2, some very basic lines of commentary

A bit of glitch stands out where currently when a player handballs or Runs and bounces the ball into the goals it can count as a goal which should be fixed once differentiations between handballs, bounces and kicks are made
 
Nice work mate.

Just looking at this line here...
  • Bounce 20% chance and will definitely move the ball forward 1 unit, won't go sideways
Can forward line players bounce the ball?
 

Remove this Banner Ad

Nice work mate.

Just looking at this line here...

Can forward line players bounce the ball?
Half forward line players yes.

In future, the pockets and full forward will not be able to.

At the moment, its a glitch as when they take a bounce it will just be interpreted as a shot on goal
 
How many "units" do you have on the ground, I'm assuming it's 5/6x3.
Is it more coding (not just simply Ctrl+C, Ctrl+V) to have 3 units in Forward, three units in Half-Foward, etc. That way the FF can bounce the ball, and this continue sequences of handballs (eg, handball out of the pack and it doesn't go that far.
As I write this, I realize the down sides, coding in the length of a kick gets more complicated, with several more options.
 
How many "units" do you have on the ground, I'm assuming it's 5/6x3.
Is it more coding (not just simply Ctrl+C, Ctrl+V) to have 3 units in Forward, three units in Half-Foward, etc. That way the FF can bounce the ball, and this continue sequences of handballs (eg, handball out of the pack and it doesn't go that far.
As I write this, I realize the down sides, coding in the length of a kick gets more complicated, with several more options.
3 [lW, C, rW] by 5 [B, HB, C, HF, F] field. Anything outside is either a score or boundary throw in.

I think it will become quite complex to have multiple units in each area because what we will need to do is code more to ensure that there is a receiving player when the ball gets delivered which will need more randomising and more variables. The logic of 3 by 15 is to have each coordinate correspond with a player on the ground + 3 followers and 2 interchange to come eventually.
 
Expanded the Generate_Play functions to give it more of a logical flow, like ruck wins the hitout -> rovers compete (0.67 chance of rover winning it if ruck wins the tap out), oppo can't tackle you if you take a mark

Python:
    def Generate_Play_contest():
        sim_game.speed = 5
        global possession
        if not sim_game.kickIn:
            if sim_game.possession == "None":
                if sim_game.ActionType == "Rucking":
                    possessionRoll = random.randint(0,1)
                    if possessionRoll == 0:
                        sim_game.possession = "Home"
                    elif possessionRoll == 1:
                        sim_game.possession = "Away"
                    sim_game.ActionType = "Roving"
                    sim_game.transType = "Contest"
                else:
                    possessionRoll = random.randint(0,1)
                    if possessionRoll == 0:
                        sim_game.possession = "Home"
                    elif possessionRoll == 1:
                        sim_game.possession = "Away"
                    sim_game.ActionType = "BallGet"
                    sim_game.transType = "Defending"

            else:
                if sim_game.ActionType == "Roving":
                    possessionRoll = random.randint(1,3)
                    if sim_game.possession == "Home" and possessionRoll == 1:
                        sim_game.possession = "Away"
                    elif sim_game.possession == "Away" and possessionRoll == 1:
                        sim_game.possession = "Home"
                    sim_game.ActionType = "BallGet"
                    sim_game.transType = "Defending"
                elif sim_game.ActionType == "Kick":
                    possessionRoll = random.randint(0,1)
                    if possessionRoll == 0:
                        sim_game.possession = "Home"
                    elif possessionRoll == 1:
                        sim_game.possession = "Away"
                    aerialRoll = random.randint(1,10)
                    if aerialRoll >= 8:
                        sim_game.ActionType = "Mark"
                        sim_game.transType = "Carrying"
                    else:
                        sim_game.ActionType = "BallGet"
                        sim_game.transType = "Defending"
                else:
                    possessionRoll = random.randint(0,1)
                    if possessionRoll == 0:
                        sim_game.possession = "Home"
                    elif possessionRoll == 1:
                        sim_game.possession = "Away"
                    sim_game.ActionType = "BallGet"
                    sim_game.transType = "Defending"
                    
        else:
            sim_game.transType = "Carrying"
            sim_game.ActionType = "Kicking In"
            sim_game.kickIn = False

Makes it possible for defenders to win a free kick to turn the ball over in which case they can dispose of the ball without the oppo scramble to win it back

Python:
    def Generate_Play_defender():
        sim_game.speed = 3
        if sim_game.possession == "Home":
            turnoverRoll = random.randint(1,10)
            if turnoverRoll <= 2:
                sim_game.possession = "None"
                sim_game.ActionType = "Spills Free"
                sim_game.transType = "Contest"
            elif 2 < turnoverRoll <= 5:
                sim_game.possession = "Away"
                loseballRoll = random.randint(1,10)
                if loseballRoll <= 4:
                    sim_game.ActionType = "Tackle"
                    sim_game.transType = "Defending"
                elif 4 < loseballRoll <= 8:
                    sim_game.ActionType = "Dispossession"
                    sim_game.transType = "Defending"
                else:
                    sim_game.ActionType = "Free Kick"
                    sim_game.transType = "Carrying"
                    
            else:
                sim_game.possession = "Home"
                sim_game.ActionType = "Finds Space"
                sim_game.transType = "Carrying"
        
        elif sim_game.possession == "Away":
            turnoverRoll = random.randint(1,10)
            if turnoverRoll <= 2:
                sim_game.possession = "None"
                sim_game.ActionType = "Spills Free"
                sim_game.transType = "Contest"
            elif 2 < turnoverRoll <= 5:
                sim_game.possession = "Home"
                loseballRoll = random.randint(1,10)
                if loseballRoll <= 4:
                    sim_game.ActionType = "Tackle"
                    sim_game.transType = "Defending"
                elif 4 < loseballRoll <= 8:
                    sim_game.ActionType = "Dispossession"
                    sim_game.transType = "Defending"
                else:
                    sim_game.ActionType = "Free Kick"
                    sim_game.transType = "Carrying"
            else:
                sim_game.possession = "Away"
                sim_game.ActionType = "Finds Space"
                sim_game.transType = "Carrying"
        else:
            sim_game.transType = "Contest"


Defines positional limits so that players who are only one unit away from goal can't bounce the ball in or handball it through, they can only handball sideways or take a shot
Python:
    def Generate_Play_ballCarrier():
        sim_game.speed = 8

        isSideways = random.randint(0,1)
        movementRoll = random.randint(1,100)
        
        if sim_game.play_posLine == 2 and sim_game.possession == "Home":
            if movementRoll > 70:
                sim_game.PlayBook("Short Kick", 1, 0)
                sim_game.ActionType = "Kick"
            elif 40 < movementRoll <= 70:
                sim_game.PlayBook("Short Kick", 0, 1)
                sim_game.ActionType = "Kick"
            elif 20 < movementRoll <= 40:
                sim_game.PlayBook("Handball", 0, 1)
                sim_game.ActionType = "Handball"
            elif 10 < movementRoll <= 20:
                sim_game.PlayBook("Long Kick", 2, 2)
                sim_game.ActionType = "Kick"
            else:
                sim_game.PlayBook("TORP", 3, 2)
                sim_game.ActionType = "Kick"
                
        elif sim_game.play_posLine == -2 and sim_game.possession == "Away":
            if movementRoll > 70:
                sim_game.PlayBook("Short Kick", 1, 0)
                sim_game.ActionType = "Kick"
            elif 40 < movementRoll <= 70:
                sim_game.PlayBook("Short Kick", 0, 1)
                sim_game.ActionType = "Kick"
            elif 20 < movementRoll <= 40:
                sim_game.PlayBook("Handball", 0, 1)
                sim_game.ActionType = "Handball"
            elif 10 < movementRoll <= 20:
                sim_game.PlayBook("Long Kick", 2, 2)
                sim_game.ActionType = "Kick"
            else:
                sim_game.PlayBook("TORP", 3, 2)
                sim_game.ActionType = "Kick"
        
        else:
            if movementRoll > 70:
                if isSideways == 0:
                    sim_game.PlayBook("Short Kick", 1, 0)
                    sim_game.ActionType = "Kick"
                elif isSideways == 1:
                    sim_game.PlayBook("Short Kick", 0, 1)
                    sim_game.ActionType = "Kick"
            elif 40 < movementRoll <= 70:
                if isSideways == 0:
                    sim_game.PlayBook("Handball", 1, 0)
                    sim_game.ActionType = "Handball"
                elif isSideways == 1:
                    sim_game.PlayBook("Handball", 0, 1)
                    sim_game.ActionType = "Handball"
            elif 20 < movementRoll <= 40:
                sim_game.PlayBook("Run And Bounce", 1, 0)
                sim_game.ActionType = "Run"
            elif 5 < movementRoll <= 20:
                sim_game.PlayBook("Long Kick", 2, 2)
                sim_game.ActionType = "Kick"
            else:
                sim_game.PlayBook("TORP", 3, 2)
                sim_game.ActionType = "Kick"
        
        sim_game.transType = "Contest"
 

🥰 Love BigFooty? Join now for free.

Next step would be define a function that counts each individual action and adds 1 to the category every time it occurs. Which should give us the total team stats at the end of each Qooty game.
 
View attachment PyQooty 2019-10-18 17-02-53_Trim.mp4


Getting closer to a workable game sim now. Mobbs what are the probabilities of a follower popping up to get the ball instead of the player placed at that position? Think just need to incorporate followers winning the ball and then I can move onto specifying each position with an allocated player name.
 
I've started Python at work in the past few months. I'm actually enjoying creating scripts to fix stuff automatically.

Will have a look at improving Qooty for all but Kennedy Parker seems to be all over it so i'll put forward ideas and the like.
 
9DZ6.gif


I have no idea what the **** is going on here, but it looks super impressive Kennedy Parker bravo mate. :thumbsu:
 
Full Code: https://www.dropbox.com/s/sx0gr9o0fv38y7o/28_OCT.txt?dl=0

Output Team Total Stats: https://www.dropbox.com/s/xc4ly3s6cxm4yzs/statsoutput.txt?dl=0

Started working on it again. To get it to count team total stats, was a massive pain in the arse.

Defined a new class -> teamStatistics which keeps track of the total stats for home and away teams across the game.

updateTeamStats looks at the team in possession at a given point in time and what the actionType is to determine what's happening and adds one to the corresponding category's count each loop.

By the looks of it, at this stage there's not nearly enough recorded interactions to emulate the actual sim with the totals much smaller than what they need to be. Not sure how we can increase it without unreasonably inflating the score though.

Mobbs

Python:
class teamStatistics(object):
    homeHO = 0
    homeK = 0
    homeHB = 0
    homeM = 0
    homeT = 0
    homeFF = 0
    homeFA = 0
    
    homeD = 0
    
    awayHO = 0
    awayK = 0
    awayHB = 0
    awayM = 0
    awayT = 0
    awayFF = 0
    awayFA = 0
    
    awayD = 0
    
    def updateTeamStats(teamWithBall, action):
        if teamWithBall == "Home":
            if action == "Roving":
                teamStatistics.homeHO += 1
            elif action == "Kick":
                teamStatistics.homeK += 1
            elif action == "Handball":
                teamStatistics.homeHB += 1
            elif action == "Mark":
                teamStatistics.homeM += 1
            elif action == "Tackle":
                teamStatistics.homeT += 1
            elif action == "Free Kick":
                teamStatistics.homeFF += 1
                teamStatistics.awayFA += 1
            #elif action == teamStatistics.homeG:
            #    teamStatistics.homeG += 1
            #elif action == teamStatistics.homeB:
            #    teamStatistics.homeB += 1
            print(teamWithBall, action)
        
        elif teamWithBall == "Away":
            if action == "Roving":
                teamStatistics.awayHO += 1
            elif action == "Kick":
                teamStatistics.awayK += 1
            elif action == "Handball":
                teamStatistics.awayHB += 1
            elif action == "Mark":
                teamStatistics.awayM += 1
            elif action == "Tackle":
                teamStatistics.awayT += 1
            elif action == "Free Kick":
                teamStatistics.awayFF += 1
                teamStatistics.homeFA += 1
            #elif action == teamStatistics.awayG:
            #    teamStatistics.awayG += 1
            #elif action == teamStatistics.awayB:
            #    teamStatistics.awayB += 1
            print(teamWithBall, action)
    
    def GetTotalDisposals():
        teamStatistics.homeD = teamStatistics.homeK + teamStatistics.homeHB
        teamStatistics.awayD = teamStatistics.awayK + teamStatistics.awayHB
        
    def arrangeTeamStats():
        global Home_Hitouts
        Home_Hitouts = "Home HO: " + str(teamStatistics.homeHO)
        global Home_Kicks
        Home_Kicks = "Home K: " + str(teamStatistics.homeK)
        global Home_Handball
        Home_Handball = "Home HB: " + str(teamStatistics.homeHB)
        global Home_Marks
        Home_Marks = "Home M: " + str(teamStatistics.homeM)
        global Home_Tackles
        Home_Tackles = "Home T: " + str(teamStatistics.homeT)
        global Home_FreesFor
        Home_FreesFor = "Home FF: " + str(teamStatistics.homeFF)
        global Home_FreesAgainst
        Home_FreesAgainst = "Home FA: " + str(teamStatistics.homeFA)
        
        global Away_Hitouts
        Away_Hitouts = "Away HO: " + str(teamStatistics.awayHO)
        global Away_Kicks
        Away_Kicks = "Away K: " + str(teamStatistics.awayK)
        global Away_Handball
        Away_Handball = "Away HB: " + str(teamStatistics.awayHB)
        global Away_Marks
        Away_Marks = "Away M: " + str(teamStatistics.awayM)
        global Away_Tackles
        Away_Tackles = "Away T: " + str(teamStatistics.awayT)
        global Away_FreesFor
        Away_FreesFor = "Away FF: " + str(teamStatistics.awayFF)
        global Away_FreesAgainst
        Away_FreesAgainst = "Away FA: " + str(teamStatistics.awayFA)
        
    def write_team_stats():
        statsoutput = open("statsoutput.txt", "w")
            
        statsoutput.write(Home_Hitouts + "\n" + Home_Kicks + "\n"
                        + Home_Handball + "\n" + Home_Marks + "\n"
                        + Home_Tackles + "\n" + Home_FreesFor + "\n"
                        + Home_FreesAgainst + "\n" + Away_Hitouts + "\n"
                        + Away_Kicks + "\n" + Away_Handball + "\n"
                        + Away_Marks + "\n" + Away_Tackles + "\n"
                        + Away_FreesFor + "\n" + Away_FreesAgainst + "\n")
 
Rich (BB code):
            ROY   GCR
Hitouts   : 10   17
Kicks     : 118  143
Marks     : 59   55
Handballs : 108  134
Tackles   : 24   35
Frees For : 11   18
Frees Ag. : 18   11
Smothers  : 0    1
Ironouts  : 3    11
Inside50  : 14   17
Goals     : 11   17
Behinds   : 4    11


Home HO: 27
Home K: 107
Home HB: 39
Home M: 4
Home T: 27
Home FF: 36
Home FA: 24
Away HO: 26
Away K: 133
Away HB: 63
Away M: 12
Away T: 31
Away FF: 24
Away FA: 36


Bottom is python test output (limited version) in comparison to total stats output from a game from the current sim. Naturally Total Hitouts across the board increase due to the introduction of boundary throw-ins, marks need to increase ten-fold, handballs need to double in volume
 

Remove this Banner Ad

Remove this Banner Ad

🥰 Love BigFooty? Join now for free.

Back
Top Bottom