//This method is run for each team seperately in the simulation //It simulates the amount of goals the team scores in a match, see class footbalteam for further reference private int SimulateScore(FootBallTeam player, FootBallTeam opponent, Random random) { //dice rolls: float attack = player.attack * player.strategyModulation(random); //simulating attack influenced by team's strategy float defence = opponent.defence * opponent.strategyModulation(random); //simulating opponent's defence by opponent's strategy //creating a believable score out of the dice rolls float scorePart = attack / (attack + defence); return((int)Math.Floor((float)ScoreConstant * scorePart)); }
//This method creates 4 brand new teams and gives the command to fill te roster with them //TODO: for future expansion, it's uncooth to keep the creation functionality in the pool, //Later on, replace this with a team database and/or factory class; public bool CreateNewRandomPool(int size) { if (size < 2) { return(false); //We do not create a pool without matches } teams.Clear(); //clearing up old teams, if any for (int i = 0; i < size; i++) { FootBallTeam newTeam = new FootBallTeam(); newTeam.randomize(random); teams.Add(newTeam); } FillRoster(); return(true);//Creation was succesfull }