[WIP, BROKEN] Plug the stub for the Hypothesis solver to show how it'll be used

This commit is contained in:
Tissevert 2022-10-02 22:22:23 +02:00
parent fb0c655089
commit e8d0db8b1d
2 changed files with 24 additions and 2 deletions

View file

@ -1,5 +1,5 @@
import * as CellSet from Geometry.CellSet;
import set from Grid.Util;
import * as Hypothesis from Solver.Hypothesis;
import * as Inclusion from Solver.Inclusion;
import * as SingleCell from Solver.SingleCell;
import * as State from Solver.State;
@ -30,7 +30,8 @@ function rate(coloring) {
function findNextStep(solvingState) {
return Strategy.tryEach([
Inclusion.find(solvingState),
SingleCell.find(solvingState)
SingleCell.find(solvingState),
Hypothesis.find(solvingState)
]);
}

21
js/Solver/Hypothesis.js Normal file
View file

@ -0,0 +1,21 @@
import perimeter from Solver.SingleCell;
import * as State from Solver.State;
return {
find: find
};
function find(solvingState) {
solvingState.missing.map(f(solvingState))
};
function f(solvingState) {
return function(cell) {
var forked = State.fork(solvingState);
State.set(forked, cell, true);
}
}
function checkContradiction(beforeState, afterState, cell) {
//TODO has one cellSet (color, row, column) become empty ? if it doesn't contain cell, it's a contradiction
}