Exemplo n.º 1
0
        public Quadrant(
            QuadrantInfo info,
            Enterprise enterprise,
            Random random,
            Galaxy galaxy,
            Input input,
            Output output)
        {
            _info   = info;
            _random = random;
            _output = output;
            Galaxy  = galaxy;

            info.MarkAsKnown();
            _sectors = new() { [enterprise.SectorCoordinates] = _enterprise = enterprise };
Exemplo n.º 2
0
        public Quadrant(QuadrantInfo info, Enterprise enterprise)
        {
            _info   = info;
            _random = new Random();

            _enterpriseSector = enterprise.Sector;
            _sectors          = new Dictionary <Coordinates, object> {
                [enterprise.Sector] = enterprise
            };
            PositionObject(() => new Klingon(), _info.KlingonCount);
            if (_info.HasStarbase)
            {
                _starbaseSector = PositionObject(() => new Starbase());
            }
            PositionObject(() => new Star(), _info.StarCount);
        }
Exemplo n.º 3
0
        internal Galaxy(Random random)
        {
            _quadrants = Enumerable
                         .Range(0, 8)
                         .Select(x => Enumerable
                                 .Range(0, 8)
                                 .Select(y => new Coordinates(x, y))
                                 .Select(c => QuadrantInfo.Create(c, GetQuadrantName(c), random))
                                 .ToArray())
                         .ToArray();

            if (StarbaseCount == 0)
            {
                var randomQuadrant = this[random.GetCoordinate()];
                randomQuadrant.AddStarbase();

                if (randomQuadrant.KlingonCount < 2)
                {
                    randomQuadrant.AddKlingon();
                }
            }
        }
Exemplo n.º 4
0
        public Galaxy()
        {
            var random = new Random();

            _quadrants = Enumerable.Range(1, 8).Select(x =>
                                                       Enumerable.Range(1, 8).Select(y => QuadrantInfo.Create(new Coordinates(x, y), "")).ToArray())
                         .ToArray();

            if (StarbaseCount == 0)
            {
                var randomQuadrant = this[random.GetCoordinate()];
                randomQuadrant.AddStarbase();

                if (randomQuadrant.KlingonCount < 2)
                {
                    randomQuadrant.AddKlingon();
                }
            }
        }