Bug in cup tag <group> check with teams of similar names in the same group

Here you can... report bugs. Open a new thread for each bug, please.
Post Reply
will_the_canuck
Posts: 141
Joined: Tue Jan 16, 2018 5:54 am
Location: Canada

Bug in cup tag <group> check with teams of similar names in the same group

Post by will_the_canuck »

Hello all.

Let's just say that I found a most mysterious bug that I never expected. The best way to describe a bug is that it isn't a bug until someone finds it. Well, I found this one. ;) Let me give you some backstory to this one.

I was playing my test game for my new definitions for England, as well as the new UEFA cups (Champions League and Europa League) that are now corrected and work. In addition, I was using my FIFA Club World Cup files, which are also part of my definitions I'll be releasing.

With the European definitions, they have the international cups of UEFA Champions League and UEFA Europa League, which have the tag of <group> listed with a value of 1. When I checked the old South American definitions, their international cups of Copa Libertadores and Copa Sudamericana also have the <group> tag listed with a value of 1, but since the two continental definitions never really played together, it likely was never a problem. Well, since I'm trying to change that with my FIFA Club World Cup files, I currently do have the Copa Libertadores run during the season as part of the Club World Cup qualifiers, and it runs concurrent to the UEFA cup files. As both the UEFA cup files and Copa Libertadores each belong to <group> 1, it would be assumed that no team will be selected twice to either tournament when randomly selected, which would be true. But, there's a catch. The catch is the bug that I found.

As I am playing definitions from England, they have two team names in particular of Everton and Liverpool, both in the Premier League. It appears that there is a team named "Everton" in Chile, which is currently listed in Chile's league1 file, and there is a team named "Liverpool", which is listed in Uruguay's league1 file also. I mention this as if you were to think about this, you might ask yourself how would a team from South America with the same name as an English Premier League side affect the game in any way, if you were to play as Everton or Liverpool. Well, as both international cups (UEFA cups and Copa Libertadores) are being assigned the <group> value of "1" and they are running concurrently, and the Copa Libertadores are being loaded first before the UEFA cups, at least in my definitions, then if you play as Everton or Liverpool in the English definitions and either of the two teams from South America are loaded into the Copa Libertadores tournament, you won't be able to participate in the UEFA cups, even if you qualify. :) See, a bug. This one really threw me for a loop until I was able to see the debug information myself.

So now to the nitty gritty. Even though the team names are identical in spelling yet located in separate cup files and come from different countries, the <group> check is flagging the team names and not allowing the second one to be selected. This can potentially be a problem as even within the same regions, some team names may be similar to others yet be located in other countries.

In my example, as I said, I'm playing my English definitions. As the zipfile for my test game is about 1.3 megs in size, it is too large to post here. Oh well. :) But, I will include the debug information too, although edited. As I am going from the end of season 3 to the beginning of season 4, the following teams have qualified for the UEFA cups in their respective places:
Premier League: 1st to 5th places: Everton, Southampton, Fulham, C. P. London, Liverpool
Premier League: 6th to 8th places: Manchester C., A. V. Birmingham, A. London
FA Cup: winner: Southampton loser: Everton
FA Cup: 3rd and 4th places: Swansea, A. London
EFL Cup: winner: Everton loser: Fulham
EFL Cup: 3rd and 4th places: Manchester C., Sheffield

Ok. So from my code, the first 4 teams in the Premier League would qualify for the Champions League. The 5th placed team would qualify for the Europa League. The FA Cup winner (or best not yet qualified) and the EFL Cup winner (or best not yet qualified) would also qualify for the Europa League. So, in my code, the qualified teams SHOULD be Everton, Southampton, Fulham, and C. P. London, who qualify for the Champions League. Liverpool, (Swansea or A. London), and (Manchester C. or Sheffield) should be the other three teams that qualify for the Europa League. But alas, it doesn't happen because of this bug. :(

Now, the relevant debug info is below:

This is the reference point to where "Everton" is being loaded for the 4th season. Again, this is the "Everton" from the league file of chile1. As you can see, the cup is named the Copa Libertadores, which is not a UEFA tournament:
"cup_get_team_pointers: Copa Libertadores round 1 team 7 Everton (clid 7025)"

This is the point in the definitions that the teams are drawn from the LEAGUE1 file. You can see the reference to Everton failing to be loaded because it "exists" in another cup file:
"cup_load_choose_team: UEFA Champions League, LEAGUE1, teams 1 to 6, random: 0
cup_get_choose_team_league_cup: sid LEAGUE1 league Premier League
team Everton group 1 found in Copa Libertadores
j 0 order 0 team Everton isinint 1 numteams 0
team Everton group 1 found in Copa Libertadores
j 1 order 1 team Southampton isinint 0 numteams 0
j 2 order 2 team Fulham isinint 0 numteams 1
j 3 order 3 team C. P. London isinint 0 numteams 2
j 4 order 4 team Liverpool isinint 0 numteams 3"

These are the reference points to the teams above:
"cup_get_team_pointers: UEFA Champions League round 3 team 0 Southampton (clid 1001)
cup_get_team_pointers: UEFA Champions League round 3 team 1 Fulham (clid 1001)
cup_get_team_pointers: UEFA Champions League round 3 team 2 C. P. London (clid 1001)
cup_get_team_pointers: UEFA Champions League round 3 team 3 Liverpool (clid 1001)"

This is the part when the League Cup winner is loaded in the Europa League:
"cup_load_choose_team: UEFA Europa League, england_league, teams 1 to 9, random: 0
cup_get_choose_team_league_cup: sid england_league cup EFL Cup
team Everton group 1 found in Copa Libertadores
team Fulham group 1 found in UEFA Champions League
cup_load_choose_team: 0 Sheffield"

and its reference point:
"cup_get_team_pointers: UEFA Europa League round 2 team 0 Sheffield (clid 1001)"

This is the last part for the Europa League qualifiers:
"cup_load_choose_team: UEFA Europa League, england_fa, teams 1 to 9, random: 0
cup_get_choose_team_league_cup: sid england_fa cup FA Cup
team Southampton group 1 found in UEFA Champions League
team Everton group 1 found in Copa Libertadores
cup_load_choose_team: 0 Swansea
cup_load_choose_team: UEFA Europa League, england1, teams 5 to 9, random: 0
cup_get_choose_team_league_cup: sid england1 league Premier League
team Liverpool group 1 found in UEFA Champions League
j 0 order 4 team Liverpool isinint 1 numteams 0
team Liverpool group 1 found in UEFA Champions League
j 1 order 5 team Manchester C. isinint 0 numteams 0
cup_load_choose_team: 1 Manchester C."

along with their reference points:
"cup_get_team_pointers: UEFA Europa League round 5 team 0 Swansea (clid 1001)
cup_get_team_pointers: UEFA Europa League round 5 team 1 Manchester C. (clid 1001)"

Ok. So as you can see above, the <group> check which checks for duplicate entries doesn't appear to go far enough, because even though the same two teams are spelled the same, they are clearly from different areas as the clid numbers attached to the teams are different. So, what factors are checked with the <group> tag I might ask? Maybe it might be wise to see what can be added to the <group> check so that something like this may not happen again. At least the team's country sid or league sid could be compared between teams that might share the same name so that if at least the league or country sid is different, then clearly the teams themselves are different, even if they share the same name.

Going forward, this is an annoying bug until it gets resolved. All I can think of doing is that I will have to use different <group> values for the different regions and cups or else when trying to interconnect them like this, this bug can pop up again. Oh well.

So for now, that's all. Hopefully you can figure out how to fix this bug. As my game file was too big to post, if you wanted to see it, I can likely e-mail it to you if I still have it when you ask, which at the moment, I still have it. :) Bye for now,

will_the_canuck
gunnar
Site Admin
Posts: 233
Joined: Wed Oct 19, 2005 11:13 am
Contact:

Re: Bug in cup tag <group> check with teams of similar names in the same group

Post by gunnar »

I will look at this after the rewrite to java. I think I see where this can happen. The whole id system has to be retaught.
will_the_canuck
Posts: 141
Joined: Tue Jan 16, 2018 5:54 am
Location: Canada

Re: Bug in cup tag <group> check with teams of similar names in the same group

Post by will_the_canuck »

gunnar wrote: Sat Dec 12, 2020 4:02 pm I will look at this after the rewrite to java. I think I see where this can happen. The whole id system has to be retaught.
Well, I was eventually going to post this on the bugs page on sourceforge, but haven't gotten to it yet. Would you still like me to post it there? And when you said that the system has to be retaught, I was thinking it sounded like "bad program...baaaaaad program." ;) hehehe.

Anyways, when everything was simple, the id system was sufficient. As we expand the definitions and start to connect more of them together, the id system may not be as sufficient and will definitely need reconsideration in how it works. This bug is a good reason to make sure that when we do create definitions for bygfoot, that we ensure that the names we use for the team names are unique and different from all the other names out there as if not, this error might just ruin someone's day. I'm just thinking of even the team name of Rangers/Ranger's. In Scotland in their Premiership, the team goes by Rangers FC. In Andorra in now the 2A Divisio, the team goes by Ranger's FC. Although they are differentiated by the use of an apostrophe, they are close enough that if someone forgot to include the apostrophe, it COULD create a conflict over time. But yes, at the moment, they would be different by bygfoot standards.

Now continuing with the differentiation in names theme, I'm wondering about your option on the use of numbers listed in team names. Some examples would be from my definitions for Gibraltar and Kosovo. With Gibraltar, there are the team names of College 1975 and Manchester 62. With the team of Manchester 62, it seems it was founded in 1962. As there is a Manchester U(nited) and Manchester C(ity) already in the EPL, would the use of numbers be acceptable in this case or might something like Manchester S-T (for sixty-two) be more acceptable? Just wondering your thoughts. As well in Kosovo, there is one team called KF Trepça'89 Mitrovicë, which I just have listed in the league file as Trepça'89 as it too was founded in 1989. There's also a team named Trepça in the second tier of the Kosovo system also, but it was founded much earlier than 1989 and does not mention the year in the team name.

Anyways, in an attempt to have unique names, I'm just wondering what you might think of when numbers are mentioned in team names and they themselves are useful in helping to differentiate the names of teams in a particular definition or in any definition. And as for wherever in the code this bug is hiding, hopefully you can find the right spot and then help make it better than it currently is. Until then, I'll just have to be careful when linking inter-association matches and all, and even checking within associations, the international team names. Gonna be fun for sure. ;)

Bye for now,

will_the_canuck
tstellar
Posts: 52
Joined: Mon Aug 31, 2020 5:46 pm

Re: Bug in cup tag <group> check with teams of similar names in the same group

Post by tstellar »

This should be fixed now in the latest 2.3.3-alpha3 builds.
will_the_canuck
Posts: 141
Joined: Tue Jan 16, 2018 5:54 am
Location: Canada

Re: Bug in cup tag <group> check with teams of similar names in the same group

Post by will_the_canuck »

tstellar wrote: Tue Jul 27, 2021 11:56 pm This should be fixed now in the latest 2.3.3-alpha3 builds.
Ah. That's good to hear. Hopefully you can share the code with gunnar so he can use it in his java version. Although I want to ask. As the original group check was comparing just the team names, do you also go down to the league level and compare the league sid with the team name against the other league sids with the team names? I guess that's the only real way to do it when working with international cups and/or groups in cups, but then you have to compare the original league sid the team is from and hope that there isn't another team with the same name in the same league file. :)

So although you said this SHOULD be fixed now, I will continue to make the definitions the way I have planned and use different group numbers for different continental football associations, just to be safe until a new version is released. And honestly, it kind of makes sense to use different group numbers for different continental football associations anyways.

Will aka will_the_canuck
gunnar
Site Admin
Posts: 233
Joined: Wed Oct 19, 2005 11:13 am
Contact:

Re: Bug in cup tag <group> check with teams of similar names in the same group

Post by gunnar »

will_the_canuck wrote: Wed Jul 28, 2021 10:08 pm Hopefully you can share the code with gunnar so he can use it in his java version.
I'm afraid to say, I'm not sure if that java version will ever come to be.
The reasons for a rewrite were primarily:
  • to give me a fun project where I would feel like working on after work hours.
  • And hopefully attract new developers.
The first point never helped to get me back up to speed. And especially since tstellar has joined, there is less reason to continue on it.
will_the_canuck
Posts: 141
Joined: Tue Jan 16, 2018 5:54 am
Location: Canada

Re: Bug in cup tag <group> check with teams of similar names in the same group

Post by will_the_canuck »

gunnar wrote: Mon Aug 02, 2021 5:52 am
will_the_canuck wrote: Wed Jul 28, 2021 10:08 pm Hopefully you can share the code with gunnar so he can use it in his java version.
I'm afraid to say, I'm not sure if that java version will ever come to be.
The reasons for a rewrite were primarily:
  • to give me a fun project where I would feel like working on after work hours.
  • And hopefully attract new developers.
The first point never helped to get me back up to speed. And especially since tstellar has joined, there is less reason to continue on it.
Ah. Well gunnar, you never know if someday down the road you might try to work on it again, just to see if you can work on it. :) And yes, tstellar is doing a good job working with the code to help fix it up and can hopefully get to those pesky bugs that have been hiding for so long. ;) There are a few choice ones I'd love to see fixed for sure. As for this bug, I think it might even have to go down to the team id to see if there are any duplicates as just having it by the team name, well, on an international stage, there can be some team names that appear in multiple countries and it can surely be interesting, especially if those duplicate team names are up for international spots in tournaments. Oh well.

Beyond that, I hope you're doing well.

Will aka will_the_canuck
Post Reply