' This program exported from BASIC Anywhere Machine (Version [5.2.3].[2024.09.09.00.00]) on 2025.01.07 at 18:02 (Coordinated Universal Time)
' Program by Charlie Veniot
' Draw regular polygons with help from DRAW to generate the points

SCREEN _NEWIMAGE( 201, 201,17 )

OPTION EXPLICIT

DECLARE SUB 🎯SetPoint( BYVAL angle%, BYREF x%, BYREF y% )

VAR coordinate%, angle1%, angle2%, x1%, y1%, x2%, y2%, aInc%, points%

LET aInc% = 0
    points% = 3
    
▶DrawIteration:

  CLS
  CIRCLE ( 100,100 ), 99, 2
  FOR coordinate% = 1 TO points%
      LET angle1% = ( coordinate% - 1 ) * 360 / points%  + aInc%
          angle2% = angle1% + 360 / points%
      CALL 🎯SetPoint( angle1%, x1%, y1% )
      CALL 🎯SetPoint( angle2%, x2%, y2% )
      IF coordinate% = 1 THEN CIRCLE(x1%, y1%), 2, 63
      LINE ( x1%, y1% ) TO ( x2%, y2% ), 62
  NEXT coordinate%
  SLEEP 0.01
  LET aInc% = aInc% + 1
  IF aInc% = 360 THEN aInc% = 0 : points% = IFF( points% = 15, 3, points% + 1 )

GOTO ▶DrawIteration

END

'🟠🟠🟠 SUBROUTINES
  
  SUB 🎯SetPoint( BYVAL angle%, BYREF x%, BYREF y% )
    PRESET(100,100)
    DRAW "TA" + STR$( angle% ) + " B U99"
    LET x% = POINT(0)
        y% = POINT(1)
  END SUB