public bool Move(IRobot robot, IPlayingTable table)
        {
            if (robot == null)
            {
                throw new ArgumentNullException(nameof(robot));
            }

            if (table == null)
            {
                throw new ArgumentNullException(nameof(table));
            }

            // Ignore MOVE command if no coordinates have been set (i.e. robot has not been PLACEd)
            if (robot.CurrentCoordinates == null)
            {
                return(false);
            }

            var newCoordinates = GetMoveCoordinates(robot);

            if (table.CanMoveToCoordinates(newCoordinates))
            {
                robot.CurrentCoordinates = newCoordinates;
                return(true);
            }
            return(false);
        }
        public bool Place(IRobot robot, IPlayingTable table, IXYCoordinates newCoordinates,
                          MovingDirection newDirection)
        {
            if (robot == null)
            {
                throw new ArgumentNullException(nameof(robot));
            }

            if (table == null)
            {
                throw new ArgumentNullException(nameof(table));
            }

            if (newCoordinates == null)
            {
                throw new ArgumentNullException(nameof(newCoordinates));
            }

            if (newDirection == MovingDirection.NOTSET)
            {
                throw new ArgumentNullException(nameof(newDirection));
            }

            if (!table.CanMoveToCoordinates(newCoordinates))
            {
                return(false);
            }

            table.RemoveRobot(robot);
            robot.CurrentCoordinates     = newCoordinates;
            robot.CurrentFacingDirection = newDirection;

            return(table.AddRobot(robot));
        }