public void UpdateActive(Solver solver) { if (Type > 5 && Type < 12 && Type != solver.MetalLevel) { return; } var count = 0; for (var i = 0; i < 8; i++) { //going around var x = HexMath.XInDirection(X, Y, i % 6); var y = HexMath.YInDirection(Y, i % 6); if (solver.Marbles[x * 13 + y] != null) { count = 0; } else { count++; } if (count == 3) { solver.ActiveMarbles.Add(this); return; } } }
public void UpdateNeighbours(Solver solver) { for (var i = 0; i < 6; i++) { solver.Marbles[HexMath.XInDirection(X, Y, i % 6) * 13 + HexMath.YInDirection(Y, i % 6)]? .UpdateActive(solver); } }