{"push_id":1033022659,"size":1,"distinct_size":1,"ref":"refs/heads/patch-1","head":"247a3259c716f3638dc7cf1b541c18782eab7fcb","before":"87936d8a7004bb87515b1ce8747d610959a6a098","commits":[{"sha":"247a3259c716f3638dc7cf1b541c18782eab7fcb","author":{"email":"0de6f6c1dcc3958cb4b2ff701362e59de7e8f09d@gmail.com","name":"destilla"},"message":"Updates to clock subtraction and failed 4th down (and misc stuff)\n\nBasic idea of what I was going for:\r\n\r\nIn the current code, the clock runs the same for each passing play, whether that play was a sack for yardage loss (the clocks runs), a sack for a safety (clock stops for freekick), an incompletion (drop or bad throw) (clock stops after the play is dead), a catch for a TD (clock stops for the XP try) or a catch (which so far we're assuming is always in bounds, so the clock runs). \r\n\r\nI wanted to suggest a change to allow the clock to run differently depending on the outcome. In doing this, I noticed that when a play is run, \"5th down is checked\" (aka did you just fail a fourth down), and if you did, possession is changed and the down is set to 1. (glassesref joke goes here) However, the yards to go remained, and the yard line variable didn't change.\r\n\r\nBecause the game uses 100 yards, instead of the \"your own 1-49, the 50, the opp 49-1\" system, if USC stops ASU on the 40 yard line in the game, they would then take over --on their own 40--. The analogy to real life is if USC stopped ASU on 4th and 3 from the ASU 40 yard line, USC would get the ball with 1st and 3 to go, on the USC 40 yard line.\r\n\r\nI updated the code to set the yards to go to 10 so that the defense that just got the 4th down stop gives their offense the ball with 1st and 10 to go instead of 1st and whatever-the-other-team-had-left. I also set gameYardLine = 100 - gameYardLine to reflect the fact that the ball is now moving in the other direction, and counting up to 100. (I flat out stole this from getFumble).\r\n\r\n--------------\r\n\r\nList of changes:\r\n\r\nUpdated getEventPrefix to use \"gameDownAdj\" in the return string instead of \"gameDown\". This allows for us to print out that a team failed a 4th down try, and not have the game log read \"5 and 3\" in the event a team turns over on 4th down.\r\n\r\nTested that turnover on downs worked properly by having a log added that reported the 4th down failure and the subsequent 1st down take over by the other team. (If I can figure out how to attach a screenshot I'll show the result). I got rid of the 1st down take over but thought you might like a 4th down failure message log, so I left it in but commented.\r\nUpdated turnover on downs logic to reset to 1st and 10 for the new team and flip the direction the ball is moving (put them on the right yardline)\r\n\r\nChanged a dropped ball to take up less time (because the ball was dropped and now the clock shouldn't run after the play), update passattempt, and then exit (return;) and move on.\r\n\r\nIf the WR escapes for a TD (vs just having his play be long enough for a TD), previously he got a flat 100 yard gain. Updated the code to give him the rest of the yardage that was left in the drive instead of the flat 100.\r\n\r\nIf a pass is incomplete (WR didn't drop it, but didn't catch it either), the clock decrements the time of the play, runs passAttempts, then exits.\r\n\r\nIf the pass is caught, but then fumbled, or run all the way for a TD, the clock loses the time that would burn off during the play, and then stops for either the change of possession or the XP and kickoff (and on kickoff, more time is decremented as part of the kickoff ...function? method? whatever the vocabulary is)\r\n\r\nPreviously, if the QB was sacked, no time ran off the clock (because the play simply ran qbSack(offense) and then exited, and qbSack didn't subtract any time). Updated qbSack to take up some time and stop the clock if the result was a safety (clock stops for change of possession) and take  the equivalent of a rushing play if the sack is just a regular sack (because at that point it -is- a rushing), minus 5 static seconds because it's a short rushing play.\r\n\r\n--------------\r\n\r\nFinally, if the play is a catch but not a TD or a fumble, then the clock decrements as it previously did on every passing play that didn't exit early (sack or interception).","distinct":true,"url":"https://api.github.com/repos/destilla/footballcoach/commits/247a3259c716f3638dc7cf1b541c18782eab7fcb"}]}