Stano 143 Posted May 30, 2023 Team competition - how to do it Please advise. I'm sure there are some good ideas here. I have a rough idea, but it's severely lame. I'm asking for your suggestion on how to solve it and a suggestion for classes. That is, a methodology. I am not asking for the actual implementation. Problem to be solved: competition of cooperatives. Specifically football. It's in two stages. I want to solve each stage separately. The pictures tell more. 1) The first picture shows what the individual trees will look like in the elimination rounds. The elimination rounds, where everyone plays everyone The winners in the round will be dragged into the right tree 2) KO system All actions are always confirmed only for complete data and only once - the "Apply" button I will write everything in the DB. Share this post Link to post
Stano 143 Posted May 31, 2023 Something like that. To make it easier for you to comment. Share this post Link to post
Der schöne Günther 316 Posted May 31, 2023 Maybe the heat is killing me, but I can't follow how some GUI elements (Labels, Checkboxes) go together with booleans, tags and "round type"s. Are you looking for recommendations of how to display this tournament process on screen? Do you want to know how to best store matches in a relational database? I have no idea. You probably have some written requirements, like a formal document or user stories. This should then enable you to figure out how your data works inside your application. Share this post Link to post
Stano 143 Posted May 31, 2023 1) Let's just look at the left part: group round It's a familiar scheme. Nevertheless, I find it very difficult to explain. ===== 2) I have the basic data written in the application. I have specified: teams in the first "Group round" number of Group round dynamically created graph for KO system That's all. ===== 3) In the meantime, I've decided that it will be good if all nodes in the Group round will have CheckBoxes. At the level of 0 (Group) they have no role 1 check mark means the advancing team ===== 4) The user's task is to move the advancing team to the adjacent right tree. If this is OK, the user will confirm this. Based on that, I will generate the teams in groups for that round. Here we handle this with the WriteToDB function ===== 6) It is up to the user whether to have it generated: matches (including rematches) list of players in each match These two points are not the task of this solution. Nor is entering data for the matches part of this task. ===== 7) I need to create the conditions to be able to: ReadFromDB: populate individual trees - I don't see a problem here hide unnecessary Group round in the code to accurately identify the individual rounds. So that I can set properties for them. For example: hidden, inaccessible, active. I don't need to identify the teams HERE. Then trees are enough for me. At least that's what I think. Write the result using WriteToDB 8) I'm not dwelling on the DB structure and working with it right now. That will follow smoothly from the problem itself. It's beyond the scope of this problem. ===== 9) The challenge is to design for point 7) correctly: data structures classes and their functions/methods Only the names of the functions, which will explain their operation - are sufficient. 1 Share this post Link to post
Pat Foley 51 Posted May 31, 2023 I would go data driven ie bottom up * //who, what, when and where TeamPlayEvent = record Stadium, Date: Variant Case Scheduled: Boolean; else Lost: Boolean; end; Eachteam = Tlist<TeamPlayEvent> *Proposed Top down could easily write these future games to said scheme. Share this post Link to post
Stano 143 Posted May 31, 2023 I don't understand part of the case. It doesn't say "condition". case condition of That is why I do not understand the whole proposal either. Share this post Link to post
David Schwartz 426 Posted May 31, 2023 Try explaining it so a 5th grader could understand it. Managing league playoffs is nothing new. It happens for most sports here in America every year. Is what you're doing any different? For instance, are you looking to sovle a single-elimination tournament, double-elimination tournament, or something more complicated? Start with that. Forget the implementation for now. (Yes, I know you're trying to build something, but you haven't explained WHAT yet, and are talking about the building blocks already.) Share this post Link to post
Pat Foley 51 Posted June 1, 2023 4 hours ago, David Schwartz said: Try explaining it so a 5th grader could understand it. Now it's needed to explain so AI can understand it and not make an EOW. (End of World).🙂 By making the program data driven that is each event of the assets is recorded. We can fish out the UI and/or answers later. Complex flat files and top-down approach not needed for every problem. I added a variant record to post above which isn't used much so removed it. unit SoccerDB; interface uses // use only whats needed Generics.Collections; //System.Classes, Vcl.ExtCtrls, needed for tying into UI type TGameStatus = (gsLeftScheduled, gsRightScheduled, gsPlaying, gameWon, gameLost, gameIssue); TTeam = record TLA, Country: String; Flag: NativeInt; //pointer to flag end; PGame = ^TGame; TGame = Record Team: TTeam; Location: string; Time, Over: TDateTime; // rather than messing with variant records Status: TGameStatus; Key: integer; Avator: NativeInt; //pointer to Bitmap of location End; TGames = class(Tlist<PGame>) //UIin, UIout: TControls here procedure GetTeamsPlayingBetweenTheseTimes(Start, Stop: TDateTime;var theTeams: Tarray<string>); procedure SetTeamPlayingatthisTime(Start: TDateTime; ATeam: TTeam); end; implementation { TGames } procedure TGames.GetTeamsPlayingBetweenTheseTimes(Start, Stop: TDateTime; var theTeams: Tarray<string>); begin SetLength(TheTeams,2); TheTeams[0] := 'USA'; TheTeams[1] := 'Brazil'; //first get teams playing in time slice // then sort by location end; procedure TGames.SetTeamPlayingatthisTime(Start: TDateTime; ATeam: TTeam); begin // make event records here. end; end. Call it here implementation {$R *.dfm} uses SoccerDB; var Soccer2023: TGames; procedure TForm6.Button1Click(Sender: TObject); var aOutPut: TArray<string>; s: string; begin Soccer2023:= TGames.Create; Soccer2023.GetTeamsPlayingBetweenTheseTimes(0,0,aoutPut); for s in AOutpUt do ListBox1.Items.add(s); ListBox1.Items.add('Done'); end; Share this post Link to post
Stano 143 Posted June 1, 2023 (edited) I have found that for me, the best method to use in this case is the small incremental steps method. Per partes. That way the solution to the problem gradually emerges from the depths. Looks like I'm on the right track. Unfortunately, I can't explain it any better. I prefer classes for the record. I'm very fond of generics. I don't have to deal with performance. Thanks to all involved for trying to help me. Edited June 1, 2023 by Stano Share this post Link to post