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. The other arguments in this predicate is used to control when the demon wakes, and what sort of information is monitored. Prio is the priority that the demon should be suspended at, Type is designed to specify the attributes that is being monitored (currently all attributes are monitored, and Type is a dummy argument), CondList is the suspension list that the demon should be added to. Depending on these arguments, the level of monitoring can be controlled. Note that it is possible for the display matrix to show values that are out of date because the change was not monitored.
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/3, 1, any, constrained, queens), % sets up a matrix with rows of 3 elements. This is the only % extra goal that has to be added to enable monitoring alldistinct(List), constrain_queens(List), % Label the variables labeling(List).