Пример #1
0
 public void LoadData(CanvasConfig2DR cc)
 {
     Reset(cc.mapWidth, cc.mapHeight);
     foreach (var b in cc.insulators)
     {
         Mark(b.x, b.y);
     }
 }
Пример #2
0
	public static CanvasConfig StaticDeserialize(string str)
	{
		var tuple = JsonHelper.Deserialize<Tuple<string, string>>(str);
		switch (tuple.item1)
		{
		case RECTANGULAR_2D:
			var ret = new CanvasConfig2DR();
			ret.Deserialize(tuple.item2);
			return ret;
		default:
			throw new NotSupportedException();
		}
	}
Пример #3
0
    public static CanvasConfig StaticDeserialize(string str)
    {
        var tuple = JsonHelper.Deserialize <Tuple <string, string> >(str);

        switch (tuple.item1)
        {
        case RECTANGULAR_2D:
            var ret = new CanvasConfig2DR();
            ret.Deserialize(tuple.item2);
            return(ret);

        default:
            throw new NotSupportedException();
        }
    }
Пример #4
0
    public PlayableEnv2DR Build_2DR_Hardcoded()
    {
        var env = new PlayableEnv2DR();

        env.MinimalPlayablePLM = 3;

        var canvasConfig = new CanvasConfig2DR();

        canvasConfig.mapWidth   = 10;
        canvasConfig.mapHeight  = 10;
        canvasConfig.insulators = new List <Pos2D>();
        var slotConfig = new SlotConfig_Hardcoded();

        env.Foreground = new Container2D_Rectangular(canvasConfig, slotConfig);
        env.Background = new Container2D_Rectangular(canvasConfig, slotConfig);

        var matchRules = new RuleMatchBasic2D_Rectangular[2]
        {
            new RuleMatchBasicHorizontal(),
            new RuleMatchBasicVertical()
        };

        foreach (var r in matchRules)
        {
            r.Compile();
        }
        env.MatchRules = matchRules;

        env.ExtensionRules = new RuleMatchExtension2D_Rectangular[0];



        env.RefillRule = new RuleRefill2DR_Downward();

        env.OperationRules = new RuleOperation2D_Rectangular[2]
        {
            new RuleOperationHorizontal(),
            new RuleOperationVertical()
        };

        env.ScoreRules = new RuleScore2D_Rectangular[0];

        return(env);
    }
Пример #5
0
    public CanvasConfig2DR SerializeData()
    {
        var ret = new CanvasConfig2DR();

        ret.mapWidth   = selection.GetLength(1);
        ret.mapHeight  = selection.GetLength(0);
        ret.insulators = new System.Collections.Generic.List <Pos2D>();
        for (int y = 0; y < ret.mapHeight; y++)
        {
            for (int x = 0; x < ret.mapWidth; x++)
            {
                if (selection[y, x])
                {
                    ret.insulators.Add(new Pos2D(x, y));
                }
            }
        }
        return(ret);
    }
Пример #6
0
 public Container2D_Rectangular(CanvasConfig2DR canvasCfg, SlotConfig slotConfig)
 {
     this.canvasCfg   = canvasCfg;
     this.factory     = new SlotFactory2D_Rectangular(slotConfig);
     this.wrapperRect = new SlotWrapper2D[canvasCfg.mapHeight, canvasCfg.mapWidth];
 }
Пример #7
0
	public Container2D_Rectangular(CanvasConfig2DR canvasCfg, SlotConfig slotConfig)
	{
		this.canvasCfg = canvasCfg;
		this.factory = new SlotFactory2D_Rectangular(slotConfig);
		this.wrapperRect = new SlotWrapper2D[canvasCfg.mapHeight, canvasCfg.mapWidth];
	}