Пример #1
0
        private bool SetUpRobot(Robot robot, Coordinates bounds, string startPosition)
        {
            if (!robot.Init(bounds, startPosition))
            {
                MessageBox.Show(this, $"StartPosition of {robot.Name} ({robot.StartPosition}) is outside the boundaries of the arena.",
                                "Out of bounds", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            var cellStartPosition = TransformPositionToGridCell(robot.StartPosition, bounds);

            grid[cellStartPosition.ColumnNumber, cellStartPosition.RowNumber].Value = $"{robot.Name} Start ({robot.StartPosition})";

            return(true);
        }