If the ball falls outside the edges, you get an error. I have no intention to fix this, you're not supposed to let it go past edges anyway. And don't fill the screen with walls, it won't stop the ball.
Program BOUNCE: 1->X 1->Y [[0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0][1,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,1][0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0][1,0,2,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,2,0,1][0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0][1,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,1][0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0]]->Mat C Lbl A Mat C[Y,X]->T T=1=>Locate X,Y,"#" X+1->X If X=22 Then 1->X Y+1->Y IfEnd Y=8=>Goto B Goto A Lbl B 2->X 4->Y 1->A 1->B Lbl C Getkey=31=>Prog "EDIT" X->C Y->D X+A->X Y+B->Y Locate X,Y,"O" Locate C,D," " Mat C[Y,X+1]=1=>-1->A Mat C[Y,X-1]=1=>1->A Mat C[Y+1,X]=1=>-1->B Mat C[Y-1,X]=1=>1->B Goto C
OR: http://h1.ripway.com/tutti/BOUNCE.CAT
Program EDIT: X->M Y->N 2->X 1->Y Lbl A X>1=>Locate X-1,Y,"-" X<21=>Locate X+1,Y,"-" Getkey->K (K<>27)(K<>28)(K<>37)(K<>38)(K<>31)(K<>44)(K<>47)=1=>Goto A X>1=>Locate X-1,Y," " X<21=>Locate X+1,Y," " If K=27 Then X+1->X Y-1->Y If (X>=21)(Y=<1)=0 Then X-1->X Y+1->Y IfEnd IfEnd If K=28 Then X-1->X Y-1->Y If (X=<1)(Y=<1)=0 Then X+1->X Y+1->Y IfEnd IfEnd If K=37 Then X+1->X Y+1->Y If (X>=21)(Y>=7)=0 Then X-1->X Y-1->Y IfEnd IfEnd If K=38 Then X-1->X Y+1->Y If (X=<1)(Y>=7)=0 Then X+1->X Y-1->Y IfEnd IfEnd If K=31 Then 1->Mat C[Y,X] Locate X,Y,"#" IfEnd If K=44 Then 2->Mat C[Y,X] Locate X,Y," " IfEnd K=47=>Goto Z Goto A Lbl Z M->X N->Y
OR: http://h1.ripway.com/tutti/BNCEDIT.CAT