void AddRun(TRuns Runs, int dir) { TCell Near; TCheck Who; TCheck W2; TRun R2; Near = Pos.Near(dir); if (Pole.Who(Near, out Who)) { if (Who == null) { Runs.Add(new TRun(this, Near)); } else { if (Who.C != C) { Near = Who.Pos.Near(dir); if (Pole.Who(Near, out W2)) { if (W2 == null) { R2 = new TRun(this, Near); R2.Killed.Add(Who); Runs.Add(R2); } } } } } }
void AddRunKill(TCell StartPos, int dir, TNode Parent) { TCell Near; TCheck Who; TCheck W2; if (StartPos == null) { Near = Pos.Near(dir); } else { Near = StartPos.Near(dir); } if (Pole.Who(Near, out Who)) { if (Who == null) { } else { if (Who.C != C) { Near = Who.Pos.Near(dir); if (Pole.Who(Near, out W2)) { if (W2 == null) { TNode Cur = new TNode(Parent, Near, Who, dir); if (Tree == null) { Tree = new TTree(Cur, Pole); } Tree.Count++; int Count = Tree.Count; for (int i = 1; i <= 4; i++) { if (((dir == 1) && (i == 4)) || ((dir == 2) && (i == 3)) || ((dir == 3) && (i == 2)) || ((dir == 4) && (i == 1))) { continue; } AddRunKill(Near, i, Cur); } if (Count == Tree.Count) { Tree.Lists.Add(Cur); } } } } } } }