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

  1. /* Program 38 */
  2. /*
  3.   NOTE:  all graphics programs are in white on a
  4.   black(blue) background. If you don't like this
  5.   combination it can easily be changed.  You
  6.   can change the parameters to the 'graphics'
  7.   predicate, or you can  change the drawing
  8.   color. Read page 92 and try some combinations
  9.   of  parameters.  For example: graphics(1,5,17)
  10.   on a CGA will give you pink  letters and a
  11.   white line on a blue background. Other systems
  12.   give  different colors. Just explore.
  13. */
  14.  
  15. predicates
  16.     square(integer)
  17.     fillsquare(integer)
  18.     
  19. goal
  20.     graphics(1,1,0),       
  21.     penpos(0,0,90),
  22.     pencolor(7),
  23.     fillsquare(5000).       
  24.     
  25. clauses
  26.     square(X):-
  27.         forward(X),right(90),forward(X),right(90),
  28.         forward(X),right(90),forward(X),right(90).
  29.     fillsquare(X):-X>30000,!.
  30.     fillsquare(X):-square(X),Y=X+500,fillsquare(Y).
  31.  
  32.