可复现的邻接约束传播、回溯和矛盾报告
///|
test "validate solver result and externally altered tiles" {
let m = @wfc.Model::{
labels: ["a", "b"],
allowed: [[3, 3, 3, 3], [3, 3, 3, 3]],
}
match @wfc.solve(m, 3, 3, pins=[(0, 1)]) {
Some(s) => {
assert_true(s.validate(m, pins=[(0, 1)]))
assert_true(!s.validate(m, pins=[(0, 0)]))
s.tiles[0] = 99
assert_true(!s.validate(m))
}
None => fail("expected solution")
}
}fn OverlapModel::generate(self : OverlapModel, width : Int, height : Int, seed? : UInt, periodic? : Bool, budget? : Int) -> Array[Int]? raise SolveErrorfn PatternModel::generate(self : PatternModel, width : Int, height : Int, seed? : UInt, periodic? : Bool, ground? : Bool, pins? : Array[(Int, Int)], budget? : Int) -> Array[Int]? raise SolveErrorfn evaluate_json(input : String) -> Stringfn expand_tiles(definitions : Array[TileDefinition], tile_size : Int, neighbors : Array[(String, String)], subset? : Array[String]) -> TiledModel raise SolveErrorfn learn_overlap(sample : Array[Int], width : Int, height : Int, size : Int, periodic_input? : Bool, symmetry? : Bool) -> OverlapModel raise SolveErrorfn learn_patterns(sample : Array[Int], width : Int, height : Int, size : Int, periodic_input? : Bool, symmetry? : Int) -> PatternModel raise SolveErrorfn solve(model : Model, width : Int, height : Int, seed? : UInt, pins? : Array[(Int, Int)], budget? : Int, weights? : Array[Int], periodic? : Bool) -> Solution? raise SolveErrorInstall
Download zip可复现的邻接约束传播、回溯和矛盾报告