Using the same method used in my previous Sierpinski Triangle program, which is written in Python, I wrote a fractal generator for my graphing calculator TI-84 Plus in BASIC.

```
"// TI-84 Plus BASIC Code"
"// Jonathan Frech 25th of April, 2016"
"// edited 21st of May , 2016"
```

```
"// inportant: for this program to properly work, every Y-variable needs to be turned off"
"// init"
ClrDraw
AxesOff
"// using degrees"
Degree
"// radius"
30→R
"// start position"
{62/2,94/2}→⌊P
"triangle's three corners"
{⌊P(1)+R*cos(360/3*0),⌊P(2)+R*sin(360/3*0)}→⌊A
{⌊P(1)+R*cos(360/3*1),⌊P(2)+R*sin(360/3*1)}→⌊B
{⌊P(1)+R*cos(360/3*2),⌊P(2)+R*sin(360/3*2)}→⌊C
"// draw the triangle"
Line(⌊A(1),⌊A(2),⌊B(1),⌊B(2))
Line(⌊B(1),⌊B(2),⌊C(1),⌊C(2))
Line(⌊C(1),⌊C(2),⌊A(1),⌊A(2))
"// while loop"
While 1
"// draw current position's pixel"
Pxl-On(int(⌊P(1)),int(⌊P(2)))
"// decide to which corner to go next"
randInt(0,2)→C
"// case 0"
If C=0
Then
{⌊A(1)-⌊P(1),⌊A(2)-⌊P(2)}→⌊V
End
"// case 1"
If C=1
Then
{⌊B(1)-⌊P(1),⌊B(2)-⌊P(2)}→⌊V
End
"// case 2"
If C=2
Then
{⌊C(1)-⌊P(1),⌊C(2)-⌊P(2)}→⌊V
End
"// determine vector's length"
√(⌊V(1)^2+⌊V(2)^2)→L
"// create unity vector, set length to half of initial length"
If L≠0
Then
⌊V/L→⌊V
⌊V*(L/2)→⌊V
⌊P+⌊V→⌊P
End
"// pause for taking screenshots"
If getKey=45
Then
Pause
End
"// while loop ends"
End
```

Advertisements