Page 1 of 1

A Challenge

Posted: Tue May 17, 2016 12:56 am
by RossG
I came across Rev v2.8 on the cover disk of a
computer magazine.

It had a restriction. You could only write a
programme with a maximum of ten lines of code.

The Challenge: What's the best you can do with ten lines?

Re: A Challenge

Posted: Tue May 17, 2016 1:46 am
by dunbarx
Write a handler that sends a short email message to Colin Holgate.

Craig Newman

Re: A Challenge

Posted: Tue May 17, 2016 3:37 am
by RossG
dunbarx

If only I could. Show me how - in as many lines
as it takes.

Re: A Challenge

Posted: Tue May 17, 2016 5:51 am
by dunbarx
Ross.

This was an inside joke. The Mr. Holgate I referred to was always able to write a handler with fewer lines than I could. This started when we ran the New York HC user group.

See this:

http://forums.livecode.com/viewtopic.ph ... es#p102767

Craig

EDIT. I have no idea why I used the msg box in that silly thread (or at least my portion of it, where it turned silly) but I would have used a variable normally:

Code: Select all

on mouseup
   put any line of fld 1 into temp
   delete char offset(temp,fld 1) to the length of temp  + offset(temp,fld 1)  of fld 1
end mouseup
I cannot see a way to do this in one line...

EDIT again.

I see that there had to be an "output" along the way. This could easily have been another field, I suppose, so the "variable" edit above would not quite do.

Re: A Challenge

Posted: Tue May 17, 2016 6:25 am
by Dixie
RossG,

The 10 line restriction does not apply to the whole stack... As far as I remember, it was a restriction placed on each object... so, you could have 10 lines of script in a button and 10 lines of script in a field, ten lines of script in the stack script, 10 lines in the card script... So, that being the case, with some careful thought you could accomplish quite a lot !...:-)

Re: A Challenge

Posted: Tue May 17, 2016 6:51 am
by dunbarx
Dixie.

Wasn't that limitation for an early trial version of LC? Why else would such a thing be?

Craig

Re: A Challenge

Posted: Tue May 17, 2016 7:26 am
by Dixie
Dunbarx...

Yes, it was a restriction placed on the use of the software... The actual details of using it escape me, I can't remember if it was a 'trial' package by itself, or if that is how it worked until a serial number was entered...

Re: A Challenge

Posted: Tue May 17, 2016 2:42 pm
by ghettocottage
RossG wrote:I came across Rev v2.8 on the cover disk of a
computer magazine.

It had a restriction. You could only write a
programme with a maximum of ten lines of code.

The Challenge: What's the best you can do with ten lines?

Here is my application with less than 10 lines, one field and one button:

Code: Select all

on mouseUp
   put URL "http://api.icndb.com/jokes/random" into tJSON
   put JsonImport(tJSON) into tArray
   put tArray["value"]["joke"] into field the_joke
end mouseUp

Re: A Challenge

Posted: Tue May 17, 2016 9:55 pm
by RossG
ghettocottage

Thanks for entering into the spirit of the challenge.

Your few lines of code introduced me to great things I
didn't know - the whole purpose of the challenge.