[Free42] Minichallenge: ->DATE - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: Not HP Calculators (/forum-7.html) +--- Forum: Not quite HP Calculators - but related (/forum-8.html) +--- Thread: [Free42] Minichallenge: ->DATE (/thread-15463.html) |
[Free42] Minichallenge: ->DATE - Werner - 08-13-2020 08:23 AM Flags 31 and 67 control the DATE format in Free42: D.MY F67C, F31S M.DY F67C, F31C Y.MD F67S (F31C) Given YYYY in Z, MM in Y and DD in X, write a routine that will return the date in the current format. Shortes number of lines, then number of bytes. Good luck! Werner While you're at it, write the reverse routine DATE-> as well RE: [Free42] Minichallenge: ->DATE - Didier Lachieze - 08-13-2020 06:54 PM My solution, with YYYY in Z, MM in Y and DD in X, it returns the date in the current format: Code: 00 { 31-Byte Prgm } And the reverse routine: Code: 00 { 37-Byte Prgm } RE: [Free42] Minichallenge: ->DATE - Werner - 08-13-2020 07:11 PM Close ;-) Actually, the first routine matches mine in line and byte count, but yours can be made 1 byte shorter ;-) I still have a 2 byte edge over the second. Werner RE: [Free42] Minichallenge: ->DATE - Didier Lachieze - 08-13-2020 08:26 PM (08-13-2020 07:11 PM)Werner Wrote: Close ;-) You're right, here is the 1 byte shorter version : Code: 00 { 30-Byte Prgm } RE: [Free42] Minichallenge: ->DATE - Werner - 08-17-2020 06:27 AM here's my entry for DATE→ : Code: 00 { 35-Byte Prgm } Thanks for your participation, Didier! Your routine could again be made 1 byte shorter (X^2 io STOx ST Y), which would make it just 1 byte more than mine, with the same line count. Werner RE: [Free42] Minichallenge: ->DATE - grsbanks - 08-17-2020 12:23 PM (08-17-2020 06:27 AM)Werner Wrote: Thanks for your participation, Didier! Your routine could again be made 1 byte shorter (X^2 io STOx ST Y) "X^2" and "STOx ST Y" don't do the same thing. With X^2 you end up with Y unchanged and X^2 in X. With STOx ST Y you end up with X*Y in Y and X unchanged. RE: [Free42] Minichallenge: ->DATE - Werner - 08-17-2020 01:13 PM The full code snippet reads Code: 10 100 and here, STOx ST Y may be replaced by X^2, since LASTX is not used further on. Cheers, Werner |