-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterface.pl
46 lines (27 loc) · 1.19 KB
/
interface.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
%--------------------------------- - - - - - - - - - - - - - - -
% SIST. REPR. CONHECIMENTO E RACIOCINIO - LEI/3
%--------------------------------- - - - - - - - - - - - - - - -
% Exercicio 3 - Interface
%--------------------------------- - - - - - - - - - - - - - - -
% Carregamento das bibliotecas
:- use_module( library( 'system' ) ).
:- use_module( library( 'linda/client' ) ).
%--------------------------------- - - - - - - - - - - - - - - -
%Ligar e desligar o cliente
ligar(M,P) :- write('A ligar...'), nl,
linda_client( M:P ),
write('Ligado.'), nl.
desligar :- close_client.
%--------------------------------- - - - - - - - - - - - - - - -
% Consulta do estado do QUADRO NEGRO
qn( L ) :-
bagof_rd_noblock( X,X,L ).
%--------------------------------- - - - - - - - - - - - - - - -
%% Extensao do meta-predicado pedido: Agenta,Pergunta -> {V,F}
pedido(Agente,Pergunta) :-
write('A perguntar a um agente...'), nl,
out(demo(Agente,Pergunta)),
sleep(1), write('...e esperando pela resposta.'), nl, nl,
in(prova(X,S)),
sleep(1), write('Resposta recebida!'), nl,
write('Resposta:'), write(S), nl.