Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Turing oddities contest
Index -> Contests
Goto page 1, 2, 3  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
beard0




PostPosted: Tue Nov 29, 2005 5:30 pm   Post subject: Turing oddities contest

Your job is to take the following bit of code, and insert code in the middle without changing the portion I have written such that the last line (put b), and the last line only causes an error. The first person to PM me working code wins. Please PM only so as to give others a chance to work it out for themselves.

Over the course of the next little while, I will post hints as to how this can be done.

Turing:
var a : string

%This part is your job!

var b : string
b := a (5 .. *)
put a (5 .. *)
put b %This line should produce an error, and be the only one to do so!


EDIT:Corrected my commenting pour utuliser une langue consistent.
Sponsor
Sponsor
Sponsor
sponsor
Hikaru79




PostPosted: Tue Nov 29, 2005 6:30 pm   Post subject: (No subject)

Simple!
code:
var a : string

a := "hello world!"

var b : string
b := a (5 .. *)
put a (5 .. *)
put b //This line should produce an error, and be the only one to do so!

Any code at all in place of that comment generates an error on the last line -- because "//" is Java commenting, not Turing ^__^ I win!

Wink

EDIT: I know you said PM, but since this is sort of a typo on your part and not a real solution, I figured it was okay Razz
MysticVegeta




PostPosted: Tue Nov 29, 2005 6:42 pm   Post subject: (No subject)

if life were like that, you wouldn't need a Visa card.
beard0




PostPosted: Tue Nov 29, 2005 6:54 pm   Post subject: (No subject)

MysticVegeta wrote:
if life were like that, you wouldn't need a Visa card.


What he said.
beard0




PostPosted: Tue Nov 29, 2005 8:28 pm   Post subject: (No subject)

Hint number one: I have received some entries (which incidentally do not work) that attempted to take advantage of user input. No user input is required, and I'm stating now as additional criteria that you may not use input.
MysticVegeta




PostPosted: Tue Nov 29, 2005 11:33 pm   Post subject: (No subject)

almost done, pretty nifty problem Wink
Paul




PostPosted: Wed Nov 30, 2005 6:23 pm   Post subject: (No subject)

Wow, I'm betting its a really obscure error Razz
And hikaru remember its in the middle of the code, not at the end Razz
beard0




PostPosted: Wed Nov 30, 2005 11:55 pm   Post subject: (No subject)

Hint number two wrote:
at


N.B. The hint is in the quote box in white. Highlight to see, unless you'd like to be a purist.
Sponsor
Sponsor
Sponsor
sponsor
beard0




PostPosted: Wed Nov 30, 2005 11:57 pm   Post subject: (No subject)

Paul wrote:
And hikaru remember its in the middle of the code, not at the end :P


It was my error; my code originally had the "//" in the last line (I've been doing more in java of late.) and I changed it after Hikaru79 pointed it out.
MysticVegeta




PostPosted: Thu Dec 01, 2005 9:06 am   Post subject: (No subject)

beard0 wrote:
Hint number two wrote:
at


N.B. The hint is in the quote box in white. Highlight to see, unless you'd like to be a purist.

Wow, thats a good hint! Rolling Eyes
beard0




PostPosted: Thu Dec 01, 2005 9:18 am   Post subject: (No subject)

MysticVegeta wrote:
Wow, thats a good hint! Rolling Eyes


Oh damn, really? I meant it to be rather cryptic as it's only the first real hint. Rolling Eyes
MysticVegeta




PostPosted: Thu Dec 01, 2005 2:37 pm   Post subject: (No subject)

beard0 wrote:

rather cryptic


oh, its cryptic enough for me to not understand it Laughing
beard0




PostPosted: Thu Dec 01, 2005 2:45 pm   Post subject: (No subject)

Hint Number Three wrote:
When I said at, I really meant @
[Gandalf]




PostPosted: Thu Dec 01, 2005 4:50 pm   Post subject: (No subject)

Pah, if you wanted to make Turing crash there's much simpler ways Wink.

code wrote:
var a : string := string @ (241)
var b : string
b := a (5 .. *)
put a (5 .. *)
put b %This line should produce an error, and be the only one to do so!
Tony




PostPosted: Thu Dec 01, 2005 5:09 pm   Post subject: (No subject)

[Gandalf] wrote:
Pah, if you wanted to make Turing crash there's much simpler ways Wink.

That just crashes the environment though.

The goal is to make put b cause an error
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> Contests
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 3  [ 34 Posts ]
Goto page 1, 2, 3  Next
Jump to:   


Style:  
Search: