public MatchResult SimulateMatch(FootballMatch match) { var field = new Field(); const int interval = 10; var result = new MatchResult(); bool team1HasBall = true; for (int seconds = 0; seconds < 90 * 60; seconds += interval) { bool otherTeamWinsBall = Random.Next(4) == 0; if (otherTeamWinsBall) team1HasBall = !team1HasBall; int widthDelta = GetWidthDelta(field); int lengthDelta = GetLengthDelta(field, team1HasBall); field.MoveBall(widthDelta, lengthDelta); if (field.BallIsAtGoal1()) { result.Goals2++; field.ResetBallPosition(); team1HasBall = true; } if (field.BallIsAtGoal2()) { result.Goals1++; field.ResetBallPosition(); team1HasBall = false; } } return result; }