home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / prolog / library / prolo_c / exampl60.pro < prev    next >
Text File  |  1986-10-06  |  686b  |  25 lines

  1. /* Program 60 */
  2.  
  3. predicates
  4.   wait(char)
  5.   equal(char,char)
  6.   test(string)
  7. goal
  8.   makewindow(3,7,0,"",0,0,25,80),
  9.   makewindow(2,7,7,"Key to press now",2,5,6,70),
  10.   makewindow(1,7,7,"Accepted letters",8,10,10,60),
  11.   Word = "Peter Piper picked a peck of pickled peppers",
  12.   write("Please type :\n\t",Word,"\n\t"),
  13.   time(0,0,0,0),test(Word),
  14.   time(_,_,S,H),
  15.   shiftwindow(1),
  16.   write("\nYou took ",S," seconds and ",H," hundredths").
  17. clauses
  18.   wait(X):- inkey(Y),equal(X,Y).
  19.   wait(X):- shiftwindow(2),write(X),wait(X).
  20.   test(W):- frontchar(W,Ch,R),wait(Ch),
  21.             shiftwindow(2),write(Ch),test(R).
  22.   test("").
  23.   equal(X,X):-!.
  24.   equal(_,_):-beep,fail.
  25.