home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / historic / v941.tgz / icon.v941src.tar / icon.v941src / ipl / gprogs / randweb.icn < prev    next >
Text File  |  2001-05-02  |  1KB  |  60 lines

  1. ############################################################################
  2. #
  3. #    File:     randweb.icn
  4. #
  5. #    Subject:  Program to draw random web design
  6. #
  7. #    Author:   Ralph E. Griswold
  8. #
  9. #    Date:     May 2, 2001
  10. #
  11. ############################################################################
  12. #
  13. #   This file is in the public domain.
  14. #
  15. ############################################################################
  16. #
  17. #  This program connects lines in all possible ways between i randomly
  18. #  selected points in a window.  The value of i is given on the command
  19. #  line (default 20).  Large values of i produce unattractively dense
  20. #  structures.
  21. #
  22. ############################################################################
  23. #
  24. #  Requires:  Version 9 graphics
  25. #
  26. ############################################################################
  27. #
  28. #   Links: gobject, joinpair, random, wopen
  29. #
  30. ############################################################################
  31.  
  32. link gobject
  33. link joinpair
  34. link random
  35. link wopen
  36.  
  37. procedure main(argl)
  38.    local i, j, k, angle, incr, points, size, radius
  39.  
  40.    i := integer(argl[1]) | 20
  41.  
  42.    size := 300
  43.    radius := size / 2
  44.  
  45.    WOpen("label=random web", "width=" || size, "height=" || size) |
  46.       stop("*** cannot open window")
  47.  
  48.    points := []
  49.  
  50.    randomize()
  51.  
  52.    every j := 1 to i do
  53.       put(points, Point(?size, ?size))
  54.  
  55.    joinpair(points, points)
  56.  
  57.    Event()
  58.  
  59. end
  60.