home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / l / l210 / 1.ddi / REFEXAMP.ARC / INKEY1.PRO < prev    next >
Encoding:
Text File  |  1988-06-21  |  677 b   |  23 lines

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