public void CreateInterface() { map = new Map(); buttonRestart.Width = map.Width / 2; buttonAI.Width = buttonRestart.Width; textBox1.Width = buttonRestart.Width; buttonApply.Width = buttonRestart.Width; buttonRestart.Location = new Point(0, map.Size.Height + 3); buttonAI.Location = new Point(buttonRestart.Width, buttonRestart.Location.Y); textBox1.Location = new Point(0, buttonRestart.Location.Y + buttonRestart.Height + 1); buttonApply.Location = new Point(textBox1.Width, textBox1.Location.Y); this.Size = new Size(map.Size.Width + 16, textBox1.Location.Y + textBox1.Height + 3 + 40); Controls.Add(map); }
public AI(Map map) { Point desiredLocation; while (!Map.CheckWin()) { globalIndex++; desiredLocation = GetNeededPosition(globalIndex); if (desiredLocation.X == Map.CountCells - 1 && desiredLocation.Y <= Map.CountCells - 2) { UpCornerConflict(desiredLocation); globalIndex++; } else if (desiredLocation.Y == Map.CountCells - 1 && desiredLocation.X <= Map.CountCells - 2) { DownCornerConflict(desiredLocation); } else MoveToDesiredPosition(globalIndex, desiredLocation); } }