private int MakeStatusStone(int x, int y, ref Dictionary <int, int[]> group, ref bool bOpen) { int enemyId = (int)RulesBase[x, y]; group[(x + y) * (x + y + 1) / 2 + y] = new[] { x, y }; StoneWayInfo[] waysInfo = RulesBase.IsSurrounded(x, y, enemyId, new[] { -1, -2 }); foreach (StoneWayInfo info in waysInfo) { switch (info.WayTypeType) { case WayType.Open: bOpen = true; break; case WayType.Friend: int hash = (info.X + info.Y) * (info.X + info.Y + 1) / 2 + info.Y; if (!group.ContainsKey(hash)) { MakeStatusStone(info.X, info.Y, ref group, ref bOpen); } break; } } return(enemyId); }
public override bool MakeStep(int x, int y) { bool bAnswer = RulesBase.Check(Id, x, y); if (bAnswer) { OccupyEnemy(); ClearField(); PassesCount = 0; RulesBase.NextStep(); } return(bAnswer); }
protected PersonBase(int id, bool isBot, RulesBase rulesBase) { Id = id; IsBot = isBot; RulesBase = rulesBase; }
public Player(RulesBase rulesBase, int id) : base(id, false, rulesBase) { RulesBase.AddPlayer(this); }
public Player(RulesBase rulesBase) : base(1, false, rulesBase) { RulesBase.AddPlayer(this); }
public void Pass( ) { PassesCount = 1; RulesBase.NextStep(); }