public Tournament GameWon(Tournament tournament, Game wonGame, Dude dudeWhoWon) { wonGame.MarkWinner(dudeWhoWon); var openGame = tournament.Games().FirstOrDefault(game => game.IsOpen()); if (openGame != null) { openGame.AddDude(dudeWhoWon); } else if (tournament.Games().Any(game => game.IsInProgress())) { tournament.AddGame(new Game(new Dude[] { dudeWhoWon })); } else if (tournament.Games().All(game => game.IsCompleted())) { tournament.MarkWinner(dudeWhoWon); } return(tournament); }
public void AddDude(Dude dude) { _dudes.Add(dude); }
public void MarkWinner(Dude winner) { _winner = winner; }
internal void MarkWinner(Dude dude) { _winner = dude; }