Example #1
0
            /// <summary>
            /// Execute the analysis
            /// </summary>
            /// <param name = "commandArgs"></param>
            override public void Execute(Args commandArgs)
            {
                Console.WriteLine(commandArgs.StringEnumArgs[Arguments.Tissue]);

                var         nullMapBuilder = new NullMapBuilder(commandArgs.StringEnumArgs[Arguments.Config]);
                IMapBuilder builder        = IUnknown.QueryInterface <IMapBuilder>(nullMapBuilder);

                if (commandArgs.StringEnumArgs.ContainsKey(Arguments.LocusFileName))
                {
                    builder.LocusFileName = commandArgs.StringEnumArgs[Arguments.LocusFileName];
                }

                if (commandArgs.StringEnumArgs.ContainsKey(Arguments.MapFileName))
                {
                    builder.MapFileName    = commandArgs.StringEnumArgs[Arguments.MapFileName];
                    nullMapBuilder.GeneMap = commandArgs.Flags.Contains(Arguments.GeneMap.ToString());
                }

                builder.OutDir = commandArgs.StringEnumArgs.ContainsKey(Arguments.OutDir) ?
                                 commandArgs.StringEnumArgs[Arguments.OutDir] :
                                 builder.OutDir = ".";

                builder.Tissue           = commandArgs.StringEnumArgs[Arguments.Tissue];
                builder.RnaSource        = commandArgs.StringEnumArgs[Arguments.RnaSource];
                builder.LocusFilterRange = commandArgs.IntArgs.ContainsKey(Arguments.RemoveGeneBodyTranscripts.ToString()) ?
                                           commandArgs.IntArgs[Arguments.RemoveGeneBodyTranscripts.ToString()] :
                                           0;

                if (commandArgs.StringEnumArgs.ContainsKey(Arguments.TissueSources))
                {
                    builder.TissueSources = commandArgs.StringEnumArgs[Arguments.TissueSources].Split('\t');
                }

                Stage stage = (Stage)Enum.Parse(typeof(Stage), commandArgs.StringEnumArgs[Arguments.Stage]);

                switch (stage)
                {
                case Stage.Preprocess:
                    builder.PreprocessExpression();
                    break;

                case Stage.BuildMap:
                    builder.BuildMap();
                    break;

                case Stage.RunPipeline:
                    builder.PreprocessExpression();
                    builder.BuildMap();
                    break;

                case Stage.FilterMap:
                    nullMapBuilder.FilterMap((MapLinkFilter.LinkType)Enum.Parse(typeof(MapLinkFilter.LinkType), commandArgs.StringEnumArgs[Arguments.MapType]));
                    break;

                default:
                    throw new Exception("Invalid stage argument: " + commandArgs.StringEnumArgs[Arguments.Stage] + "\nValid values: Preprocess, BuildMap");
                }
            }
Example #2
0
 public Processor(
     IMapBuilder builder,
     IDungeonPopulator populator,
     IMapPainter painter)
 {
     this.builder = builder;
     this.populator = populator;
     this.painter = painter;
 }
Example #3
0
        public MapManager()
        {
            var builder = new ContainerBuilder();

            builder.RegisterType <MapBuilder>();
            builder.RegisterType <MapAnalyzer>();

            var container = builder.Build();

            Builder  = container.Resolve <MapBuilder>();
            Analyzer = container.Resolve <MapAnalyzer>();
        }
Example #4
0
        void BindScene(IMapBuilder map)
        {
            // bind everything to scene "level" object
            map.Transform(m =>
            {
                // here we can apply additional transformations

                // let's replace some walls)
                var(mh, mw) = m.Size();

                for (var i = 0; i < mw; i++)
                {
                    m[0, i] = Constants.PrefabType.Sphere;
                }
            }).Build();
        }
            /// <summary>
            /// Execute the analysis for which this class is the factor with the given command line arguments.
            /// </summary>
            /// <param name="commandArgs">Command arguments.</param>
            public override void Execute(Args commandArgs)
            {
                IMapBuilder builder = IUnknown.QueryInterface <IMapBuilder>(new CorrelationMapBuilder(
                                                                                commandArgs.StringEnumArgs[Arguments.Config],
                                                                                commandArgs.StringEnumArgs.GetOptional(Arguments.OmittedTissues)));

                this.ReflectStringArgs(builder, new Arguments[]
                {
                    Arguments.Tissue,
                    Arguments.HistoneName,
                    Arguments.RnaSource,
                });

                this.ReflectOptionalStringArgs(builder, new Arguments[]
                {
                    Arguments.LocusFileName,
                    Arguments.MapFileName,
                });

                this.ReflectOptionalString(builder, Arguments.OutDir, ".");

                this.ReflectFlag(builder, Arguments.UseGenes);
                this.ReflectOptionalInt(builder, Arguments.LocusFilterRange, 0);

                Stage stage = (Stage)Enum.Parse(typeof(Stage), commandArgs.StringEnumArgs[Arguments.Stage]);

                switch (stage)
                {
                case Stage.Preprocess:
                    builder.PreprocessExpression();
                    break;

                case Stage.BuildMap:
                    builder.BuildMap();
                    break;

                case Stage.RunPipeline:
                    builder.PreprocessExpression();
                    builder.BuildMap();
                    break;

                default:
                    throw new Exception("Invalid stage argument: " + commandArgs.StringArgs["Stage"] + "\nValid values: Preprocess, BuildMap");
                }
            }
Example #6
0
        public ORMGenerator RegisterMapBuilder(IMapBuilder Builder)
        {
            DatabaseSchemaManager manager = null;

            try
            {
                manager = new DatabaseSchemaManager(SchemaConnectionString);
            }
            catch
            {
            }
            foreach (ORM m in Builder.Build())
            {
                ORMs[m.EntityType] = m;
                //构建架构
                if (manager != null)
                {
                    try
                    {
                        if (!m.IsView)
                        {
                            if (manager.TableExists(m.TableName))
                            {
                                foreach (ColumnMap col in m.Columns.Values)
                                {
                                    if (!manager.TableColumnExists(m.TableName, col.ColumnName))
                                    {
                                        manager.CreateColumn(m.TableName, col.ColumnName, col.DbType);
                                    }
                                }
                            }
                            else
                            {
                                manager.CreateTable(m.TableName, m.Columns.Values.ToArray(), m.KeyField);
                            }
                        }
                    }
                    catch
                    {
                    }
                }
            }
            return(this);
        }
Example #7
0
    public HomelandsGame(GameManager gameManager, GameSettings settings)
    {
        Debug.Log("Constructing Homelands Game");

        _gameManager = gameManager;
        _settings    = settings;

        _tickSystem   = FTickSystem.Make(this, _settings._tickSettings);
        _statsBuilder = new StatsBuilderBasic(this);
        _viewer       = new Viewer(this);

        IMapBuilder mapBuilder = MapBuilderFactory.Make(_settings._mapSettings._mapType, _settings._mapSettings._tileShape, this);

        _locations    = mapBuilder.Make(_settings._mapSettings);
        _inputHandler = new InputHandler(this);

        _playerSystem    = new PlayerSystem(this, _settings._playerSettings._numberOfPlayers);
        _endSystem       = FEndSystem.Make(_settings._endCondition, this);
        _startPositioner = FStartPositioner.Make(eStartPosition.OppositeCorners, this);
        InitializePlayerStarts();
    }
Example #8
0
        public void Setup()
        {
            _testDocument = new XDocument(
                new XElement("coordinates",
                             new XElement("coordinate",
                                          new XElement("x", 0),
                                          new XElement("y", 0),
                                          new XElement("type", "Wall")),
                             new XElement("coordinate",
                                          new XElement("x", 0),
                                          new XElement("y", 1),
                                          new XElement("type", "BreakableWall")),
                             new XElement("coordinate",
                                          new XElement("x", 1),
                                          new XElement("y", 0),
                                          new XElement("type", "Wall"))));

            _mapElementFactory = new MapElementFactory();
            _xmlElementFinder  = new XmlElementFinder();
            _mapBuilder        = new MapBuilder(_mapElementFactory, _xmlElementFinder);
        }
Example #9
0
        //starts everything
        public void Run()
        {
            while (this._server.Finished == false && this._server.Errored == false)
            {
                _mapBuilder = new DefaultMapBuilder(_server);
                _tactic = new SurvivalGoldRush(_mapBuilder);
                _movement = new DefaultMovement(_mapBuilder);

                var destination = _tactic.NextDestination();
                var route = _movement.GetShortestCompleteRouteToLocation(destination.Location);

                var direction = this._server.GetDirection(_mapBuilder.HeroNode.Location, route.Any() ? route.First().Location : null);
                this._server.MoveHero(direction);
                Console.Out.WriteLine("completed turn " + this._server.CurrentTurn);
            }

            if (this._server.Errored)
            {
                Console.Out.WriteLine("error: " + this._server.ErrorText);
            }
            Console.Out.WriteLine("{0} Finished", BotName);
        }
Example #10
0
        public ResourceMapper(MapBuilder builderType = MapBuilder.Delegate)
        {
            switch (builderType)
            {
            case MapBuilder.Delegate:
                _builder = new DelegateBuilder <TContext>(this);
                break;

            case MapBuilder.Emit:
                _builder = new EmitBuilder <TContext>(this);
                break;

            default:
                throw new ArgumentOutOfRangeException("builderType");
            }
            _memberConsumers.Add(new DefaultMemberConsumer());
            _memberResolvers.Add(new IgnoreCaseNameMatcher());
            _defaultMaps.Add(new MapList <TContext>(this));
            _defaultMaps.Add(new MapArray <TContext>(this));
            _defaultMaps.Add(new MapEnum <TContext>());
            _defaultMaps.Add(new MapByVal <TContext>());
            _defaultMaps.Add(new MapNonNullableToNullable <TContext>(this));
            _defaultMaps.Add(new MapNullableToNullable <TContext>(this));
        }
 public StoragelessMapRepository(IMapBuilder mapBuilder)
 {
     this.assert     = Asserts.Default;
     this.MapBuilder = mapBuilder;
 }
 public MapDirector(IMapBuilder builder)
 {
     _builder = builder;
 }
        public void LaunchGame(Game newGame)
        {
            Console.SetWindowSize(mapWidth, mapHeight + 6);

            newGame.GenerateMap(mapHeight, mapWidth, stage);
            Snake snake = newGame.Map.Snake;

            builder = new ConsoleMapBuilder(mapWidth, mapHeight);

            Console.BackgroundColor = ConsoleColor.Cyan;
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.SetCursorPosition(0, mapHeight);
            for (int i = 0; i < 6; i++)
            {
                Console.WriteLine(new string(' ', mapWidth));
            }

            while (true)
            {
                if (Console.KeyAvailable)
                {
                    switch (Console.ReadKey().Key)
                    {
                    case ConsoleKey.DownArrow:
                        snake.ChangeDirection(MovingEntity.TDirection.Down);
                        break;

                    case ConsoleKey.UpArrow:
                        snake.ChangeDirection(MovingEntity.TDirection.Up);
                        break;

                    case ConsoleKey.LeftArrow:
                        snake.ChangeDirection(MovingEntity.TDirection.Left);
                        break;

                    case ConsoleKey.RightArrow:
                        snake.ChangeDirection(MovingEntity.TDirection.Right);
                        break;
                    }
                }
                while (!Console.KeyAvailable)
                {
                    if (newGame.Map.GameOver)
                    {
                        Console.SetCursorPosition(mapWidth / 2 - 10, mapHeight / 2 - 2);
                        Console.ForegroundColor = ConsoleColor.DarkMagenta;
                        Console.BackgroundColor = ConsoleColor.Black;
                        Console.WriteLine(new string(' ', 20));
                        Console.SetCursorPosition(mapWidth / 2 - 10, mapHeight / 2 - 1);
                        Console.WriteLine("     KONIEC GRY     ");
                        Console.SetCursorPosition(mapWidth / 2 - 10, mapHeight / 2);
                        Console.WriteLine(new string(' ', 20));
                        string wynik = "WYNIK: " + newGame.Map.Snake.Score.ToString(), output = "";
                        output = new string(' ', (20 - wynik.Length) / 2) + wynik + new string(' ', (20 - wynik.Length) / 2 + (20 - wynik.Length) % 2);
                        Console.SetCursorPosition(mapWidth / 2 - 10, mapHeight / 2 + 1);
                        Console.WriteLine(output);
                        Console.SetCursorPosition(mapWidth / 2 - 10, mapHeight / 2 + 2);
                        Console.WriteLine(new string(' ', 20));
                        Console.ReadKey();
                        return;
                    }

                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.BackgroundColor = ConsoleColor.DarkMagenta;

                    List <Entity> entities = newGame.Map.Entities;
                    foreach (Entity entity in entities)
                    {
                        if (entity is Fruit)
                        {
                            builder.BuildFruit((Fruit)entity);
                        }
                        if (entity is Powerup)
                        {
                            builder.BuildPowerup((Powerup)entity);
                        }
                        if (entity is Obstacle)
                        {
                            builder.BuildObstacle((Obstacle)entity);
                        }
                        if (entity is Mouse)
                        {
                            builder.BuildMouse((Mouse)entity);
                        }
                    }
                    builder.BuildSnake(snake);

                    foreach (Point position in newGame.Map.ClearedPositions)
                    {
                        System.Diagnostics.Debug.WriteLine(position.ToString());
                    }
                    builder.ClearMap(newGame.Map.ClearedPositions);


                    Console.SetCursorPosition(2, mapHeight + 1);
                    Console.ForegroundColor = ConsoleColor.Black;
                    Console.BackgroundColor = ConsoleColor.Cyan;
                    Console.Write(new string(' ', mapWidth));
                    Console.SetCursorPosition(2, mapHeight + 1);
                    Console.Write(newGame.Map.Snake.Score.ToString());

                    Console.SetCursorPosition(mapWidth - 6, mapHeight + 1);
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.Write(Convert.ToChar(9829));
                    Console.ForegroundColor = ConsoleColor.Black;
                    Console.Write(" x " + newGame.Map.Snake.Lives.ToString());

                    if (newGame.Map.Snake.Effect.Variant != Effect.EffectVariant.None)
                    {
                        Console.SetCursorPosition(0, mapHeight + 3);
                        Console.WriteLine(new string(' ', mapWidth));

                        if (newGame.Map.Snake.Effect.Duration > 0)
                        {
                            Console.SetCursorPosition(2, mapHeight + 3);
                            Console.Write(newGame.Map.Snake.Effect.ToString());
                            Console.SetCursorPosition(mapWidth - 6, mapHeight + 3);
                            Console.Write(newGame.Map.Snake.Effect.Duration.ToString());
                        }
                    }

                    newGame.Map.Update();
                    Thread.Sleep(wait);
                }
            }
        }
Example #14
0
 public MapBuilder(IMapBuilder <object, object> mapBuilder)
 {
     this.m = mapBuilder;
 }
Example #15
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="parser">Parser used when RunCommands is called</param>
 /// <param name="builder">Builder used when LoadBuilderArgs is called</param>
 public MapController(ICommandParser parser, IMapBuilder builder)
 {
     _cmdParser  = parser;
     _mapBuilder = builder;
 }
Example #16
0
 public DumbGoldRush(IMapBuilder game)
 {
     this._game = game;
 }
Example #17
0
	    public DefaultMovement(IMapBuilder board)
        {
            _defaultMapBuilderBuilder = board;
            PopulateMovementCost();
        }
Example #18
0
		public void add(IMapBuilder builder){
			_builders.Add (builder);
		}
Example #19
0
 public SurvivalGoldRush(IMapBuilder game)
 {
     this._game = game;
 }