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); }
public ITurtleExtended InitTurtle(IMineFieldExtended mineField) { var turtle = _turtleRepository.GetTurtle(); _validator.ValidateTurtle(turtle, mineField); var moves = _turtleRepository.GetMoves(); return(new TurtleExtended(turtle, moves)); }