Example #1
0
        public bool Place(PlaceArguments args)
        {
            if (PosIsValid(args.X, args.Y))
            {
                XPos = args.X;
                YPos = args.Y;
                Face = args.Face;

                return (isPlaced = true);
            }
            else
                return false;
        }
Example #2
0
        private bool ParsePlaceArgs(string arg)
        {
            string[] placeArgs = arg.Split(',');
            int x, y; Direction face;

            if (placeArgs.Length == 3 && int.TryParse(placeArgs[0], out x) &&
                    int.TryParse(placeArgs[1], out y) && Enum.TryParse<Direction>(placeArgs[2], true, out face))
            {
                placeArguments = new PlaceArguments
                {
                    X = x,
                    Y = y,
                    Face = face,
                };
                return true;
            }
            return false;
        }