' This program exported from BASIC Anywhere Machine (Version [5.2.3].[2023.12.16.16.28]) on 2024.05.29 at 22:50 (Coordinated Universal Time)
' Program by Charlie Veniot
' Inspired by Richard Russell's BBC BASIC program
' as found on Facebook in the "BASIC Programming Language" group
' (https://www.facebook.com/groups/2057165187928233/permalink/3647483358896400/)

LET sw% = 500
SCREEN _NEWIMAGE(sw%*2+21,sw%*2+21,17)
DIM c_max% = 37
DIM c%(1 TO c_max%)
COLOR 63

' 🠊 Draw the inner lines of the image
  FOR a% = 0 TO 300 STEP 1
    DRAW "B M" + (XMAX/2) + "," + (YMAX/2)
    DRAW "TA " + a% + "B U " + (sw%)
    IF a% MOD 60 = 0 THEN
      DRAW "TA " + (a%+120) + "BU" + (sw%)
      p2x% = POINT(0) : p2y% = POINT(1)
      FOR a2# = 240 TO 300 STEP 0.01
        DRAW "B M" + p2x% + "," + p2y%
        DRAW "TA " + (a%+a2#) + "B U " + sw%
        CIRCLE (POINT(0),POINT(1)),2, , , , ,F
        IF INT(a2#*100) MOD 128 = 0 THEN SLEEP 0.01
      NEXT a2#
      DRAW "TA " + (a%+150) + "BU" + (sw%)
      p2x% = POINT(0) : p2y% = POINT(1)
      FOR a2# = 270 TO 330 STEP 0.01
        DRAW "B M" + p2x% + "," + p2y%
        DRAW "TA " + (a%+a2#) + "B U " + sw%
        CIRCLE (POINT(0),POINT(1)),2, , , , ,F
        IF INT(a2#*100) MOD 192 = 0 THEN SLEEP 0.01
      NEXT a2#
    END IF
  NEXT a%

DrawingIterationStart:

  FOR i% = 1 TO c_max%
    LET c%(i%) = INT(RND*62) + 1
  NEXT i%
  
  ' 🠊 Draw the circle outline
    FOR a2# = 0 TO 360 STEP 0.01
      DRAW "B M" + (XMAX/2) + "," + (YMAX/2)
      DRAW "TA " + a2# + "B U " + (sw%)
      CIRCLE (POINT(0),POINT(1)),2, , , , ,F
      IF INT(a2#*100) MOD 192 = 0 THEN SLEEP 0.01
    NEXT a2#


  ' 🠊 Paint the individual trigeods

    FOR a% = 0 TO 300 STEP 1
      DRAW "B M" + (XMAX/2) + "," + (YMAX/2)
      DRAW "TA " + a% + "B U " + (sw%)
      IF a% MOD 60 = 0 THEN
        DRAW "B G" + 50
        PAINT (POINT(0),POINT(1)),c%(INT(RND*c_max%)+1),63
        SLEEP 0.1
        DRAW "B E" + 50
        DRAW "TA " + (a%+120) + "Bl" + 200
        PAINT (POINT(0),POINT(1)),c%(INT(RND*c_max%)+1),63
        SLEEP 0.1
      END IF
    NEXT a%
  
  SLEEP 3
  
GOTO DrawingIterationStart