public MainWindow() { InitializeComponent(); _input = JsonConvert.DeserializeObject<Input>(File.ReadAllText("input.json")); var options = JsonConvert.DeserializeObject<ExecutionOptions>(File.ReadAllText("options.json")); //new ExecutionOptions //{ // MaxWidth = 4, // MaxHeight = 6, // MinEstimation = double.MinValue, // AttractorRatio = 10, // DepthPenaltyRatio = 10, // //HiddenHolesPenalty = 10, // AdjacencyDownRatio = 5 //} _execution = new ExecutionRequest { Snapshot = new Snapshot(_input, _input.SourceSeeds.First()), Options = options }; _solver = new IterativeSearchSolver(4000); //new TraverseSolver(); SizeChanged += (s, e) => Update(); commandBar.SpawnEvent += commandBarSpawnEvent; commandBar.Move += commandBarMove; commandBar.StartSolver += commandBarStartSolver; }
/// <summary> /// Initial constructor. /// </summary> public Snapshot(Input input, uint seed) { Field = new Field(input); UnitsQueue = new UnitsQueue(input.Units, seed, input.SourceLength); CurrentUnit = Field.Spawn(UnitsQueue.Get(0)); UnitHistory = new List<Unit> { CurrentUnit }; Score = 0; FieldEstimate = 0; }
public Field(Input input) { Width = input.Width; Height = input.Height; Cells = new byte[(uint)Math.Ceiling(((double)Width * Height) / 8)]; foreach (var cell in input.Filled) { this[cell.X, cell.Y] = true; } }