public string chooseStarter(PlayerRegister reg) { ArrayList PlayerList = new ArrayList(); foreach (KeyValuePair <string, Player> pair in reg.dictionary) { PlayerList.Add(pair.Key.ToString()); } return((string)PlayerList[rnd.Next(0, PlayerList.Count)]); }
public void ToObject(string sentence, PlayerRegister reg) { string[] stage1 = sentence.Split(';'); string[] stage11 = stage1[0].Split(','); this.from_str = stage11[0]; this.from = reg.Lookup(stage11[0]); this.to = reg.Lookup(stage11[1]); this.to_str = stage11[1]; string[] stage12 = stage1[1].Split(','); for (int i = 0; i < stage12.Length; i++) { this.action.Add(stage12[i].Split(':')); } }
public void Deal(PlayerRegister reg) { string[] animal_type = { "bat", "fly", "cocktail", "toad", "rat", "scorpion", "spider", "bug" }; ArrayList TotalCardList = new ArrayList(); for (int i = 0; i < 8; i++) { for (int t = 0; t < 8; t++) { TotalCardList.Add(new Card(animal_type[i])); } } int mod = TotalCardList.Count % reg.Count(); int cards_each = (TotalCardList.Count - mod) / reg.Count(); foreach (KeyValuePair <string, Player> pair in reg.dictionary) { for (int i = 0; i < cards_each; i++) { int index = rnd.Next(0, TotalCardList.Count); pair.Value.handcard.Add(TotalCardList[index]); TotalCardList.RemoveAt(index); } } if (mod != 0) { foreach (KeyValuePair <string, Player> pair in reg.dictionary) { if (TotalCardList.Count == 0) { break; } int index = rnd.Next(0, TotalCardList.Count); pair.Value.handcard.Add(TotalCardList[index]); TotalCardList.RemoveAt(index); } } }
public Sentence(string sentence, PlayerRegister reg) { this.ToObject(sentence, reg); }
public void Deal(PlayerRegister reg) { string[] animal_type = { "bat", "fly", "cocktail", "toad", "rat", "scorpion", "spider", "bug" }; ArrayList TotalCardList = new ArrayList(); for (int i = 0; i < 8; i++) { for (int t = 0; t < 8; t++) { TotalCardList.Add(new Card(animal_type[i])); } } int mod = TotalCardList.Count % reg.Count(); int cards_each = (TotalCardList.Count - mod) / reg.Count(); foreach (KeyValuePair<string, Player> pair in reg.dictionary) { for (int i = 0; i < cards_each; i++) { int index = rnd.Next(0, TotalCardList.Count); pair.Value.handcard.Add(TotalCardList[index]); TotalCardList.RemoveAt(index); } } if (mod != 0) { foreach (KeyValuePair<string, Player> pair in reg.dictionary) { if (TotalCardList.Count == 0) break; int index = rnd.Next(0, TotalCardList.Count); pair.Value.handcard.Add(TotalCardList[index]); TotalCardList.RemoveAt(index); } } }
public string chooseStarter(PlayerRegister reg) { ArrayList PlayerList = new ArrayList(); foreach (KeyValuePair<string, Player> pair in reg.dictionary) { PlayerList.Add(pair.Key.ToString()); } return (string)PlayerList[rnd.Next(0, PlayerList.Count)]; }