patternMinor
Invert the colors of the graph
Viewed 0 times
invertcolorsthegraph
Problem
I've heard that
I've represented the
Lbl and Goto use up memory that they don't give back. I've noticed clearing the RAM on my calculator frees up a lot of space and makes my programs run a lot faster. Any suggestions on how to minimize memory leaks here would be greatly appreciated. (This code does function correctly other than leaking memory).:-1->B
:Lbl H
:B+1->B
:0->A
:If B=95
:Goto E
:Lbl V
:Pxl-Change(A,B)
:A+1->A
:If A=63
:Goto H
:Goto V
:Lbl EI've represented the
STO→ character, → with -> Also, the graph is 94 pixels wide and 62 pixels tall.Solution
I've heard that Lbl and Goto use up memory that they don't give back
If you replace the following ...
... with ...
... then you have eliminated the final
I don't think you can do better than that: the remaining two gotos are required: unless you unroll the loops.
If you replace the following ...
:If B=95
:Goto E
... etc. ...
:Goto V
:Lbl E... with ...
... etc. ...
:If B<95
:Goto V... then you have eliminated the final
Lbl E as well as its Goto.I don't think you can do better than that: the remaining two gotos are required: unless you unroll the loops.
Code Snippets
:If B=95
:Goto E
... etc. ...
:Goto V
:Lbl E... etc. ...
:If B<95
:Goto VContext
StackExchange Code Review Q#39308, answer score: 5
Revisions (0)
No revisions yet.