Maybe this is cheating but MFORTH gives me this one liner arbitrary base
converter. 😁

: BC BASE @ >R BASE ! . R> BASE ! ;

Examples:
255 16 BC FF
23 2 BC 10111
HEX D2 DECIMAL 8 BC 322

- Alex

On Sat, Jan 7, 2023, 15:51 Ken Pettit <petti...@gmail.com> wrote:

> Yep,
>
> Pretty much the same with the one liner I made from John's character
> rasterization program ... just remove the line number "1" in front and it
> will still run from interactive mode.  But I think your infinite loop is 2
> characters shorter than mine!  I used STEP0 which take 5 bytes where you
> used Z=0 which only takes three!  I'll have to remember that one.
>
> I need to get a quantum computer next ... I hear they can execute an
> infinite loop in three seconds flat.  ;-)
>
> Ken
>
> On 1/7/23 11:46 AM, Stephen Adolph wrote:
>
> thanks Ken,
> Not exactly new work, but it always bothered me that I had to use a line
> number before.  so not really a "one liner".  The use of a never ending for
> loop solved that!
>
>
>
> On Sat, Jan 7, 2023 at 2:19 PM Ken Pettit <petti...@gmail.com> wrote:
>
>> On 1/7/23 8:30 AM, Stephen Adolph wrote:
>>
>> Here is my one-liner.
>>
>> FORZ=0TO1:Z=0:V$="
>> "+CHR$(13)+CHR$(8)+"0123456789ABCDEF":E=INSTR(V$,INKEY$):IFE=1THENNEXTELSEF=(F-(E=2))MOD3:G=9*F+2-F^2:C=-C*(E=2)-(C*G+E-4)*(E>3ANDE<G+4):?:?MID$("BDH",F+1,1)":";:D=C:FORI=11*(F=0)-4TO0:J=G^I:X=INT(D*J):?MID$(V$,X+4,1);:D=D-X/J:NEXTI,Z
>>
>>
>> Hey Steve,
>>
>> I had seen this submission before but never really tried to run it or
>> evaluate how it is working until now.  This is an awesome piece of
>> algorithmic work for switching between and calculating / formatting output
>> for three different bases in only 254 characters!!
>>
>> Pretty sweet.
>>
>> Ken
>>
>>
>

Reply via email to