Opry99er Posted May 6, 2015 Author Share Posted May 6, 2015 Or just have a leading space in the string... No? Quote Link to comment https://forums.atariage.com/topic/237458-to-optimize-or-to-scrap/page/4/#findComment-3232642 Share on other sites More sharing options...
JamesD Posted May 6, 2015 Share Posted May 6, 2015 BTW, there is a fourth (forth) spell... I have not named it yet, but it is likely to be named "ALL-HEAL"... ... Other wise known as "OH SH**" Quote Link to comment https://forums.atariage.com/topic/237458-to-optimize-or-to-scrap/page/4/#findComment-3232712 Share on other sites More sharing options...
Opry99er Posted May 6, 2015 Author Share Posted May 6, 2015 ^^LOL^^ Quote Link to comment https://forums.atariage.com/topic/237458-to-optimize-or-to-scrap/page/4/#findComment-3232747 Share on other sites More sharing options...
Willsy Posted May 7, 2015 Share Posted May 7, 2015 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! Quote Link to comment https://forums.atariage.com/topic/237458-to-optimize-or-to-scrap/page/4/#findComment-3233108 Share on other sites More sharing options...
Tursi Posted May 7, 2015 Share Posted May 7, 2015 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. Quote Link to comment https://forums.atariage.com/topic/237458-to-optimize-or-to-scrap/page/4/#findComment-3233114 Share on other sites More sharing options...
+Lee Stewart Posted May 7, 2015 Share Posted May 7, 2015 (edited) ... 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 May 7, 2015 by Lee Stewart Quote Link to comment https://forums.atariage.com/topic/237458-to-optimize-or-to-scrap/page/4/#findComment-3233139 Share on other sites More sharing options...
Opry99er Posted May 9, 2015 Author Share Posted May 9, 2015 Actually, Lee... That is brilliant and simple. Thanks guys, for making me look at this in a few different ways. Learning a ton this past month... Quote Link to comment https://forums.atariage.com/topic/237458-to-optimize-or-to-scrap/page/4/#findComment-3234469 Share on other sites More sharing options...
Recommended Posts
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.