public PokerPlayer[] PlayersWithStatus(Status status) { ArrayList list = new ArrayList(); for (int i = 0; i < Players.Length; i++) { if (Players[i] != null && Players[i].Status == status) list.Add(Players[i]); } PokerPlayer[] players = new PokerPlayer[list.Count]; for (int i = 0; i < list.Count; i++) players[i] = (PokerPlayer)list[i]; return players; }
private int NextValidIndex(int index, Status comparestatus) { for (int i = index + 1; i < Players.Length; i++) if (Players[i] != null && Players[i].Status == comparestatus) return i; for (int i = 0; i < index; i++) if (Players[i] != null && Players[i].Status == comparestatus) return i; return index; }