public void InitPlayableContainer() { foreground.InitBlocks(); background.FlushAsFirmware(); foreground.RecreateSubjects(true); MakeContainerStable(foreground); plmRecords = MakeContainerPlayable(foreground); }
private static bool DryRun(PlayableScheme scheme, out string reason) { reason = ""; if (scheme.canvasConfig is CanvasConfig2DR) { var container = new Container2D_Rectangular(scheme.canvasConfig as CanvasConfig2DR, scheme.slotConfig); container.InitBlocks(); var count1 = 0; var count2 = 0; for (int i = 0; i < 20; i++) { container.RecreateSubjects(true); var ctx1 = new LMSeeker2D_Retangular.SeekContext(); ctx1.container = container; ctx1.matchRules = scheme.matchRules.SchemeStyleMap <RuleMatchBasic, RuleMatchBasic2D_Rectangular>((r) => { var raw = r as RuleMatchBasic2D_Rectangular; var ret = new RuleMatchBasic2D_Rectangular(); ret.mask = raw.mask; ret.maskWidth = raw.maskWidth; ret.maskHeight = raw.maskHeight; ret.Compile(); return(ret); }).ToArray(); ctx1.result = new List <LMRecord2D_Retangular>(); LMSeeker2D_Retangular.Seek(ctx1); if (ctx1.result.Count > 0) { count1++; } var ctx2 = new PLMSeeker2D_Retangular.SeekContext(); ctx2.container = container; ctx2.matchRules = scheme.matchRules.SchemeStyleMap <RuleMatchBasic, RuleMatchBasic2D_Rectangular>((r) => { var raw = r as RuleMatchBasic2D_Rectangular; var ret = new RuleMatchBasic2D_Rectangular(); ret.mask = raw.mask; ret.maskWidth = raw.maskWidth; ret.maskHeight = raw.maskHeight; ret.Compile(); return(ret); }).ToArray(); ctx2.operationRules = scheme.operationRules.SchemeStyleMap <RuleOperation, RuleOperation2D_Rectangular>((r) => { return(r as RuleOperation2D_Rectangular); }).ToArray(); ctx2.result = new List <PLMRecord2D_Retangular>(); PLMSeeker2D_Retangular.Seek(ctx2); if (ctx2.result.Count >= scheme.minimalPlayablePLM) { count2++; } } if (count1 < 2 || count2 < 2) { reason = "Scheme is NOT playable!"; return(false); } return(true); } throw new NotImplementedException(); }
private static bool DryRun(PlayableScheme scheme, out string reason) { reason = ""; if (scheme.canvasConfig is CanvasConfig2DR) { var container = new Container2D_Rectangular(scheme.canvasConfig as CanvasConfig2DR, scheme.slotConfig); container.InitBlocks(); var count1 = 0; var count2 = 0; for (int i = 0; i < 20; i++) { container.RecreateSubjects(true); var ctx1 = new LMSeeker2D_Retangular.SeekContext(); ctx1.container = container; ctx1.matchRules = scheme.matchRules.SchemeStyleMap<RuleMatchBasic, RuleMatchBasic2D_Rectangular>((r)=>{ var raw = r as RuleMatchBasic2D_Rectangular; var ret = new RuleMatchBasic2D_Rectangular(); ret.mask = raw.mask; ret.maskWidth = raw.maskWidth; ret.maskHeight = raw.maskHeight; ret.Compile(); return ret; }).ToArray(); ctx1.result = new List<LMRecord2D_Retangular>(); LMSeeker2D_Retangular.Seek(ctx1); if (ctx1.result.Count > 0) { count1++; } var ctx2 = new PLMSeeker2D_Retangular.SeekContext(); ctx2.container = container; ctx2.matchRules = scheme.matchRules.SchemeStyleMap<RuleMatchBasic, RuleMatchBasic2D_Rectangular>((r)=>{ var raw = r as RuleMatchBasic2D_Rectangular; var ret = new RuleMatchBasic2D_Rectangular(); ret.mask = raw.mask; ret.maskWidth = raw.maskWidth; ret.maskHeight = raw.maskHeight; ret.Compile(); return ret; }).ToArray(); ctx2.operationRules = scheme.operationRules.SchemeStyleMap<RuleOperation, RuleOperation2D_Rectangular>((r)=>{ return r as RuleOperation2D_Rectangular; }).ToArray(); ctx2.result = new List<PLMRecord2D_Retangular>(); PLMSeeker2D_Retangular.Seek(ctx2); if (ctx2.result.Count >= scheme.minimalPlayablePLM) { count2++; } } if (count1 < 2 || count2 < 2) { reason = "Scheme is NOT playable!"; return false; } return true; } throw new NotImplementedException(); }