Jump to content
IGNORED

To Optimize, or to Scrap...


Opry99er

Recommended Posts

I was thinking about this morning, and couldn't resist a quick check. It turns out the fastest, and shortest (in terms of bytes used) is this:

 

 

3500 display at(1,1):"1) HEAL (10 MP)"
3510 display at(2,1):"2) CURE (15 MP)"
3520 display at(3,1):"3) LIFE (20 MP)"

 

The code I posted yesterday was 132 bytes. The code above is 105 bytes - 27 bytes shorter!

 

There will be a trade-off point where, as you add more strings it becomes more memory efficient to use a string slicing technique, or a string array, but three strings/spells aint at the trade-off point. Four probably isn't either.

 

Sometimes simpler is better!

Link to comment
Share on other sites

Or just have a leading space in the string... No?

 

Sometimes spending the extra byte is okay to save program space - but in this case Willsy's is still the most efficient way to chop up the string. Don't be afraid of different starts, stops, and steps in a loop - you can often save a lot of program time/space by being creative with a step. ;)

 

Sometimes simpler is better!

 

Nice! Cool to see it measured out.

Link to comment
Share on other sites

...

3500 display at(1,1):"1) HEAL (10 MP)"
3510 display at(2,1):"2) CURE (15 MP)"
3520 display at(3,1):"3) LIFE (20 MP)"

...

 

I must be missing something about how you expect this to be implemented.

 

Not having tested it, I don't know whether the following is better, but it is another alternative:

2610 DISPLAY AT(15,1):" "
2620 ON MN(C)+1 GOTO 2660,2650,2640,2630   ! <---presumes MN(C) will only be 0 – 3
2630 DISPLAY AT(18,1):"3) LIFE (20 MP)"
2640 DISPLAY AT(17,1):"2) CURE (15 MP)"
2650 DISPLAY AT(16,1):"1) HEAL (10 MP)"
2660 <more stuff>

...lee

Edited by Lee Stewart
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...