Jump to content
Sign in to follow this  
PawelPepe

Football Championship Group Stage Order

Recommended Posts

I want to write some simple application (the app I've always dreamed of) that will show Football Chamionships (user can enter match results and app will show tables and some statistics).
My problem is sorting groups in Chamionships Group Stage (Quatar 2022).

As we know, there are 8 groups (A-H) with 4 Teams each. Lets focus on Group A.
So, we have 4 teams: A1, A2, A3 and A4. ONLY 2 OF THEM CAN PLAY IN KNOCKOUT STAGE.
How to know which one? Anyone of you solved such problem?

FIFA says:
The ranking of teams in the group stage is determined as follows:
1. Points obtained in all group matches;
2. Goal difference in all group matches;
3. Number of goals scored in all group matches;
4. Points obtained in the matches played between the teams in question;
5. Goal difference in the matches played between the teams in question;
6. Number of goals scored in the matches played between the teams in question;
7. Fair play points in all group matches (only one deduction can be applied to a player in a single match):
   - Yellow card: −1 point;
   - Indirect red card (second yellow card): −3 points;
   - Direct red card: −4 points;
   - Yellow card and direct red card: −5 points;
8. Drawing of lots.


I need to cover 6 points (7 and 8 can be ignored for the moment).

There are 6 matches in Group, each Team play with another from group.
A1:A2 | A3:A4
A1:A3 | A4:A2
A4:A1 | A2:A3

I have no idea how to sort teams with FIFA guidelines.

Have you got any idea? How to cover all conditions in one sort function?

Could you maybe write for me some code to show how to do this? 

 

Ps: If this is to difficult/complex - how much many would it cost for you to write some simple solution for me?

-Pawel

Share this post


Link to post

It's just a lexicographic order. If the primary comparison is equal, move on to the secondary etc until you separate the teams. 

  • Like 1

Share this post


Link to post

Yes, for sure...

However, the problem is implementation. It is easy to sort by points... but then there are other rules.

 

-Pawel

Share this post


Link to post

First you should share your data structure then we can start to discuss how to implement those rules.

Share this post


Link to post

I guess you should just hire a programmer to do the work for you, if you don't know where to start. You already suggested this. Do a kickstarter or similar. 

Share this post


Link to post

You do a sort of the group by criteria 1-3, then you check if there are any ties between teams and build a subset of those teams and do a sort on those by criteria 4-6. That second step is actually similar to the first just that you don't have a full group but only 2 or 3 teams and the results of the matches between those.

Edited by Stefan Glienke

Share this post


Link to post

 

On 5/17/2022 at 2:35 PM, PawelPepe said:

Ps: If this is to difficult/complex - how much many would it cost for you to write some simple solution for me?

If you search this forum, you will see this kind of questions never get any answer here, but you will probably get a response within minutes if you post this as project on freelancer and set your minimum budget.

Edited by Mike Torrettinni

Share this post


Link to post

@David Heffernan@Lajos Juhász @Stefan Glienke@Mike Torrettinni

Thank you for your answers in my thread. Thank you for your tips. I was hoping for a little bit more...

 

I will try to divide sort function to meet all FIFA points. 

It is my private amatour project, so there is no "budget". And nothing happen If I don't create it. Just for fun 🙂

Best regards,

-Pawel

 

 

 

Share this post


Link to post
17 minutes ago, PawelPepe said:

I was hoping for a little bit more...

I suggest showing code that you have here or attach files here (.pas not .zip).  I doubt anybody will download a zip file from external source.

Share this post


Link to post

Use the Rs to help.

  
  Records 
  aRRays of Record //
  Reuse records by Repeat or iteRate 
  Report the UI showing the data
  -additional Array[0..8*4] of TFrame  //later
  -Input First build an app with a 
  Stringgrid.Row[iteRater].commatext := Format('%d , %d ... [data[1],data[2]]) // convert what you have into csv format. 
  Reduce
  -In Design window assign the same event to Controls calling the same procedure. Or assign event when loading UI controls at runtime.
  Use a Reference in that procedure
  - UpdateMatch(AGame: TMatch; Sender as TWinControl.Tag;
  Regulate the UI showing the data against time
  -Future matches use LeftTeam,  RightTeam assigned Record 
  with Nation string set to 'to be determined'   
  -When the game is history the match.LeftTeam is assigned the team 
  
    
  
Use records using keys and several tables using these keys.

TTeam = Record
  TLA, //Key
  Nation: string;  
  Bracket
end;

TMatch = Record
  GMT,LocalTime: TDateTime;
  LeftTeam, RightTeam: TTeam; Keyed to a team or initial value
end;

TGamePlay = Record
  Game: TMatch; Keyed
  Team: TTeam;  Keyed
  Yellows,
  Reds,
  Fouls: Integer;
end;  
  

I would start with two hours reviewing the baseball code   

shared by Ray Konopka.
https://delphibydesign.com/downloads/
DelphiGenerics.zip

 

Pat

 

Share this post


Link to post
On 5/17/2022 at 7:35 PM, PawelPepe said:

how much many would it cost for you to write some simple solution for me?

 

4 hours ago, PawelPepe said:

there is no "budget"

 

difficult to reconcile these two snippets

Share this post


Link to post
1 hour ago, David Heffernan said:

 

 

difficult to reconcile these two snippets

🙂 Yeah....

(I meant I can offer so small (symbolic) money, that I can say - no budget). To be clear.

-Pawel 

Share this post


Link to post

I've downloaded the source. There the data structure is not good for this task. I don't know when will have the time to write some example how would I desing it. This weekend is/was busy for me.

Share this post


Link to post

Thank you all for your help and tips.

This project will be continued in August. Thanks to help from my friend, I think I know how it can be done.

Will see what happen.

-Pawel

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×