public AIData(EDivision InDiv, ERound InRound, EPool InPool, int InTeam) { Division = InDiv; Round = InRound; Pool = InPool; Team = InTeam; }
public void Init(MainWindow parent, ERound inRound, EPool inPool) { parentWindow = parent; round = inRound; pool = inPool; }
public ResultsData(EDivision InDiv, ERound InRound, EPool InPool) { Division = InDiv; Round = InRound; Pool = InPool; }
public DiffData(int InNumScores, EDivision InDiv, ERound InRound, EPool InPool, int InTeam) { NumScores = InNumScores; Division = InDiv; Round = InRound; Pool = InPool; Team = InTeam; }
public void SetRoutineLength(ERound inRound, ERoutineLength length) { RoundData rd = GetRoundData(inRound); if (rd != null) { rd.routineLength = RoutineLengthToFloat(length); } }
public static TeamData GetTeamData(EDivision InDiv, ERound InRound, EPool InPool, int InTeam) { if (!DataExists(InDiv, InRound, InPool, InTeam)) { return(null); } return(Global.AllData.AllDivisions[(int)InDiv].Rounds[(int)InRound].Pools[(int)InPool].Teams[InTeam].Data); }
public static bool saveScores(double date, float[]?scores, ERound round) { //update the data correctly var v = data.addNewScore(new JSONScore(date, scores), round); new Thread(serializeAndSave).Start(); return(v); }
private void FillPoolTeams(EDivision division, ERound round, List <TeamData> teams, bool bClearPreviousTeams) { int rawPoolIndex = 0; int adjustedPoolIndex = 0; bool bReversePoolAssignmentDirection = false; RoundData rd = tournamentData.GetRound(division, round); int maxPoolCount = rd.pools.Count; if (bClearPreviousTeams) { for (int poolIndex = 0; poolIndex < maxPoolCount; ++poolIndex) { PoolData pd = tournamentData.GetPool(division, round, (EPool)poolIndex); pd.teamList.teams.Clear(); } } for (int teamIndex = 0; teamIndex < teams.Count; ++teamIndex) { if (rawPoolIndex >= maxPoolCount) { bReversePoolAssignmentDirection = !bReversePoolAssignmentDirection; rawPoolIndex = 0; if (bReversePoolAssignmentDirection) { adjustedPoolIndex = maxPoolCount - 1; } else { adjustedPoolIndex = 0; } } PoolData pd = tournamentData.GetPool(division, round, (EPool)adjustedPoolIndex); pd.teamList.teams.Add(teams[teamIndex]); if (bReversePoolAssignmentDirection) { --adjustedPoolIndex; } else { ++adjustedPoolIndex; } ++rawPoolIndex; } // Reverse the teams in the pool so first play is at the top foreach (PoolData pd in rd.pools) { pd.teamList.teams = new ObservableCollection <TeamData>(pd.teamList.teams.Reverse()); } PoolsUpdateBindings(); }
public static bool DataExists(EDivision InDiv, ERound InRound, EPool InPool, int InTeam) { if (Global.AllData == null || InPool == EPool.None || (int)InPool >= Global.AllData.AllDivisions[(int)InDiv].Rounds[(int)InRound].Pools.Count || InTeam < 0 || InTeam >= Global.AllData.AllDivisions[(int)InDiv].Rounds[(int)InRound].Pools[(int)InPool].Teams.Count) { return(false); } return(true); }
private bool TryGetAutoGeneratePools(EDivision division, ERound round, EPool pool, out PoolData pool1, out PoolData pool2, out PoolData nextPool) { if (round == ERound.Quarterfinals) { if (pool == EPool.A || pool == EPool.C) { pool1 = tournamentData.GetPool(division, ERound.Quarterfinals, EPool.A); pool2 = tournamentData.GetPool(division, ERound.Quarterfinals, EPool.C); nextPool = tournamentData.GetPool(division, ERound.Semifinals, EPool.A); } else { pool1 = tournamentData.GetPool(division, ERound.Quarterfinals, EPool.B); pool2 = tournamentData.GetPool(division, ERound.Quarterfinals, EPool.D); nextPool = tournamentData.GetPool(division, ERound.Semifinals, EPool.B); } } else if (round == ERound.Semifinals) { pool1 = tournamentData.GetPool(division, ERound.Semifinals, EPool.A); pool2 = tournamentData.GetPool(division, ERound.Semifinals, EPool.B); nextPool = tournamentData.GetPool(division, ERound.Finals, EPool.A); } else { pool1 = null; pool2 = null; nextPool = null; return(false); } if (pool1.resultRank.Count > 0 && pool2.resultRank.Count > 0) { foreach (int rank in pool1.resultRank) { if (rank == 0) { return(false); } } foreach (int rank in pool2.resultRank) { if (rank == 0) { return(false); } } return(true); } return(false); }
public static ERoundDisplay ConvertRoundValue(ERound round) { if (round == ERound.None) { return(ERoundDisplay.None); } else { return((ERoundDisplay)round); } }
public RoundData GetRoundData(ERound inRound) { RoundData rd = parentWindow.tournamentData.GetRound(division, inRound); if (rd != null) { return(rd); } return(null); }
public ERoutineLength GetRoutineLength(ERound inRound) { RoundData rd = GetRoundData(inRound); if (rd != null) { return(RoutineLengthFromFloat(rd.routineLength)); } return(ERoutineLength.None); }
public ExData(ExData InData) { JudgeNameId = InData.JudgeNameId; Division = InData.Division; Round = InData.Round; Pool = InData.Pool; Team = InData.Team; Point1Count = InData.Point1Count; Point2Count = InData.Point2Count; Point3Count = InData.Point3Count; Point5Count = InData.Point5Count; }
public static TeamData GetTeamData(EDivision InDiv, ERound InRound, int InPool, int InTeam) { if ((int)InDiv < Global.AllData.AllDivisions.Length && (int)InRound < Global.AllData.AllDivisions[(int)InDiv].Rounds.Length && InPool < Global.AllData.AllDivisions[(int)InDiv].Rounds[(int)InRound].Pools.Count && InTeam < Global.AllData.AllDivisions[(int)InDiv].Rounds[(int)InRound].Pools[InPool].Teams.Count) { return(Global.AllData.AllDivisions[(int)InDiv].Rounds[(int)InRound].Pools[InPool].Teams[InTeam].Data); } return(null); }
public void GenerateFuturePools() { for (EDivision division = EDivision.Open; division < EDivision.Max; ++division) { for (ERound round = ERound.Finals; round != ERound.Max; ++round) { for (EPool pool = EPool.A; pool != EPool.Max; ++pool) { GenerateNextPool(division, round, pool); } } } }
public static bool IsValid(EDivision InDivision, ERound InRound, EPool InPool, int InTeam) { if ((int)InDivision >= 0 && (int)InRound >= 0 && InPool >= 0 && InTeam >= 0 && (int)InDivision < Global.AllData.AllDivisions.Length && (int)InRound < Global.AllData.AllDivisions[(int)InDivision].Rounds.Length && (int)InPool < Global.AllData.AllDivisions[(int)InDivision].Rounds[(int)InRound].Pools.Count && InTeam < Global.AllData.AllDivisions[(int)InDivision].Rounds[(int)InRound].Pools[(int)InPool].Teams.Count) { return(true); } return(false); }
public void InitMaxTeams(EDivision inDivision, ERound inRound) { if (inRound == ERound.Finals) { if (inDivision == EDivision.Coop || inDivision == EDivision.Women || inDivision == EDivision.Mixed) { maxTeams = 6; return; } } maxTeams = 8; }
public DiffData(DiffData InData) { JudgeNameId = InData.JudgeNameId; Division = InData.Division; Round = InData.Round; Pool = InData.Pool; Team = InData.Team; NumScores = InData.NumScores; for (int i = 0; i < InData.DiffScores.Length; ++i) { DiffScores[i] = InData.DiffScores[i]; ConsecScores[i] = InData.ConsecScores[i]; } }
public AIData(AIData InData) { JudgeNameId = InData.JudgeNameId; Division = InData.Division; Round = InData.Round; Pool = InData.Pool; Team = InData.Team; Variety = InData.Variety; Teamwork = InData.Teamwork; Music = InData.Music; Flow = InData.Flow; Form = InData.Form; General = InData.General; }
public RoundData GetRound(EDivision division, ERound round) { int divisionIndex = (int)division; if (divisionIndex >= 0 && divisionIndex < (int)EDivision.Max) { int roundIndex = (int)round; if (roundIndex >= 0 && roundIndex < (int)ERound.Max) { return(divisions[divisionIndex].rounds[roundIndex]); } } return(new RoundData()); }
// Update is called once per frame public void Update() { Global.NetObj.UpdateUdpListener(); Global.NetObj.UpdateHeadJudgeState(); CurDivision = (EDivision)DivisionCombo.GetSelectedItemIndex(); CurRound = (ERound)RoundCombo.GetSelectedItemIndex(); UpdateConnectedJudgeList(ref AIJudges); UpdateConnectedJudgeList(ref ExJudges); UpdateConnectedJudgeList(ref DiffJudges); UpdateActiveJudgingJudgersCount(); }
public static ResultsData FindResultsData(EDivision InDiv, ERound InRound, EPool InPool) { if (Global.AllData.ResultsList == null) { return(null); } foreach (ResultsData rd in Global.AllData.ResultsList) { if (rd.Division == InDiv && rd.Round == InRound && rd.Pool == InPool) { return(rd); } } return(null); }
void ImportDivisionData(TournamentData importedData, XmlNode node, EDivision division) { DivisionData divisionData = new DivisionData(division); foreach (XmlNode roundNode in node.ChildNodes) // Rounds { ERound round = ERound.Finals; foreach (XmlNode roundDataNode in roundNode.ChildNodes) { RoundData roundData = new RoundData(division, round); EPool pool = EPool.A; foreach (XmlNode poolDataNode in roundDataNode.FirstChild.ChildNodes) // Pools { PoolData poolData = new PoolData(pool); foreach (XmlNode poolDataChildNode in poolDataNode.ChildNodes) { if (poolDataChildNode.Name == "PoolName") { poolData.pool = (EPool)Enum.Parse(typeof(EPool), poolDataChildNode.FirstChild.Value); } else if (poolDataChildNode.Name == "Teams") { ImportTeams(importedData, divisionData, poolData, poolDataChildNode); ImportJudges(importedData, divisionData, poolData, poolDataChildNode); } else if (poolDataChildNode.Name == "ResultsByTeamIndex") { ImportPoolResults(poolData, poolDataChildNode); } } roundData.pools.Add(poolData); ++pool; } divisionData.rounds.Add(roundData); ++round; } } importedData.divisions.Add(divisionData); }
public PoolData GetPool(EDivision division, ERound round, EPool pool) { int divisionIndex = (int)division; if (divisionIndex >= 0 && divisionIndex < (int)EDivision.Max) { int roundIndex = (int)round; if (roundIndex >= 0 && roundIndex < (int)ERound.Max) { int PoolIndex = (int)pool; if (PoolIndex >= 0 && PoolIndex < divisions[divisionIndex].rounds[roundIndex].pools.Count) { return(divisions[divisionIndex].rounds[roundIndex].pools[PoolIndex]); } } } return(new PoolData()); }
public int GetPoolCount(ERound round) { switch (round) { case ERound.Finals: return(1); case ERound.Semifinals: return(2); case ERound.Quarterfinals: return(4); case ERound.Prelims: return(4); default: return(0); } }
private void PoolsRandomizePlayOrder(EDivision division, ERound round) { RoundData rd = tournamentData.GetRound(poolsDivision, round); foreach (PoolData pd in rd.pools) { ObservableCollection <TeamData> teams = pd.teamList.teams; ObservableCollection <TeamData> newTeamList = new ObservableCollection <TeamData>(); while (teams.Count > 0) { int pickIndex = random.Next(0, teams.Count()); newTeamList.Add(teams[pickIndex]); teams.RemoveAt(pickIndex); } pd.teamList.teams = newTeamList; } PoolsUpdateBindings(); }
private void CbRound_SelectionChanged(object sender, SelectionChangedEventArgs e) { switch (cbRound.SelectedItem) { case "FITA 18": eRound = ERound.Fita18; break; case "Portsmouth": eRound = ERound.Portsmouth; break; case "WA1440": eRound = ERound.WA1440; break; case "WA720": eRound = ERound.WA720; break; } }
private string[] validScores = { "M", "m", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" }; //TODO: Add X for 10, and 11 for relevant imperial rounds public ScoreEntry(ERound round, EBowStyle bowStyle, int archers, RoundSelect rs) { InitializeComponent(); this.rs = rs; eRound = round; eBowStyle = bowStyle; nArchers = archers; if (round == ERound.Fita18 || round == ERound.Portsmouth) { nArrows = 3; nTotalEnds = 20; } else { nArrows = 6; if (round == ERound.WA1440) { nTotalEnds = 24; } else { nTotalEnds = 12; } } nEnd = 1; labelEnd.Content = "End " + nEnd + " of " + nTotalEnds; lArrows = new UIRing <FletchedGraphic>(nArrows); if (nArchers == 1) { bnNextArcher.Content = "Score"; } archer = new Archer(); //TODO: add more depending on nArchers tempScore = new Ring <int>(nArrows); SetupTargetGraphics(); SetupScoreEntryBoxes(); }
public void GenerateNextPool(EDivision division, ERound round, EPool pool) { PoolData pool1; PoolData pool2; PoolData nextPool; if (!TryGetAutoGeneratePools(division, round, pool, out pool1, out pool2, out nextPool)) { return; } var nextPoolTeams = nextPool.teamList.teams; nextPoolTeams.Clear(); if (nextPoolTeams.Count == 0) { var pool1Teams = pool1.teamList.teams; var pool2Teams = pool2.teamList.teams; int maxTeamsInPool = Math.Max(pool1Teams.Count, pool2Teams.Count); for (int rank = 1; rank <= maxTeamsInPool; ++rank) { int teamIndex1 = GetRankTeamIndex(pool1.resultRank, rank); int teamIndex2 = GetRankTeamIndex(pool2.resultRank, rank); if (teamIndex1 < 0) { nextPoolTeams.Insert(0, pool2Teams[teamIndex2]); continue; } else if (teamIndex2 < 0) { nextPoolTeams.Insert(0, pool1Teams[teamIndex1]); continue; } if (teamIndex1 >= pool1Teams.Count || teamIndex2 >= pool2Teams.Count) { break; } if (GetTeamRankingPoints(pool1Teams[teamIndex1]) < GetTeamRankingPoints(pool2Teams[teamIndex2])) { nextPoolTeams.Insert(0, pool2Teams[teamIndex2]); nextPoolTeams.Insert(0, pool1Teams[teamIndex1]); } else { nextPoolTeams.Insert(0, pool1Teams[teamIndex1]); nextPoolTeams.Insert(0, pool2Teams[teamIndex2]); } if (nextPoolTeams.Count >= GetMaxTeamsForPool(division, round)) { break; } } } else { // Warning about not being able to generate next teams pools because there is already data } }