Yahztee for the HP 41 - improve this program!
|
03-31-2018, 05:44 PM
(This post was last modified: 03-31-2018 07:48 PM by Dieter.)
Post: #2
|
|||
|
|||
RE: Yahztee for the HP 41 - improve this program!
I think you can either have compact code or one that is executing fast. I have not examined the whole program – maybe a complete rewrite is the only way to get substantial improvements – but here are two examples for the sort routine.
Short version (kind of bubble sort): Code: LBL 40 This takes about 4 – 5 seconds for sorting the five numbers in R14...R18. Edit: if you like watching the RAD annunciator, here is another version that on average also runs faster since it detects whether a register swap occured or not: Code: LBL 40 But this version still is a bit slower than yours, and I do not think it saves any bytes. Finally here is my favourite: it is longer but very fast – essentially it's the same approach as above, but without loops: Code: LBL 40 This one executes in not much more than a second (!) – in any case. The part that rolls the dice can be improved as follows. Input: up to 5-digit number representing the dice to roll, e.g. 12345. Code: LBL 71 This even saves a label (20). And it also checks whether a die number is zero (invalid). So far a few first thoughts. Dieter |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Yahztee for the HP 41 - improve this program! - Gene - 03-30-2018, 07:17 PM
RE: Yahztee for the HP 41 - improve this program! - Dieter - 03-31-2018 05:44 PM
|
User(s) browsing this thread: 2 Guest(s)