Пример #1
0
 public void LadderExactTest()
 {
     for (int i = 19; i < 20; i++)
     {
         var ladder = new Ladder(getTeamIDList(i));
         ladder.GenerateLadder();
         Assert.AreEqual(LadderUtil.GetTierCount(i), ladder.GetTierCount());
     }
 }
Пример #2
0
 public void LadderOddLowerTest()
 {
     for (int i = 1; i < 8; i++)
     {
         var number = Math.Pow(2, i);
         number = number - 1;
         var ladder = new Ladder(getTeamIDList((int)number));
         ladder.GenerateLadder();
         Assert.AreEqual(i, ladder.GetTierCount());
     }
 }
Пример #3
0
        public Ladder Clone()
        {
            var teams = new List<int>();
            foreach (var team in this.teamIDs)
            {
                teams.Add(team);
            }
            Ladder ladder = new Ladder(teams);

            ladder.name = name;
               ladder.currentMatch = currentMatch;
               ladder.teamCount = teamCount;
               ladder.currentTier = currentTier;
               ladder.tierCount = tierCount;
               ladder.tournamentWinnerID = tournamentWinnerID;

               ladder.ladderTiers = new LadderTier[tierCount];
               for (int i = 0; i < tierCount; i++)
               {
               ladder.ladderTiers[i] = ladderTiers[i].Clone();
               }

               return ladder;
        }
Пример #4
0
 private void HandleBtnLadderGenerate_Click(object sender, RoutedEventArgs e)
 {
     var modal = new LadderName();
     modal.SetOwner(mainWindow);
     modal.ShowDialog();
     var action = modal.GetButtonAction();
     if (action.Equals(ButtonAction.DONE))
     {
         var name = modal.GetName();
         var teams = fileHandler.GetTeams().Values;
         MatchResult.SetTeams(fileHandler.GetTeams());
         var teamIDs = new List<int>();
         foreach (var team in teams)
         {
             teamIDs.Add(team.GetTeamID());
         }
         ladder = new Ladder(teamIDs);
         ladder.SetLadderName(name);
         ladder.GenerateLadder();
         var matches = ladder.GetMatches();
         var ladderTab = mainWindow.ladderView;
         fileHandler.SaveLadder(ladder);
         ladderTab.SetMatches(matches);
     }
 }
Пример #5
0
 public void SaveLadder(Ladder ladder)
 {
     ladders.Add(++currentLadder, ladder.Clone());
     ladderCounter++;
 }
Пример #6
0
        public void SaveLadder(Ladder ladder)
        {
            ladders.Add(++currentLadder, ladder.Clone());

            //sql here
            var lq = ladders[currentLadder];
            //var queries = new List<string>();
            //queries.Add(SqlQueries.InsertLadder(currentLadder, lq.GetName(), lq.GetCurrrentMatch, lq.));
            //foreach (var query in queries)
            //{
              //  var command = new SQLiteCommand(query, dbConnection);
                //command.ExecuteNonQuery();
            //}
            ladderCounter++;
        }