Skip to content

Commit

Permalink
workign on simulations
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinit Ranjan authored and Vinit Ranjan committed Jul 21, 2017
1 parent 9326aa7 commit 23861ae
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions problem2.R
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ divisions <- list("Atlantic" = as.vector(subset(teams$Team_Name,teams$Division_i
# other games are decided by a coinflip

#simulate best case scenario for a team
generateBestCase <- function(teamName) {
generateBestCase <- function(teamName, currentDay) {
teamconf <- teams$Conference_id[which(teams$Team_Name == teamName)]
teamdiv <- teams$Division_id[which(teams$Team_Name == teamName)]

Expand Down Expand Up @@ -401,23 +401,23 @@ threePlusTeamLogic <- function(teams, contentionTeams, currentDate, playoffTeams
}

#main loop
for (day in gamedays){
for (i in 150:151){
#no need to simulate seasons after the first day, nobody could be eliminated yet skip to game day 60
if (day < gamedays[60]) {
tallyScores(day)
print(day)
if (i < 60) {
tallyScores(gamedays[i])
print(gamedays[i])
} else {
tallyScores(day)
print(day)
tallyScores(gamedays[i])
print(gamedays[i])
playoffTeams <- eliminations$Team[which(eliminations$`Date Eliminated` == "Playoffs")]

for (team in playoffTeams){

print(team)
#print(team)
simno <- 1
while ((eliminations$`Date Eliminated`[which(eliminations$Team == team)] != "Playoffs") & (simno < 1000)) {
print("sims starting")
simSeason <- generateBestCase(team)
simSeason <- generateBestCase(team, gamedays[i])
teamconf <- teams$Conference_id[which(teams$Team_Name == teamName)]
teamdiv <- teams$Division_id[which(teams$Team_Name == teamName)]
pcheck <- checkPlayoffTeams(teams,team,teamconf,teamdiv,day)
Expand Down

0 comments on commit 23861ae

Please sign in to comment.