public override bool is_condition_met(List <List <int> > hand, params object[] args) { int honor = 0; int sou = 0; int pin = 0; int man = 0; foreach (var group in hand) { if (C.HONOR_INDICES.Contains(group[0])) { honor++; } if (U.is_sou(group[0])) { sou++; } else if (U.is_man(group[0])) { man++; } else if (U.is_pin(group[0])) { pin++; } } return(honor > 0 && ((sou > 0 && pin + man == 0) || (man > 0 && pin + sou == 0) || (pin > 0 && sou + man == 0) )); }
public override bool is_condition_met(List <List <int> > hand, params object[] args) { int sou = 0; int pin = 0; int man = 0; int honor = 0; if (U.is_sou(hand[0][0])) { sou++; } else if (U.is_pin(hand[0][0])) { pin++; } else if (U.is_man(hand[0][0])) { man++; } else { honor++; } bool allowOtherSets = (bool)args[0]; bool onlyOneSuit = sou + pin + man + honor == 1; if (!onlyOneSuit || honor > 0) { return(false); } if (!allowOtherSets && pin == 0) { //if we are not allowing other sets than pins return(false); } var indicesCount = new int[9]; foreach (var set in hand) { foreach (var tile in set) { indicesCount[U.simplify(tile)]++; } } foreach (var count in indicesCount) { if (count != 2) { return(false); } } return(true); }
public void rename(List <List <int> > hand) { if (U.is_sou(hand[0][0])) { this.name = "Daichikurin"; } else if (U.is_pin(hand[0][0])) { this.name = "Daisharin"; } else if (U.is_man(hand[0][0])) { this.name = "Daisuurin"; } }
public override bool is_condition_met(List <List <int> > hand, params object[] args) { var chis = hand.Where(x => Utils.is_chi(x)); if (chis.Count() < 3) { return(false); } var sou = new List <List <int> >(); var pin = new List <List <int> >(); var man = new List <List <int> >(); foreach (var chi in chis) { if (U.is_sou(chi[0])) { sou.Add(chi); } else if (U.is_man(chi[0])) { man.Add(chi); } else if (U.is_pin(chi[0])) { pin.Add(chi); } } var suits = new List <List <List <int> > > { sou, man, pin }; var one = new List <int> { 0, 1, 2 }; var two = new List <int> { 3, 4, 5 }; var three = new List <int> { 6, 7, 8 }; var comp = new GroupComparer <int>(); foreach (var suit in suits) { if (suit.Count() < 3) { continue; } var simpleSets = new List <List <int> >(); foreach (var set in suit) { simpleSets.Add(new List <int> { U.simplify(set[0]), U.simplify(set[1]), U.simplify(set[2]) }); } if (simpleSets.Contains(one, comp) && simpleSets.Contains(two, comp) && simpleSets.Contains(three, comp)) { return(true); } } return(false); }