|
Post by BoyInGreen on Mar 11, 2013 18:36:44 GMT
As always, make sure to have the source code and a Java compiling environment. League files containing team data are named after the country that is to be simulated. League systems are initialised by the following command after the declaration of the class Country: public Team[][] country = new Team[number of tiers][ leave blank unless all tiers have exactly the same number of teams]; Now the individual divisions are initialised like this: country[level of league] = new Team[number of teams]; IMPORTANT: Make sure that you initialise the exact number of leagues (from 0 to n-1 where n is the number of tiers.) Your league system and divisions are up and running, now it is time to add the teams. Refer here for instructions on editing teams.
|
|
|
Post by BoyInGreen on Mar 11, 2013 18:50:23 GMT
OK, you have now initialised your league. Now you need to implement it. Classes for implementing leagues are named PlayCountry.
Create a new class of this name and create a new method playLeague( *name of your country* data).
Put in this line (this is necessary for the league tables to be generated properly):
static PointsTiebreaker[] tiebreakers = new PointsTiebreaker[5];
Select the appropriate fixtures class for your league (the classes generate fixtures for the specified league size). Initialise it and invoke the generate method like this:
Fixtures16 f16 = new Fixtures16(); f16.generate16(data.country);
Now call the Sort class and invoke the printTeams method:
Sort sort = new Sort(); sort.printTeams(data.country,"Name of League",last team for promotion/champions,first team to be relegated);
Call the Update class to refresh team statistics for the new season:
Update u = new Update(); u.updateLeague(data.country);
If you want to weight the strength of certain teams in order to reduce any randomness, you do it like this:
for (int y = 0; y < data.country.length; y++) { if(data.country[y].teamName.equals("Team 1")||data.country[y].teamName.equals("Team 2")||data.country[y].teamName.equals("Team 3")) { data.country[y].strength = data.country[y].strength+10; } }
|
|
|
Post by BoyInGreen on Apr 21, 2013 20:03:40 GMT
Now that CSV editing is possible, the above posts are fortunately obsolete, as it is no longer necessary to go to all that trouble just to edit club data!
|
|