public IEnumerable <GameState> Play() { if (IsWolf) { foreach (Pos p in PosWolf.GetWolfMoves()) { byte w = p.ByteVal; if (w != S0 && w != S1 && w != S2 && w != S3 && w != S4) { yield return(MakeNewGameStateWolf(p)); } } } else { byte[] sheep = new byte[] { S0, S1, S2, S3, S4 }; foreach (byte olds in sheep) { foreach (Pos pNewSheep in new Pos(olds).GetSheepMoves()) { byte news = pNewSheep.ByteVal; if (news == W || news == S0 || news == S1 || news == S2 || news == S3 || news == S4) { continue; } yield return(MakeNewGameStateSheep(sheep, olds, news)); } } } }
public Pos[] GetValidWolfMoves() { List <Pos> list = new List <Pos>(); foreach (Pos p in PosWolf.GetWolfMoves()) { byte by = p.ByteVal; if (by != S0 && by != S1 && by != S2 && by != S3 && by != S4) { list.Add(p); } } return(list.ToArray()); }