Exemplo n.º 1
0
        private void MoveRobot(Robot robot, string instructions)
        {
            if (!robot.ParseAndExecuteInstructions(instructions))
            {
                MessageBox.Show(this,
                                $"{robot.Name} got out of bounds. Instructions are terminated early.", "Out of bounds",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            var cellEndPosition = TransformPositionToGridCell(robot.EndPosition, robot.Bounds);

            grid[cellEndPosition.ColumnNumber, cellEndPosition.RowNumber].Value = $"{robot.Name} End ({robot.EndPosition})";
        }