// on init, all players are guaranteed at least one turn public bool Initialize(Game game, Players players, int iLoserId = 0) { m_Game = game; bool bRet = false; Player prevLosingPlayer = players[iLoserId]; Add(new Turn(prevLosingPlayer, HandType.attack, Count)); int i = 1; foreach (Player player in players) { if (prevLosingPlayer != player) { Add(new Turn(player, (HandType)(i % 2), Count)); i++; } } if (PlayerType.computer == prevLosingPlayer.GetMode()) { Game.btnDoneGuard = true;//not exactly a short-circuit m_Game.Timed_Response(ResponseType.next_turn_bypass); } bRet = true;//there used to be a try/catch here return(bRet); }
public void outputStatusToWindow(ref GameGui gg) { foreach (Turn turn in this) { Player myPlayer = turn.GetPlayer(); switch (myPlayer.ID) { case 0: gg.lblPlayer0.Content = "Player 0 (" + ((PlayerType.computer == myPlayer.GetMode())?"computer":"human") + ") round " + GetHashCode().ToString() + " turn no. " + turn.GetHashCode().ToString(); Game.WriteToLog(gg.lblPlayer0.Content.ToString()); break; case 1: gg.lblPlayer1.Content = "Player 1 (" + ((PlayerType.computer == myPlayer.GetMode()) ? "computer" : "human") + ") round " + GetHashCode().ToString() + " turn no. " + turn.GetHashCode().ToString(); Game.WriteToLog(gg.lblPlayer1.Content.ToString()); break; case 2: gg.lblPlayer2.Content = "Player 2 (" + ((PlayerType.computer == myPlayer.GetMode()) ? "computer" : "human") + ") round " + GetHashCode().ToString() + " turn no. " + turn.GetHashCode().ToString(); Game.WriteToLog(gg.lblPlayer2.Content.ToString()); break; case 3: gg.lblPlayer3.Content = "Player 3 (" + ((PlayerType.computer == myPlayer.GetMode()) ? "computer" : "human") + ") round " + GetHashCode().ToString() + " turn no. " + turn.GetHashCode().ToString(); break; case 4: gg.lblPlayer4.Content = "Player 4 (" + ((PlayerType.computer == myPlayer.GetMode()) ? "computer" : "human") + ") round " + GetHashCode().ToString() + " turn no. " + turn.GetHashCode().ToString(); break; case 5: gg.lblPlayer5.Content = "Player 5 (" + ((PlayerType.computer == myPlayer.GetMode()) ? "computer" : "human") + ") round " + GetHashCode().ToString() + " turn no. " + turn.GetHashCode().ToString(); break; default: break; } } }