home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / l / l217 / 2.ddi / EXAMPLES / CH20EX10.PRO < prev    next >
Encoding:
Prolog Source  |  1990-03-26  |  812 b   |  29 lines

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