/*************** GAME PLAY FUNCTIONS ****************************/ // Plays a game and returns a list of the winners // // Assumes all players have already been initialized public List <SPlayer> play(List <SPlayer> players) { initializeDrawPile("drawPilepaths.txt"); Board b = new Board(); activePlayers = players; // Set start positions foreach (SPlayer p in players) { p.placePawn(b); } dealTiles(players, b); // Continue game play until there are winners List <SPlayer> winners = null; while (winners == null) { SPlayer p = activePlayers[0]; Tile tileToPlay = p.playTurn(b, drawPile.Count); // Check for cheating player bool cheating = isCheating(p, b, tileToPlay); if (cheating) { // Replace cheating player with random player Console.WriteLine(p.getColor() + " was cheating - being replaced with random player."); RandomPlayer replacementPlayer = new RandomPlayer(); replacementPlayer.initialize(p.getColor(), getActivePlayerColors()); p.setStrategy(replacementPlayer); tileToPlay = p.playTurn(b, drawPile.Count); } TurnResult tr = playATurn(b, tileToPlay); // Update status of game, based on turn winners = tr.playResult; b = tr.b; } return(winners); }