[Free42] Minichallenge: ->DATE
|
08-13-2020, 08:23 AM
(This post was last modified: 08-13-2020 10:40 AM by Werner.)
Post: #1
|
|||
|
|||
[Free42] Minichallenge: ->DATE
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 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
08-13-2020, 06:54 PM
Post: #2
|
|||
|
|||
RE: [Free42] Minichallenge: ->DATE
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 } |
|||
08-13-2020, 07:11 PM
Post: #3
|
|||
|
|||
RE: [Free42] Minichallenge: ->DATE
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 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
08-13-2020, 08:26 PM
Post: #4
|
|||
|
|||
RE: [Free42] Minichallenge: ->DATE
(08-13-2020 07:11 PM)Werner Wrote: Close ;-) You're right, here is the 1 byte shorter version : Code: 00 { 30-Byte Prgm } |
|||
08-17-2020, 06:27 AM
Post: #5
|
|||
|
|||
RE: [Free42] Minichallenge: ->DATE
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 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
08-17-2020, 12:23 PM
Post: #6
|
|||
|
|||
RE: [Free42] Minichallenge: ->DATE
(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. There are only 10 types of people in this world. Those who understand binary and those who don't. |
|||
08-17-2020, 01:13 PM
Post: #7
|
|||
|
|||
RE: [Free42] Minichallenge: ->DATE
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 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)