static void Game(ref Prisoner a, ref Prisoner b, int round) { // ^我後來發現這邊寫法有點多此一舉,物件作為引數被讀入後,本來就是傳址,不是傳值。故不用ref switch (a.LastChoice) { case (Decision.COOPERATE): if (b.LastChoice == Decision.COOPERATE) { // win-win a.score += 3; b.score += 3; } else { // b win b.score += 5; } break; case (Decision.BETRAY): if (b.LastChoice == Decision.COOPERATE) { // a win a.score += 5; } else { // Both Betray a.score += 1; b.score += 1; } break; } ScoreBoard(ref a, ref b, round); Decision a_choice = a.LastChoice, b_choice = b.LastChoice; a.Action(b_choice); b.Action(a_choice); }// End of void Game