-
Bug
-
Resolution: Done
-
Critical
-
5.1.1.FINAL
-
None
The rule shown below fires, and then the code on the RHS prints "But cell ... matches" which is only possible when there is a Cell according to the constraints in the "not" CE. - The full Sudoku code is available.
rule "column elimination"
when
not Setting()
$i: Integer()
- occurs in a Cell
$c: Cell( free contains $i, $cs: cellSqr, $cc: cellCol ) - but not in another cell of the same square and a different column
not Cell( this != $c, free contains $i, cellSqr == $cs, cellCol != $cc )
-
- not ( $oc: Cell( this != $c )
- and
- eval( $oc.getFree().contains( $i ) &&
- $oc.getCellSqr().equals( $cs ) &&
- ! $oc.getCellCol().equals( $cc ) ) )
- but there is a cell in the same column and another square containing this value
$cx: Cell( freeCount > 1, free contains $i, cellCol == $cc, cellSqr != $cs )
then - remove the value from that other cell
System.out.println( "column elimination due to " + $c.posAsString() +
": remove " + $i + " from " + $cx.posAsString() );
for( int iRow = 0; iRow < 9; iRow++ ){
for( int iCol = 0; iCol < 9; iCol++ ){
Cell cell = Sudoku.sudoku.cells[iRow][iCol];
if( ! cell.equals( $c ) &&
cell.getCellSqr().equals( $cs ) &&
! cell.getCellCol().equals( $cc ) &&
cell.getFree().contains( $i ) )
}
}
for( Cell c: $cs.getCells() )
{ System.out.print( c.posAsString() + ": " + c.getFree() + " cc="+c.getCellCol() + " cs="+c.getCellSqr() + "; " ); }
System.out.println();
modify( $cx )
{ blockValue( $i ) }end
- relates to
-
JBRULES-2809 Exists/Not Nodes have ordering problem for repetitive updates on same facts
- Closed