Skip to main content
Code Review

Return to Question

Question Protected by Mast
Added Calculator Type
Source Link

Anyone who has programmed in TI-Basic is likely to have written one of these programs. The concept for this program is simple.

The "ball" represented by a single point that originates from the upper left hand corner of the screen and bounces around the screen leaving a trail as it travels. The initial movement vector for the ball is (1,1), meaning one down, one right. During each pass through a loop, the "ball" is translated by the amount specified in the movement vector. When the ball would go of bounds, its movement vector is adjusted so that this does not happen. In short, it behaves like this:

enter image description here

except I increased the frame of the GIF.

I've reduced my code to a very short and clean snippet:

FnOff 
PlotsOff 
AxesOff
ClrDraw
{1,1→L1
Repeat getKey
Ans→L2
Pxl-Change(L1(1),L1(2
Ans+L1→L1
L2*(1-2not(Ans and Ans≠{62,94
End
FnOn 
PlotsOn 
AxesOn
ClrDraw

What I would like to hear in responses can be enumerated in four points:

  1. How can I reduce the size of this program?
  2. How can I increase the speed of this program?
  3. How can I reduce the numbers of variables used in this program?
  4. How can I increase the clarity of this program without sacrificing any of the goals stated above?

People responding to this post should also keep in mind that this code was written for and tested on a TI-83 Plus calculator.

Anyone who has programmed in TI-Basic is likely to have written one of these programs. The concept for this program is simple.

The "ball" represented by a single point that originates from the upper left hand corner of the screen and bounces around the screen leaving a trail as it travels. The initial movement vector for the ball is (1,1), meaning one down, one right. During each pass through a loop, the "ball" is translated by the amount specified in the movement vector. When the ball would go of bounds, its movement vector is adjusted so that this does not happen. In short, it behaves like this:

enter image description here

except I increased the frame of the GIF.

I've reduced my code to a very short and clean snippet:

FnOff 
PlotsOff 
AxesOff
ClrDraw
{1,1→L1
Repeat getKey
Ans→L2
Pxl-Change(L1(1),L1(2
Ans+L1→L1
L2*(1-2not(Ans and Ans≠{62,94
End
FnOn 
PlotsOn 
AxesOn
ClrDraw

What I would like to hear in responses can be enumerated in four points:

  1. How can I reduce the size of this program?
  2. How can I increase the speed of this program?
  3. How can I reduce the numbers of variables used in this program?
  4. How can I increase the clarity of this program without sacrificing any of the goals stated above?

Anyone who has programmed in TI-Basic is likely to have written one of these programs. The concept for this program is simple.

The "ball" represented by a single point that originates from the upper left hand corner of the screen and bounces around the screen leaving a trail as it travels. The initial movement vector for the ball is (1,1), meaning one down, one right. During each pass through a loop, the "ball" is translated by the amount specified in the movement vector. When the ball would go of bounds, its movement vector is adjusted so that this does not happen. In short, it behaves like this:

enter image description here

except I increased the frame of the GIF.

I've reduced my code to a very short and clean snippet:

FnOff 
PlotsOff 
AxesOff
ClrDraw
{1,1→L1
Repeat getKey
Ans→L2
Pxl-Change(L1(1),L1(2
Ans+L1→L1
L2*(1-2not(Ans and Ans≠{62,94
End
FnOn 
PlotsOn 
AxesOn
ClrDraw

What I would like to hear in responses can be enumerated in four points:

  1. How can I reduce the size of this program?
  2. How can I increase the speed of this program?
  3. How can I reduce the numbers of variables used in this program?
  4. How can I increase the clarity of this program without sacrificing any of the goals stated above?

People responding to this post should also keep in mind that this code was written for and tested on a TI-83 Plus calculator.

Post Reopened by 200_success
Post Closed as "Not suitable for this site" by 200_success
Tweeted twitter.com/#!/StackCodeReview/status/571774617112715265
added 10 characters in body
Source Link
Jamal
  • 35.2k
  • 13
  • 134
  • 238

Anyone who has programmed in TI-Basic is likely to have written one of these programs. The concept for this program is simple.

The "ball" represented by a single point that originates from the upper left hand corner of the screen and bounces around the screen leaving a trail as it travels. The initial movement vector for the ball is (1,1), meaning one down, one right. During each pass through a loop, the "ball" is translated by the amount specified in the movement vector. When the ball would go of bounds, its movement vector is adjusted so that this does not happen. In short, it behaves like this:

enter image description here

except I increased the frame of the GIF.

I've reduced my code to a very short and clean snippet.:

FnOff 
PlotsOff 
AxesOff
ClrDraw
{1,1→L1
Repeat getKey
Ans→L2
Pxl-Change(L1(1),L1(2
Ans+L1→L1
L2*(1-2not(Ans and Ans≠{62,94
End
FnOn 
PlotsOn 
AxesOn
ClrDraw

What I would like to hear in responses can be enumerated in four points.:

  1. How tocan I reduce the size of this program.?
  2. How tocan I increase the speed of this program.?
  3. How can I reduce the numbers of variables used in this program.?
  4. How tocan I increase the clarity of this program without sacrificing any of the goals stated above.?

Anyone who has programmed in TI-Basic is likely to have written one of these programs. The concept for this program is simple.

The "ball" represented by a single point that originates from the upper left hand corner of the screen and bounces around the screen leaving a trail as it travels. The initial movement vector for the ball is (1,1), meaning one down, one right. During each pass through a loop, the "ball" is translated by the amount specified in the movement vector. When the ball would go of bounds, its movement vector is adjusted so that this does not happen. In short, it behaves like this:

enter image description here

except I increased the frame of the GIF.

I've reduced my code to a very short and clean snippet.

FnOff 
PlotsOff 
AxesOff
ClrDraw
{1,1→L1
Repeat getKey
Ans→L2
Pxl-Change(L1(1),L1(2
Ans+L1→L1
L2*(1-2not(Ans and Ans≠{62,94
End
FnOn 
PlotsOn 
AxesOn
ClrDraw

What I would like to hear in responses can be enumerated in four points.

  1. How to reduce the size of this program.
  2. How to increase the speed of this program.
  3. How reduce the numbers of variables used in this program.
  4. How to increase the clarity of this program without sacrificing any of the goals stated above.

Anyone who has programmed in TI-Basic is likely to have written one of these programs. The concept for this program is simple.

The "ball" represented by a single point that originates from the upper left hand corner of the screen and bounces around the screen leaving a trail as it travels. The initial movement vector for the ball is (1,1), meaning one down, one right. During each pass through a loop, the "ball" is translated by the amount specified in the movement vector. When the ball would go of bounds, its movement vector is adjusted so that this does not happen. In short, it behaves like this:

enter image description here

except I increased the frame of the GIF.

I've reduced my code to a very short and clean snippet:

FnOff 
PlotsOff 
AxesOff
ClrDraw
{1,1→L1
Repeat getKey
Ans→L2
Pxl-Change(L1(1),L1(2
Ans+L1→L1
L2*(1-2not(Ans and Ans≠{62,94
End
FnOn 
PlotsOn 
AxesOn
ClrDraw

What I would like to hear in responses can be enumerated in four points:

  1. How can I reduce the size of this program?
  2. How can I increase the speed of this program?
  3. How can I reduce the numbers of variables used in this program?
  4. How can I increase the clarity of this program without sacrificing any of the goals stated above?
Source Link

TI-Basic Bouncing Ball Animation

Anyone who has programmed in TI-Basic is likely to have written one of these programs. The concept for this program is simple.

The "ball" represented by a single point that originates from the upper left hand corner of the screen and bounces around the screen leaving a trail as it travels. The initial movement vector for the ball is (1,1), meaning one down, one right. During each pass through a loop, the "ball" is translated by the amount specified in the movement vector. When the ball would go of bounds, its movement vector is adjusted so that this does not happen. In short, it behaves like this:

enter image description here

except I increased the frame of the GIF.

I've reduced my code to a very short and clean snippet.

FnOff 
PlotsOff 
AxesOff
ClrDraw
{1,1→L1
Repeat getKey
Ans→L2
Pxl-Change(L1(1),L1(2
Ans+L1→L1
L2*(1-2not(Ans and Ans≠{62,94
End
FnOn 
PlotsOn 
AxesOn
ClrDraw

What I would like to hear in responses can be enumerated in four points.

  1. How to reduce the size of this program.
  2. How to increase the speed of this program.
  3. How reduce the numbers of variables used in this program.
  4. How to increase the clarity of this program without sacrificing any of the goals stated above.
default

AltStyle によって変換されたページ (->オリジナル) /