Sections
Calendar
January 2021
S M T W T F S
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31            

Members
Not logged in.
 

The Random Rabbit Song
Video (01:34)

In this diversion, a 9-line program plays a randomly-generated melody over accompaniment while filling the screen with rabbits. Forever.

RANDRABBIT (TI Extended BASIC)

You, too, can generate melody and rabbits forever, with this tiny program.

10 CALL CLEAR::D=100::A=110::DIM T(64)::DIM X(37)::S=2^(1/12)::DIM Q(8)::FOR B=0 TO 63::T(B)=A::A=A*S::NEXT B 20 FOR B=0 TO 36::X(B)=2.3+(B*12/7)::NEXT B::FOR B=0 TO 7::READ Q(B)::NEXT B 30 DATA 0,0,3,3,2,5,1,4,2,15,16,9 40 PRINT "THE RANDOM RABBIT SONG"::K$="6C6C6CFEBAFE7C00"::FOR B=96 TO 127 STEP 8::CALL CHAR(B,K$)::READ J::CALL COLOR(B/8-3,J,1)::NEXT B 50 FOR B=0 TO 7::PRINT CHR$(96+(INT(RND*4)*8));::CALL SOUND(D,T(X(RND*10+12)),0,T(X(Q(B))),5) 60 PRINT CHR$(96+(INT(RND*4)*8));::CALL SOUND(D,T(X(RND*10+12)),0,T(X(Q(B)+9)),9,T(X(Q(B)+11)),9) 70 PRINT CHR$(96+(INT(RND*4)*8));::CALL SOUND(D,T(X(RND*10+12)),0,T(X(Q(B)+4)),5) 80 PRINT CHR$(96+(INT(RND*4)*8));::CALL SOUND(D,T(X(RND*10+12)),0,T(X(Q(B)+9)),9,T(X(Q(B)+11)),9)::NEXT B 90 GOTO 50

Posted in Sidequest on 2020-11-23 04:55:00.
Hits: 60