public void ChangePlate(GamePoint point) { GamePoint point1 = new GamePoint(point.X, point.Y); if (ProverkaLine(point)) { Cell.ColorCell color = Place[point1.X, point1.Y].GetColor; GamePoint res = FindPoint(point); Score += (int)Math.Pow(Change(res, Place[point.X, point.Y].GetColor), 2); Random random = new Random(); Place[point1.X, point1.Y].ChangeColotInt(random.Next(5)); } }
int Change(GamePoint point, Cell.ColorCell color) { if (point.X < 0 || point.X > 15 || point.Y < 0 || point.Y > 15) { return(0); } if (Place[point.X, point.Y].GetColor != color) { return(0); } Cell.ColorCell color1 = Place[point.X, point.Y].GetColor; Place[point.X, point.Y].GetColor = Cell.ColorCell.White; return(1 + Change(new GamePoint(point.X + 1, point.Y), color1) + Change(new GamePoint(point.X - 1, point.Y), color1) + Change(new GamePoint(point.X, point.Y + 1), color1) + Change(new GamePoint(point.X, point.Y - 1), color1)); }
public static Color ConvertColorCellToColor(Cell.ColorCell color) { if (color == Cell.ColorCell.Blue) { return(Color.Blue); } if (color == Cell.ColorCell.Green) { return(Color.Green); } if (color == Cell.ColorCell.Orange) { return(Color.Orange); } if (color == Cell.ColorCell.Pink) { return(Color.Pink); } if (color == Cell.ColorCell.Red) { return(Color.Red); } return(Color.White); }