Example #1
0
        internal virtual void ValidateTurtle(Turtle turtle, IMineFieldExtended mineField)
        {
            Throw.If <TurtleOutOfFieldException>(() =>
                                                 turtle.CurrentPositionX > mineField.MaxPositionX || turtle.CurrentPositionY > mineField.MaxPositionY);
            var currentTyle = mineField[turtle.CurrentPositionX, turtle.CurrentPositionY];

            Throw.If <TurtleInitialTileException>(() => currentTyle != TileType.Empty);
        }
Example #2
0
        public ITurtleExtended InitTurtle(IMineFieldExtended mineField)
        {
            var turtle = _turtleRepository.GetTurtle();

            _validator.ValidateTurtle(turtle, mineField);
            var moves = _turtleRepository.GetMoves();

            return(new TurtleExtended(turtle, moves));
        }