Cup teams chosen from previous season's league tables
Cup teams chosen from previous season's league tables
Cup teams from national leagues are drawn from the previous season's tables, i.e. they don't take promotion and relegation into account. For example, if I get relegated from the English League to the Conference, I still get to play in the League Cup next season.
Now, I know why this is. Obviously we can't roll forward the whole season before drawing cup teams, because we still need to know the winners of last season's cups. So the fix appears at first to be simple: roll the leagues forward, draw cup teams, then delete the old cups.
Unfortunately, as you know , prom/rel doesn't preserve league order, so cups that rely on teams in certain positions (European cups, and the new Serbian cup!) won't work properly at all. I hate to mention this, because the prom/rel code is quite elegant now. Having to preserve order might make it messy, and might require more accurate definition files (not a good thing).
Maybe there's another solution, but in any case, preserving league order would be a "nice to have"!
Mark
Now, I know why this is. Obviously we can't roll forward the whole season before drawing cup teams, because we still need to know the winners of last season's cups. So the fix appears at first to be simple: roll the leagues forward, draw cup teams, then delete the old cups.
Unfortunately, as you know , prom/rel doesn't preserve league order, so cups that rely on teams in certain positions (European cups, and the new Serbian cup!) won't work properly at all. I hate to mention this, because the prom/rel code is quite elegant now. Having to preserve order might make it messy, and might require more accurate definition files (not a good thing).
Maybe there's another solution, but in any case, preserving league order would be a "nice to have"!
Mark
Re: Cup teams chosen from previous season's league tables
i don't seem to be very bright recently i'm not getting what you mean by 'preserving league order'.MarkC wrote:Maybe there's another solution, but in any case, preserving league order would be a "nice to have"!
the problem is obviously that european cups rely on the table positions at the end of a season, whereas national cups rely on the table at the beginning of a season.
maybe it'd be best if we just take 'add_week=1' or =2 for national cups which load complete leagues.
gyözö
Press any key to continue or any other key to quit.
Re: Cup teams chosen from previous season's league tables
Yes, for cups that load a complete league, this is fine. But what if they load certain positions? Say I have a top league 1 and two parallel leagues 2a and 2b under it, like in the Welsh or the SCG definition. I want the top 8 teams from the two parallel leagues to play a cup.the problem is obviously that european cups rely on the table positions at the end of a season, whereas national cups rely on the table at the beginning of a season.
maybe it'd be best if we just take 'add_week=1' or =2 for national cups which load complete leagues.
In real life, this would include teams relegated from 1 to 2a and 2b, since the league tables at the start of a season would have the teams in the same order as they finished last season, with relegated teams at the top and promoted teams at the bottom. This is what I meant by preserving the league order when a new season starts.
At the moment, in bygfoot, there is no way to choose the correct 16 teams. You could pick teams from the league 1 relegation zone, but this wouldn't work in season 1, and would make the definition file totally unintuitive.
(When I started playing 1.9 I actually found it very weird that the teams' positions all went back to alphabetical order at the start of a season, and that relegated teams were dumped at the bottom. But then I read the code and realised that it was the result of elegant, generalised prom/rel functions )
Right now I don't think there are any cups that can't be fixed by the add_week=1 method, but there might be in future. The Serbian cup works fine as it is, but not the way you'd expect it to. It just happens to load all the teams that lie in the prom/rel zones, so the result is what you expect.
Shall I update my Eng/Wales/Ireland defs to use add_week=1 where necessary? The downside of this is that the cup fixtures won't show up until a week has been played, which is a bit unintuitive for the user.
If we did keep the team order the same then we could load all cups in week zero, provided we did the promotion/relegation first. But would it be too messy...?
Mark
Re: Cup teams chosen from previous season's league tables
thanks for the compliment but in fact preserving the order doesn't really have to do with the prom rel system. it's just a matter of appending or prepending to the teams array when team movements are done.MarkC wrote:But then I read the code and realised that it was the result of elegant, generalised prom/rel functions )
no, i implemented it. if was fairly simple and little change to the code. now teams are prepended if they got relegated and appended otherwise, so order is preserved (possibly except for the case of a prom_rel element with type PROM_REL_NONE ).If we did keep the team order the same then we could load all cups in week zero, provided we did the promotion/relegation first. But would it be too messy...?
however, this still doesn't solve our dilemma. the league tables are updated at the start of a season AFTER the cups (with add_week 0) have been loaded (to ensure that the right teams participate in the international cups). so having a national cup with add_week 0 will load the teams from tables which don't reflect promotion/relegation at all. we still need to use add_week 1 (or 2, i seem to recall 1 didn't work well when i tried it) for cups that want to have updated tables.
the order problem is solved, however, now the relegated teams are the first ones in the table at the beginning of a new season.
gyözö
Press any key to continue or any other key to quit.
Re: Cup teams chosen from previous season's league tables
Oh, excellent I'll grab the new cvs tonight and have a look, if I get chance.no, i implemented it. if was fairly simple and little change to the code.
But the international cups will surely only fetch teams from the top of the first league. Certainly none of them will be getting promoted or relegated! So if the order of all teams in the league is now preserved, I don't see why we can't update the tables before loading week 0 cups.however, this still doesn't solve our dilemma. the league tables are updated at the start of a season AFTER the cups (with add_week 0) have been loaded (to ensure that the right teams participate in the international cups).
Mark
Re: Cup teams chosen from previous season's league tables
surely, certainly i'm feeling uneasy. what if you'd like to implement a cup for lower league teams, eg. the second league plus the first 5 of the third league? winchester cup or whatever (isn't there some such cup in england?). that's impossible to do then. totally impossible. whereas we can solve the other problem with the appropriate add_week value.MarkC wrote:But the international cups will surely only fetch teams from the top of the first league. Certainly none of them will be getting promoted or relegated! So if the order of all teams in the league is now preserved, I don't see why we can't update the tables before loading week 0 cups.
gyözö
p.s.: moving this topic to 'code discussions'...
Press any key to continue or any other key to quit.
Re: Cup teams chosen from previous season's league tables
OK, I just grabbed the CVS. Yes, relegated teams now appear at the top, but I meant more than that. Teams that are neither promoted nor relegated still all get jumbled up. By "league order" I meant the order of all the teams in the league! (I get the feeling I'm struggling to convey my meaning here )
Must admit I haven't heard of the Winchester cup. There is some trophy or other that always seems to be sponsored by a van company, I think that takes (in bygoot terminology) leagues 3 and 4 plus some of league 5. Maybe this was called the Winchester Cup at one time, I've no idea.
Mark
It's not impossible if the teams in the middle of the table don't all get shifted around.what if you'd like to implement a cup for lower league teams, eg. the second league plus the first 5 of the third league? winchester cup or whatever (isn't there some such cup in england?). that's impossible to do then. totally impossible. whereas we can solve the other problem with the appropriate add_week value.
Must admit I haven't heard of the Winchester cup. There is some trophy or other that always seems to be sponsored by a van company, I think that takes (in bygoot terminology) leagues 3 and 4 plus some of league 5. Maybe this was called the Winchester Cup at one time, I've no idea.
Mark
Re: Cup teams chosen from previous season's league tables
no, i just didn't think of that. i'm going to try and set it right tomorrow.MarkC wrote:Teams that are neither promoted nor relegated still all get jumbled up. By "league order" I meant the order of all the teams in the league! (I get the feeling I'm struggling to convey my meaning here )
well, depends on the cup it is impossible if the winchester cup (;-)) says 'take the teams that finish 1st to 5th from the third league'. that won't work because the first few got replaced by relegated teams. and what if we'd want to create a cup with the worst teams from the european leagues, say the last 2 from all countries' first leagues? we'd get the promoted teams from the second leagues.It's not impossible if the teams in the middle of the table don't all get shifted around.
of course these are silly examples, but they illustrate what we can lose if we execute the team movements before we create the cups.
gyözö
Press any key to continue or any other key to quit.
Re: Cup teams chosen from previous season's league tables
Well, that wouldn't work with the current code, for the first season. The Winchester would incorrectly contain five teams from league 3 in season 1, and a mixture of teams from leagues 3 and 2 in other seasons.well, depends on the cup it is impossible if the winchester cup (;-)) says 'take the teams that finish 1st to 5th from the third league'. that won't work because the first few got replaced by relegated teams.
Such an unusual definition would be specific to a country, so you could probably take the promotion into account. For example, if two teams are promoted, then choose teams 3-5 of league 3 and the last two teams in league 2.
Such a cup, involving teams promoted to league 2 but no other teams from league 2, would be very unusual so I don't think having to define it this way is particularly bad.
If parallel leagues are involved, you might struggle to pick the right teams, but now we're getting really silly!
Yes, this is a better example, since you'd have to use a specific method for each country, depending on how the relegations work, and again, parallel leagues might make it impossible. Still doesn't work in season 1, in any case!and what if we'd want to create a cup with the worst teams from the european leagues, say the last 2 from all countries' first leagues? we'd get the promoted teams from the second leagues.
Yes, they are.of course these are silly examples, but they illustrate what we can lose if we execute the team movements before we create the cups.
I think we stand to gain more than we lose. Without the change, I still can't see a way to choose only the top 8 teams from each of two parallel leagues (including relegated ones), as per the example in an earlier post. This is a more realistic requirement.
The change would also remove the need for everyone to put add_week = 1 or 2 in cups that draw from a subset of the national leagues, which is the only fix right now for the bug as originally posted.
What about if add_week = -1 meant "choose teams before updating leagues", and add_week = 0 meant "choose teams after updating leagues"? I think add_week = -1 would be required rarely if ever, so it wouldn't really make definition creation any more complex. Most people wouldn't even need to know it existed.
add_week = -1 would have to be treated as 0 in season 1, but as it'd be rare I don't think that the slight inconsistency in season 1 is too much of a worry.
Mark
Re: Cup teams chosen from previous season's league tables
yes, but it would contain exactly the teams that finished on the positions given in the def. of course some of them got promoted.MarkC wrote:Well, that wouldn't work with the current code, for the first season. The Winchester would incorrectly contain five teams from league 3 in season 1, and a mixture of teams from leagues 3 and 2 in other seasons.
yes. this is obsolete anyway because i am already very enthusiastic about your suggestion below.If parallel leagues are involved, you might struggle to pick the right teams, but now we're getting really silly!
well, the first season isn't important in my opinion. e.g. the european cup participants are picked at random, as you might have seen (in earlier versions -- as early as 0.5 -- the strongest teams were picked).Still doesn't work in season 1, in any case!
an excellent idea. this way we can have both, and i don't think there's a lot of additional code involved.What about if add_week = -1 meant "choose teams before updating leagues", and add_week = 0 meant "choose teams after updating leagues"? I think add_week = -1 would be required rarely if ever, so it wouldn't really make definition creation any more complex. Most people wouldn't even need to know it existed.
add_week = -1 would have to be treated as 0 in season 1, but as it'd be rare I don't think that the slight inconsistency in season 1 is too much of a worry.
so let me summarise:
- at the beginning of a season first the cups with add_week=-1 are loaded
- then the promotion/relegation movements are executed, preserving the order of teams
- finally, the cups with add_week=0 get loaded.
seems like the best solution
gyözö
Press any key to continue or any other key to quit.
Re: Cup teams chosen from previous season's league tables
Yep, sounds perfect.so let me summarise:
- at the beginning of a season first the cups with add_week=-1 are loaded
- then the promotion/relegation movements are executed, preserving the order of teams
- finally, the cups with add_week=0 get loaded.
Mark
Re: Cup teams chosen from previous season's league tables
implemented, howto and tags ref updated. hope it works like we want it togyboth wrote:- at the beginning of a season first the cups with add_week=-1 are loaded
- then the promotion/relegation movements are executed, preserving the order of teams
- finally, the cups with add_week=0 get loaded.
the start_new_season function is a bit longer and uglier now, but i think that was unavoidable
gyözö
Press any key to continue or any other key to quit.
Re: Cup teams chosen from previous season's league tables
Nearly! The "order preservation" looks to be perfect, and the ordinary cups are working as expected. I added a "Winchester Cup" with add_week = -1 and it worked perfectly as well... for two seasons.hope it works like we want it to
Then the game failed at the start of the third season:
** (bygfoot:6565): WARNING **: team_of_id: team with id 200 not found.
I tested without the Winchester cup and still got the error, so I'm not sure what's broken here. I'm afraid I haven't any more time to debug this tonight
Mark
Re: Cup teams chosen from previous season's league tables
oh i also tested for two seasons. didn't try a thirdMarkC wrote:it worked perfectly as well... for two seasons.
*sigh* let me see if i can find the error...I tested without the Winchester cup and still got the error, so I'm not sure what's broken here. I'm afraid I haven't any more time to debug this tonight
gyözö
Press any key to continue or any other key to quit.
Re: Cup teams chosen from previous season's league tables
i think i got this one. when reordering the cup_reset and fixture_write_cup_fixtures stuff in start_new_season i forgot to reset the cups with add_week > 0. so there were still old fixtures there (but without the corresponding teams in the case of the UEFA supercup).MarkC wrote:Then the game failed at the start of the third season:
** (bygfoot:6565): WARNING **: team_of_id: team with id 200 not found.
I tested without the Winchester cup and still got the error, so I'm not sure what's broken here. I'm afraid I haven't any more time to debug this tonight
as a matter of fact the crash already occurred when saving and loading after season 1.
gyözö
Press any key to continue or any other key to quit.