The terms are monitored by placing a demon suspension on the variables in each term. When a demon wakes, the new value of the term it is associated with is sent to the display matrix (and possibly updated, depending on the interactive settings on the matrix). When the new value is backtracked, the old value is sent to the display matrix. This predicate sets default value for how the demon is suspended: it is suspended with a priority of 1, and in the constrained suspension list. This should enable it to monitor all changes unless the changes were also effected by suspensions of priority 1.
The display matrix will be removed on backtracking. However, it will not be removed if make_display_matrix has been cut. It is possible to explicitly remove a matrix with kill_display_matrix/1.
Each cell of the display matrix represents one term. The value of the term is displayed in the cell, and break-points can be set from a pop-up menu so that execution suspends when an update occurs in a cell. The term can also be inspected by the inspector. The actual current value of the term will be examined, which may be different from the value shown in the cell depending on how often the cell is updated. With breaks, the changes due to forward execution (further constraining of a variable's value) and backtracking are shown in different colours. Inspection is not allowed on a term that has just been backtracked, because the actual backtracking of the value have not yet occurred (the demon sends the old value just before the actual backtracking). It can be examined at the next break-point. The pop-up menu also shows the current displayed value, and the previous displayed value for the cell.
queens(N, List) :- length(List, N), List :: 1..N, make_display_matrix(List/0, queens), % sets up a matrix with all variables in 1 row. This is the only % extra goal that has to be added to enable monitoring alldistinct(List), constrain_queens(List), % Label the variables labeling(List).