I am making a 2X2 sudoku game, modeled after Nqueens example. A `Digit` class
is assigned a `column` and `row` object. The `row` is the planning entity.

But a sudoku game also has a `block`, which is to be calculated from `row`
and `column`. Two digits cannot share a block. A block is null when the row
is null, and a numerical value that will be equal for all digits in the row.

Question: where do I tell the `Digit` object to recalculate it's `block`? I
did it in doMove, but it is misses most places the object is updated (as per
my attempts at logging). Must I set it to update itself when the `row`
property of the object changes, say at `setRow()`?

A 2X2 sudoku: http://mypuzzle.org/sudoku/kid.html

    private integer block;
    ...
    public Integer getBlock(){
        return block;
    }
    public void setBlock(int not_used){
        if(this.row==null)
            this.block=null;
        else    
            this.block=10*(this.row.getIndex()/2)+this.column.getIndex()/2;
    }

--
View this message in context: 
http://drools.46999.n3.nabble.com/Where-do-I-code-the-calculation-for-a-derieved-property-of-the-planning-entity-tp3702411p3702411.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to