This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's TI-BASIC subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. TI-Basic Brain Teasers => TI-BASIC
Author Message
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 26 Mar 2007 08:32:55 am    Post subject:

Here's a classic one:

Brainteaser #11
Write a "quine", that is, a program that will display its own code, including the PROGRAM:NAME at the top of the program. For " and → you may use a substitute symbol, but in all other ways, the output must look exactly as the program does while editing it.


I have an (84 bytes + # of characters in name) solution, but I don't feel convinced that this is the smallest you can get.

P.S. when you get it, be careful not to accidentally press CLEAR and delete the code when you think you're clearing the output!


Last edited by Guest on 26 Mar 2007 01:00:20 pm; edited 1 time in total
Back to top
calc84maniac


Elite


Joined: 22 Jan 2007
Posts: 770

Posted: 26 Mar 2007 10:47:18 am    Post subject:

I have one that's 47 bytes in the mem menu: (tell me if this is cheating)
Quote:
PROGRAM:A
:
:
:
:
:
:
:
:Clrhome
:For(X,2,8
:Output(X,1,":
:End
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 26 Mar 2007 11:04:48 am    Post subject:

It doesn't display all of its code, just the first 8 lines.
Back to top
vuurrobin


Advanced Member


Joined: 09 Aug 2006
Posts: 428

Posted: 26 Mar 2007 11:07:19 am    Post subject:

and it doesn't have [font="courier new;font-size:9pt;line-height:100%;color:darkblue"]PROGRAM:C :/

this one is hard

Last edited by Guest on 26 Mar 2007 12:07:55 pm; edited 1 time in total
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 26 Mar 2007 12:37:17 pm    Post subject:

[s]I can find a way to do it while imitating the store symbol. Tell me if this is legal.[/s]

Nevermind, that ruins things.


Last edited by Guest on 26 Mar 2007 12:40:04 pm; edited 1 time in total
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 26 Mar 2007 12:49:15 pm    Post subject:

...But yeah, using an imitation of the store symbol is fine.
Back to top
alexrudd
pm me if you read this


Bandwidth Hog


Joined: 06 Oct 2004
Posts: 2335

Posted: 26 Mar 2007 01:23:25 pm    Post subject:

Assuming Ans is "PRGM:NAME :Ans"

Code:
PRGM:NAME
:Ans
Back to top
vuurrobin


Advanced Member


Joined: 09 Aug 2006
Posts: 428

Posted: 26 Mar 2007 01:36:36 pm    Post subject:

that doesn't display the second line. only output has linewrap.

and I think you need to store something in ans in the program, instead of asuming what it is.
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 26 Mar 2007 02:16:16 pm    Post subject:

DarkerLine, did your result take up more than one screen?
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 26 Mar 2007 02:59:12 pm    Post subject:

I managed to fit it on one screen, barely (thus avoiding the touchy issue of what to do if you have more than one screen).

I also discovered an optimization of sorts. If you call the program prgmGDB1GDB1 then you can refer to that name, inside the program, with two GDB1 tokens rather than by typing out the name - this saves 4 bytes every time you do it.


Last edited by Guest on 26 Mar 2007 03:00:41 pm; edited 1 time in total
Back to top
calc84maniac


Elite


Joined: 22 Jan 2007
Posts: 770

Posted: 26 Mar 2007 05:20:52 pm    Post subject:

I haven't been able to do one that fits on one screen. Almost, but not quite...
Back to top
Neekstar


Advanced Newbie


Joined: 14 Dec 2006
Posts: 75

Posted: 26 Mar 2007 06:54:46 pm    Post subject:

Haha, you need to think outside the box for this problem. It's a nice one Smile
Back to top
Harrierfalcon
The Raptor of Calcs


Super Elite (Last Title)


Joined: 25 Oct 2006
Posts: 2535

Posted: 26 Mar 2007 08:08:10 pm    Post subject:

Yeesh....this is the hardest teaser yet. Urm....I'm on vacation as of now, but I have my calc with me (duh!) so maybe'll I'll come up with something tonight while we're watching the Food Network.

Neekstar, you make it sound like you have a solution. Wink
Back to top
Fallen Ghost


Elite


Joined: 15 Jun 2006
Posts: 955

Posted: 26 Mar 2007 08:19:11 pm    Post subject:

I already made an assembly version of that. I call it a thing that lets you scroll through your memory.

Quote:
Here's a TI-basic edition:

PRGM:A
:prgmB
Outside the box, but still, we would just look in program B


Last edited by Guest on 26 Mar 2007 08:19:51 pm; edited 1 time in total
Back to top
luby
I want to go back to Philmont!!


Calc Guru


Joined: 23 Apr 2006
Posts: 1477

Posted: 26 Mar 2007 08:27:09 pm    Post subject:

[font="courier new;font-size:9pt;line-height:100%;color:darkblue"]
prgmA
Text(-1,0,0,"prgmA",Text(-1,0,0,[prgmA]


I substituted [ for "
Does it work?
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 26 Mar 2007 08:39:09 pm    Post subject:

Not quite. Aside from the fact you have a missing quote before the Text(, it also doesn't exactly reproduce its code. For example, the program contains two Text( commands while its output only contains one.
Back to top
luby
I want to go back to Philmont!!


Calc Guru


Joined: 23 Apr 2006
Posts: 1477

Posted: 26 Mar 2007 08:47:33 pm    Post subject:

@Fallen Ghost Your program won't work unless program b is [font="courier new;font-size:9pt;line-height:100%;color:darkblue"]Output(1,1,"prgmA
Output(2,1,"prgmB
Back to top
stlcards08


Newbie


Joined: 04 Mar 2007
Posts: 35

Posted: 26 Mar 2007 08:50:18 pm    Post subject:

luby wrote:
[font="courier new;font-size:9pt;line-height:100%;color:darkblue"]
prgmA
Text(-1,0,0,"prgmA",Text(-1,0,0,[prgmA]


Is there supposed to be another quote after the comma before the second Text? Tecnically, it doesn't display everything because only one Text shows up on the screen, but there are 2 in your program. Whoever it was that came up with the challenge made it sound like it had to be EXACTLY the same.

Oops, darkerline beat me too it. That will teach me to do laundry while typing my post


Last edited by Guest on 26 Mar 2007 08:51:56 pm; edited 1 time in total
Back to top
luby
I want to go back to Philmont!!


Calc Guru


Joined: 23 Apr 2006
Posts: 1477

Posted: 26 Mar 2007 08:52:50 pm    Post subject:

stlcards08 wrote:
Is there supposed to be another quote after the comma before the second Text? Tecnically, it doesn't display everything because only one Text shows up on the screen, but there are 2 in your program. Whoever it was that came up with the challenge made it sound like it had to be EXACTLY the same.
[post="99522"]<{POST_SNAPBACK}>[/post]


Darkerline @ Mar 26 2007 wrote:
Not quite. Aside from the fact you have a missing quote before the Text(, it also doesn't exactly reproduce its code. For example, the program contains two Text( commands while its output only contains one.


is there an echo?


This is very very hard. I don't see a way.


Last edited by Guest on 26 Mar 2007 08:54:11 pm; edited 1 time in total
Back to top
stlcards08


Newbie


Joined: 04 Mar 2007
Posts: 35

Posted: 26 Mar 2007 09:05:52 pm    Post subject:

luby wrote:
stlcards08 wrote:
Is there supposed to be another quote after the comma before the second Text? Tecnically, it doesn't display everything because only one Text shows up on the screen, but there are 2 in your program. Whoever it was that came up with the challenge made it sound like it had to be EXACTLY the same.
[post="99522"]<{POST_SNAPBACK}>[/post]


Darkerline @ Mar 26 2007 wrote:
Not quite. Aside from the fact you have a missing quote before the Text(, it also doesn't exactly reproduce its code. For example, the program contains two Text( commands while its output only contains one.


is there an echo?


This is very very hard. I don't see a way.
[post="99524"]<{POST_SNAPBACK}>[/post]


Yeah, my bad. :blush: I got yelled at to do some laundry before I got to finish my post.
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    » Goto page 1, 2  Next
» View previous topic :: View next topic  
Page 1 of 2 » All times are UTC - 5 Hours

 

Advertisement