Loading ...
Sorry, an error occurred while loading the content.

21732More Patterns Updated

Expand Messages
  • Gordon Sweet
    Jul 1 12:09 AM
    • 0 Attachment
      Here is another nice pattern, this time updated mainly by Stefan. It had me mostly baffled because the original used a recursive procedure which Stefan has translated into a Sub, whereas to date I have only used Subroutines. Thanks Stefan Gordon Sweet

      ' Spiders Web original by
      ' J.Harris BBCBASIC
      ' August 1983

      nomainwin

      global M, T

      ' the BBC code seemed to use only 16 colours
      data "yellow", "brown", "red", "darkred", "pink", "darkpink", "blue", "darkblue"
      data "green", "darkgreen", "cyan", "darkcyan", "white", "lightgray", "darkgray"
      data "black"

      dim colour$(15)

      for num = 0 to 15
      read color$
      colour$(num) = color$
      next

      T = 1

      ON ERROR GOTO [ErrorHandler]

      do
      prompt "Select Pattern"+chr$(13)+"Pattern 1 or 2"; T
      loop UNTIL T = 1 OR T = 2

      WindowWidth = 650
      WindowHeight = 550
      UpperLeftX = int((DisplayWidth-WindowWidth)/2)
      UpperLeftY = int((DisplayHeight-WindowHeight)/2)
      open "Spider Web" for graphics_nf_nsb as #main
      #main "trapclose [quit]"
      #main "rule XOR"
      #main "down; fill black; flush"

      do
      M = 400
      do
      #main, "color "; colour$(int(rnd(1)*15))
      call cross 640,512,512
      M = M / 2
      scan
      loop UNTIL M < 16
      loop UNTIL FALSE

      [quit]
      close #main
      END

      sub cross X,Y,S
      IF S < M THEN [skip]
      S = S / 2
      IF T = 1 then
      call cross X,Y+S,S
      call cross X+S,Y,S
      call cross X,Y-S,S
      call cross X-S,Y,S
      ELSE
      call cross X-S,Y+S,S
      call cross X+S,Y+S,S
      call cross X-S,Y-S,S
      call cross X+S,Y-S,S
      end if

      ' the next two lines caused the pattern to display correctly
      OffsetX = X
      OffsetY = Y

      ' for an unknown reason I had to scale the crosses
      #main "place ";(0+OffsetX)/2;" ";(S+OffsetY)/2
      U = S / 2
      #main "goto ";(U+OffsetX)/2;" ";(S+OffsetY)/2
      #main "goto ";(U+OffsetX)/2;" ";(U+OffsetY)/2
      #main "goto ";(S+OffsetX)/2;" ";(U+OffsetY)/2
      #main "goto ";(S+OffsetX)/2;" ";(0+OffsetY)/2
      #main "goto ";(S+OffsetX)/2;" ";(0-U+OffsetY)/2
      #main "goto ";(U+OffsetX)/2;" ";(0-U+OffsetY)/2
      #main "goto ";(U+OffsetX)/2;" ";(0-S+OffsetY)/2
      #main "goto ";(0-U+OffsetX)/2;" ";(0-S+OffsetY)/2
      #main "goto ";(0-U+OffsetX)/2;" ";(0-U+OffsetY)/2
      #main "goto ";(0-S+OffsetX)/2;" ";(0-U+OffsetY)/2
      #main "goto ";(0-S+OffsetX)/2;" ";(U+OffsetY)/2
      #main "goto ";(0-U+OffsetX)/2;" ";(U+OffsetY)/2
      #main "goto ";(0-U+OffsetX)/2;" ";(S+OffsetY)/2
      #main "goto ";(0+OffsetX)/2;" ";(S+OffsetY)/2
      [skip]
      end sub

      [ErrorHandler]
      notice "Error ";Err;chr$(13);Err$
      END



      [Non-text portions of this message have been removed]