Пример #1
0
 public GrowingTreeAlgorithm(IRandomPointGenerator randomPointGenerator, IRandomValueGenerator randomValueGenerator, IDirectionsFlagParser directionsFlagParser, IArrayHelper arrayHelper)
 {
     _randomPointGenerator = randomPointGenerator;
     _randomValueGenerator = randomValueGenerator;
     _directionsFlagParser = directionsFlagParser;
     _arrayHelper          = arrayHelper;
 }
Пример #2
0
 public RandomCarver(IRandomPointGenerator randomPointGenerator, IPointsAndDirectionsRetriever pointsAndDirectionsRetriever, IDirectionsFlagParser directionsFlagParser, IArrayHelper arrayHelper)
 {
     _randomPointGenerator         = randomPointGenerator;
     _pointsAndDirectionsRetriever = pointsAndDirectionsRetriever;
     _directionsFlagParser         = directionsFlagParser;
     _arrayHelper = arrayHelper;
 }
 public void Setup()
 {
     _random           = new RandomValueGenerator();
     _mazePointFactory = new Mock <IMazePointFactory>();
     _mazePointFactory.Setup(x => x.MakePoint(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>()))
     .Returns((int x, int y, int z) => new MazePoint(x, y, z));
     _randomPoint = new RandomPointGenerator(_random, _mazePointFactory.Object);
 }
Пример #4
0
 public MazeModelFactory(IMovementHelper movementHelper, IDirectionsFlagParser parser, IMazePointFactory pointFactory, IMazeArrayBuilder mazeArrayBuilder, IRandomPointGenerator randomPointGenerator)
 {
     _movementHelper       = movementHelper;
     _parser               = parser;
     _pointFactory         = pointFactory;
     _mazeArrayBuilder     = mazeArrayBuilder;
     _randomPointGenerator = randomPointGenerator;
 }
 public MazeFactory(IPointValidity pointValidity, IMovementHelper movementHelper, IDirectionsFlagParser directionsFlagParser, IRandomPointGenerator randomPointGenerator, IModelsWrapperFactory modelsWrapperFactory)
 {
     _pointValidity        = pointValidity;
     _movementHelper       = movementHelper;
     _directionsFlagParser = directionsFlagParser;
     _randomPointGenerator = randomPointGenerator;
     _modelsWrapperFactory = modelsWrapperFactory;
 }
Пример #6
0
 public void Initialise(IModelsWrapper modelsWrapper, IDirectionsFlagParser directionsFlagParser, IMovementHelper movementHelper, IPointValidity pointValidity, IRandomPointGenerator randomPointGenerator, MazePoint startingPoint = null)
 {
     ModelsWrapper        = modelsWrapper;
     DirectionsFlagParser = directionsFlagParser;
     MovementHelper       = movementHelper;
     PointValidity        = pointValidity;
     RandomPointGenerator = randomPointGenerator;
     CurrentPoint         = startingPoint ?? randomPointGenerator.RandomPoint(Size);
 }
Пример #7
0
        /// <summary>
        /// Handles the initialization of game-specific options.
        /// </summary>
        /// <param name="options">Contains the user's desired game options</param>
        public void Initialize(GameOptions options)
        {
            // Get the map size that will be used for the current game.
            mapSize = MapGenerator.SetMapSize(options.MapSize);

            // Configure the round timer and hook up the event handler.
            timer         = new RoundTimer(options.Difficulty);
            timer.OnTick += (source, e) => ExecuteCycle();

            // Set up collision detection.
            colDetector = new CollisionDetector(mapSize);

            // Initialize the random point and food generators.
            randomPointGenerator = RandomPointGenerator.Create(mapSize);
            foodGenerator        = new FoodGenerator(randomPointGenerator);

            // Initialize the game map.
            map = MapGenerator.GenerateMap(mapSize, options.TileStyle);

            // Place the snek and food at their initial locations.
            snek = new Snekk(MapGenerator.GenerateStartingPoint(mapSize));
            food = foodGenerator.Generate(snek.GetSegmentLocations());
        }
Пример #8
0
 public FoodGenerator(IRandomPointGenerator generator)
 {
     this.generator = generator;
 }
 public BacktrackerAlgorithm(IDirectionsFlagParser directionsFlagParser, IRandomPointGenerator randomPointGenerator, IArrayHelper arrayHelper)
 {
     _directionsFlagParser = directionsFlagParser;
     _randomPointGenerator = randomPointGenerator;
     _arrayHelper          = arrayHelper;
 }