public override void SeeAction(Stage stage, int playerNum, ActionType action, int amount) { // this is called to inform you when any player (including yourself) makes an action (eg puts in blinds, checks, folds, calls, raises, or wins hand) if (action == ActionType.Win) { string firstHand, secondHand; bool bFirstHandWon = false; if (string.Compare(_playerHand[0], _playerHand[1]) < 0) { firstHand = _playerHand[0]; secondHand = _playerHand[1]; bFirstHandWon = (playerNum == 0); } else { firstHand = _playerHand[1]; secondHand = _playerHand[0]; bFirstHandWon = (playerNum == 1); } Dictionary <string, PocketClassStats> dict; if (!pocketStats.ContainsKey(firstHand)) { dict = new Dictionary <string, PocketClassStats>(); pocketStats.Add(firstHand, dict); } else { dict = pocketStats[firstHand]; } PocketClassStats pcs; if (!dict.ContainsKey(secondHand)) { pcs = new PocketClassStats(secondHand); dict.Add(secondHand, pcs); } else { pcs = dict[secondHand]; } pcs.NumSeen++; if (bFirstHandWon) { pcs.NumWinners++; } } }
public override void EndOfGame(int numPlayers, List <PlayerInfo> players) { _handNum++; foreach (KeyValuePair <string, Dictionary <string, PocketClassStats> > dict in pocketStats) { foreach (KeyValuePair <string, PocketClassStats> pair in dict.Value) { PocketClassStats pcs = pair.Value; _tw.WriteLine("{0}\t{1}\t{2}\t{3}", dict.Key, pcs.PocketClass, pcs.NumWinners, pcs.NumSeen); } } // close the stream _tw.Close(); }