next up previous contents
Next: Outils de trace Up: Implémentation du simulateur de Previous: Simulation du dialogue

Affichage du dialogue

/*****************************************************************************/
/*                                                                           */
/* Generation du rapport de l'evolution des etats mentaux                    */
/*                                                                           */
/*****************************************************************************/

:-module(rapport,
    [
        init_rapport/0,
        enregistrer_modification/2,     % param : X,E
        afficher_etat_courant/1
    ]
).

/* Le rapport est constitue pendant le dialogue en appelant le predicat
 * enregistrer_modification/2
 * On memorise les couples (X,E) avec la cle rapport.
 * On memorise chaque etape avec la cle etape.
 */

init_rapport:-
    empty([rapport,etape]).

enregistrer_modification(X,E):-
    enlever(X,-E),
    recordz(rapport,(X,E)).

enlever(X,-(-E)):-
    !,
    enlever(X,E).

enlever(X,E):-
    (   recorded(rapport,(X,E),REF)
    ->  erase(REF)
    ;   true
    ).

afficher_etat_courant(T):-
    (   agents(X,_),
            findall(ETAT,recorded(rapport,(X,ETAT)),ETATS),
            recordz(etape,(T,X,ETATS)),
            forall(recorded(rapport,(X,E)),writef("%t : %t\n",[X,E])),
        fail
    ;   true
    ).



Christophe Delord
1998-09-02