Random Programs


These are some random programs I have created over the years.


FACE

It draws a face!

:ClrDraw
:AxesOff
:-10→Xmin
:10→Xmax
:-10→Ymin
:10→Ymax
:{2,-2,1,-1}→L1
:{2,2,-1,-1}→L2
:Plot1(Scatter,L1,L2
:"√(1-(X-2)2)+2"→Y1
:"√(1-(X+2)2)+2"→Y2
:"-√(25-X2)-5"→Y3
:"√(4-X2)-2"→Y4
:DispGraph

HEART

Learn how to draw a heart with a Valentine's Day message!

:ClrDraw
:AxesOff
:Simul
:-15→Xmin
:15→Xmax
:-5→Ymin
:10→Ymax
:"√(2)abs(X)+√(100-X2))/2"→Y1
:"√(2)abs(X)-√(100-X2))/2"→Y2
:Line(9.89,6.27,9.89.7.72
:Line(-9.89,6.27,-9.89,7.72
:Text(20,28,"WILL YOU BE
:Text(28,25,"MY VALENTINE?

BLACKJACK

Secretly play blackjack on your computer in math class!

:ClrHome
:Trace
:Menu("   BLACKJACK   ","PLAY GAME",1,"QUIT",2
:Lbl 1
:Clrhome
:randInt(1,13)->A
:randInt(1,13)->B
:randInt(1,13)->C
:rantInt(1,13)->D
:randInt(1,13)->E
:rantInt(1,13)->F
:If A>10:10->A
:If B>10:10->B
:If C>10:10->C
:If D>10:10->D
:If E>10:10->E
:If A=1 and B=10
:Then
:Output(5,3,"BLACKJACK!
:Pause
:Goto S
:Else
:If B=1 and A=10
:Then
:Output(5,3,"BLACKJACK!
:Pause
:Goto S
:End
:End
:If A=1
:Then
:B->T
:Disp "TOTAL IS"
:Disp T
:Input "1 or 11?",A
:If A=1
:Then
:1->A
:Else
:11->A
:End
:End
:If B=1
:Then
:A->T
:Disp "TOTAL IS"
:Disp T
:Input "1 or 11?",G
:If G=1
:Then
:1->B
:Else
:11->B
:End
:End
:ClrHome
:A+B->T
Output(1,5,"YOU DREW
:Output(3,1,A
:Output(3,4,B
:Output(5,3,"TOTAL OF
:Output(5,13,T
:Output(7,3,"STAY=1 HIT=2
:Disp "","","","","","",""
:If T>21:Goto B
:Input G
:If G=1
:Then
:Goto E
:Lbl E
:ClrHome
:If F>21
:Then
:Output(3,4,"HOUSE BUST
:Output(5,5"YOU WIN
:Pause
:Goto S
:End
:Output(1,3,"YOUR TOTAL IS
:Output(2,9,T
:Output(4,2,"HOUSE TOTAL IS
:Output(5,9,F
:If T>F
:Then
:Output(7,6,"YOU WIN
:Pause
:Goto S
:End
:If F>T
:Then
:Output(7,5,"YOU LOSE
:Pause
:Goto S
:End
:If F=T
:Then
:Output(7,4,"TIE/PUSH
:Pause
:Goto S
:End
:Else
:If C=1
:Then
:ClrHome
:Disp "TOTAL IS
:Disp T
:Input "1 or 11?",C
:If C=1
:Then
:1->C
:ELse
:11->
:End
:End
:A+B+C-T
:Disp "","","","","","",""
Output(1,5,"YOU DREW
:Output(3,1,A
:Output(3,4,B
:Output(3,7,C
:Output(5,3,"TOTAL IS
:Output(5,13,T
:Output(7,3,"STAY=1 HIT=2
:If T>21:Goto B
:Input G
:If G=1
:Then
:Goto E
:Else
:If D=1
:Then
:ClrHome
:Disp "TOTAL IS
:Disp T
:Input "1 or 11?",D
:If D=1
:Then
:1->D
:Else
:11->D
:End
:End
:A+B+C+D->T
:Disp "","","","","","",""
:Output(1,5,"YOU DREW
:Output(3,1,A
:Output(3,4,B
:Output(3,7,C
:Output(3,10,D
:Output(5,3,"TOTAL IS
:Output(5,13,T
:Output(7,3,"STAY=1 HIT=2
:If T>21:Goto B
:Input G
:If G=1
:Goto E
:Else
:If E=1
:Then
:Disp "TOTAL IS
:Disp T
:Input "1 or 11?",E
:If E=1
:Then
:1->E
:Else
:11->E
:End
:End
:A+B+C+D+E->T
:Disp "","","","","","",""
:Output(1,5,"YOU DREW
:Output(3,1,A
:Output(3,4,B
:Output(3,7,C
:Output(3,10,D
:Output(3,13,E
:Output(5,3,"TOTAL OF
:Output(5,13,T
:If T>21
:Then
:Goto B
:Else
:Pause
:Goto E
:Lbl B
:ClrHome
:Output(1,7,"BUST
:Output(3,5,"YOU LOSE
:Output(5,3,:TOTAL OF
:Output(5,12,T
:X
:Goto S
:Lbl 2)

RADIATION

Want to convince your friends your calculator is radioactive? Here's a cool way to do it. Note: making this program will not necessarily convince your friend that you are cool.

:"int(tan-1(θ))"→r1
:"int(sin(3θ))"→r2
:Radian
:POlar
:Simul
:-1→Xmin
:1→Xmax
:0→θmin
:4000→θmax
:-1→Ymin
:→Ymax
11→θstep
:AxesOff
:ClrDraw
:ZSquare
:.354387→A
:.51612903→B
:Pt-On(A,B
:Pt-On(-A,B
:-.51612903→C
:.35483871→D
:Pt-On(C,D
:Pt-On(-C,D

SIERPIN

This program came with the calculator manual. It draws a Sierpinski triangle, which is a fractal recognizable as similar to the symbol from Legend of Zelda.

:0→Xmin
:1→Xmax
:0→Ymin
:0→Ymax
:FnOff
:ClrDraw
:PlotsOff
:AxesOff
:rand→X
:rand→Y
:For(K,1,3000
:rand→N
If N≤1/3
:Then
:.5X→X
:.5Y→Y
:End
:If 1/3<N and N≤2/3
:Then
:.5(.5+X→X
:.5(1+Y→Y
:End
:If 2/3<N
:Then
:.5(1+X→X
:.5Y→Y
:End
:Pt-On(X,Y
:End