public GameEntry GetWinner(IList <string[, ]> tournament) { IList <string[, ]> winners = new List <string[, ]>(); string[,] buffer = null; for (int i = 0; i < tournament.Count; i++) { var game = tournament[i]; var currentWinner = GameEntryAdapter.GetStringArrayGameEntry(GetWinner(game)); if (buffer == null) { buffer = currentWinner; } else { buffer = MountGame(buffer, currentWinner); winners.Add(buffer); buffer = null; } } if (winners.Count > 1) { return(GetWinner(winners)); } else { return(GetWinner(winners.First())); } }
public GameEntry GetWinner(string[,] gameEntry) { Validate(gameEntry); var winnerGameEntry = GetWinner(GameEntryAdapter.GetGameEntries(gameEntry)); return(winnerGameEntry); }