void samecolor(BrandPlayer q) { int num = 0; //bool index = false; for (int i = 0; i < q.getCount(); i++) { if (q.getBrand(i).getClass() == "字") { num++; } } if (num == q.getCount()) { textBox1.Text += "字一色\r\n"; tally += 8; } num = 0; for (int i = 0; i < q.getCount() - 1; i++) { if (q.getBrand(i).getClass() == q.getBrand(i + 1).getClass() && q.getBrand(i).getClass() != "字") { num++; } } if (num == q.getCount() - 1) { textBox1.Text += "清一色\r\n"; tally += 8; } num = 0; for (int i = 0; i < q.getCount(); i++) { if (q.getBrand(i).getClass() == "字") { index = true; q.remove(q.getBrand(i)); i -= 1; } } if (index == true) { for (int i = 0; i < q.getCount() - 1; i++) { if (q.getBrand(i).getClass() == q.getBrand(i + 1).getClass() && q.getBrand(i).getClass() != "字") { num++; } } if (num == q.getCount() - 1) { textBox1.Text += "混一色\r\n"; tally += 4; } num = 0; } index = false; }
Brand nextTableBrand() { Brand b = table.getBrand(0); table.remove(b); lastBrand = b; return(b); }
private void bradn_4() { if (x.getCount() > 31) { throw new ErrorBrandPlayerCountException(); } if (x.getCount() >= 17) { for (int i = 0; i < x.getCount() - 3; i++) { if (x.getBrand(i).getClass() == x.getBrand(i + 1).getClass() && x.getBrand(i).getNumber() == x.getBrand(i + 1).getNumber() && x.getBrand(i).getClass() == x.getBrand(i + 2).getClass() && x.getBrand(i).getNumber() == x.getBrand(i + 2).getNumber() && x.getBrand(i).getClass() == x.getBrand(i + 3).getClass() && x.getBrand(i).getNumber() == x.getBrand(i + 3).getNumber() && x.getBrand(i).Team > 1 && x.getBrand(i).Team == x.getBrand(i + 1).Team&& x.getBrand(i + 1).Team == x.getBrand(i + 2).Team&& x.getBrand(i + 2).Team == x.getBrand(i + 3).Team) { // 碰的牌組 if (a.getCount() == 0) { a.add(x.getBrand(i)); a.add(x.getBrand(i + 1)); a.add(x.getBrand(i + 2)); x.remove(x.getBrand(i)); // a.add(x.getBrand(i + 3)); } else if (x.getBrand(i) != a.getBrand(a.getCount() - 3) && x.getBrand(i + 1) != a.getBrand(a.getCount() - 2) && x.getBrand(i + 2) != a.getBrand(a.getCount() - 1)) //x.getBrand(i + 3) != a.getBrand(a.getCount())) { a.add(x.getBrand(i)); a.add(x.getBrand(i + 1)); a.add(x.getBrand(i + 2)); x.remove(x.getBrand(i)); // a.add(x.getBrand(i + 3)); } } // 碰的牌組 } } }
BrandPlayer removefromplayer(Iterator iterator, BrandPlayer re) { while (iterator.hasNext()) { Brand brand = (Brand)iterator.next(); //re.remove(brand); Console.WriteLine(">>{0}", re.remove(brand)); } return(re); }
/// <summary> /// 分配牌 /// </summary> public void DealBrands() { BrandPlayer temp = new BrandPlayer(); // 讀出數量的牌,並移除 for (int i = 0; i < countplayer * countbrands; i++) { Brand brand = table.getBrand(i); temp.add(brand); table.remove(brand); } // 把牌加入玩家 for (int i = 0; i < temp.getCount(); i++) { player[i % countplayer].add(temp.getBrand(i)); } }