Date : Fri, 20 Nov 2009 12:22:26 +0000
From : rs423@... (Mick Champion)
Subject: Quine
Rob wrote:
> This was my version of doing a self-LIST, started before I realised it
> was quicker to cut down the code to a PRINT $(PAGE+n) ! ...... I
> avoided the whole GOTO issue!! I've finished it off and it seems to
> work..
>
> 5@%=5
> 10DIMA$(128)
> 20REPEAT:READ B%:IF B% THEN READ B$:A
> $(B%-126)=B$
> 30UNTILB%=0
> 40FORI%=PAGE TO TOP-2
> 50A%=?I%
> 60IFA%=13ANDI%?1<>255THENPRINT'I%?2+2
> 56*I%?1;:I%=I%+3
> 70IFA%>31ANDA%<127VDUA%
> 80IF A%>126 PRINTA$(A%-126);
> 90NEXT
> 100DATA128,"AND",144,"PAGE",184,"TO"
> 110DATA220,"DATA",231,"IF",243,"READ"
> 120DATA245,"REPEAT",253,"UNTIL"
> 130DATA241,"PRINT",227,"FOR"
> 140DATA140,"THEN",132,"OR",239,"VDU"
> 150DATA247,"RESTORE",237,"NEXT"
> 160DATA 222,"DIM"
> 170DATA0
>
I certainly does work. A lot quicker than mine too. Wish I'd thought of
reading the tokens into an array in index form, therefore not having to
read same old data time after time. Nice!
Mick.
>
> On 20/11/2009, Mick Champion <rs423@...> wrote:
>
>> Steve Fewell wrote:
>>
>>> Also:
>>> 570 DATA 247,"RESTORE"
>>>
>>> For me line 140 still prints with a '#' after the line number - I can't
>>> work out why that is!
>>>
>>> Steve.
>>>
>>>
>> For me it's a "!"???
>>
>>
>> Mick.
>>
>>
>>
>>
>>> --- On Fri, 20/11/09, Steve Fewell <kranser@...> wrote:
>>>
>>>
>>>
>>>> From: Steve Fewell <kranser@...>
>>>> Subject: Re: [BBC-Micro] Quine
>>>> To: bbc-micro@..., "Mick Champion" <rs423@...>
>>>> Date: Friday, 20 November, 2009, 1:22
>>>> No you had STR$ - you missed CHR$!
>>>>
>>>> 455 DATA 189,"CHR$"
>>>>
>>>> I also made these changes:
>>>> 70 UNTIL A%>=TOP-1
>>>> 140 B%=?A%*256+A%?1:A%=A%+2:PRINT ;B%;
>>>> 270 PRINT ;?B%-B%?1;
>>>> 320 IF A$="*" A$="<*"+STR$?A%+"*>"
>>>>
>>>> Steve.
>>>>
>>>> --- On Fri, 20/11/09, Mick Champion <rs423@...>
>>>> wrote:
>>>>
>>>>
>>>>
>>>>> From: Mick Champion <rs423@...>
>>>>> Subject: Re: [BBC-Micro] Quine
>>>>> To: bbc-micro@...
>>>>> Date: Friday, 20 November, 2009, 0:50
>>>>> Mick Champion wrote:
>>>>>
>>>>>
>>>>>> 400 DATA 128,"AND"
>>>>>> 410 DATA 130,"EOR"
>>>>>> 420 DATA 132,"OR"
>>>>>>
>>>>>>
>>>>>>
>>>>> ....
>>>>>
>>>>> Arrrgh! I missed out the token for STR$
>>>>>
>>>>> 455 DATA 195,"STR$"
>>>>>
>>>>>
>>>>> Also see a "!" on line 140. Oh dear. Failure!!!!
>>>>>
>>>>>
>>>> Better
>>>>
>>>>
>>>>> leave looking
>>>>> more until I wake up sometime next month <cry>
>>>>>
>>>>>
>>>>> Mick.
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> bbc-micro mailing list
>>>>> bbc-micro@...
>>>>> http://lists.cloud9.co.uk/mailman/listinfo/bbc-micro
>>>>>
>>>>>
>>>>>
>>>> _______________________________________________
>>>> bbc-micro mailing list
>>>> bbc-micro@...
>>>> http://lists.cloud9.co.uk/mailman/listinfo/bbc-micro
>>>>
>>>>
>>>>
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>>
>>> No virus found in this incoming message.
>>> Checked by AVG - www.avg.com
>>> Version: 9.0.707 / Virus Database: 270.14.73/2514 - Release Date: 11/19/09
>>> 19:42:00
>>>
>>>
>>>
>> _______________________________________________
>> bbc-micro mailing list
>> bbc-micro@...
>> http://lists.cloud9.co.uk/mailman/listinfo/bbc-micro
>>
>>
>> ------------------------------------------------------------------------
>>
>>
>> No virus found in this incoming message.
>> Checked by AVG - www.avg.com
>> Version: 9.0.707 / Virus Database: 270.14.73/2514 - Release Date: 11/19/09
19:42:00
>>
>>