A Challenge

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
RossG
Posts: 247
Joined: Thu Jan 08, 2015 7:38 am

A Challenge

Post by RossG » Tue May 17, 2016 12:56 am

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?
Is age an excuse? Eighty-four and counting.
Programming powered by coffee.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10330
Joined: Wed May 06, 2009 2:28 pm

Re: A Challenge

Post by dunbarx » Tue May 17, 2016 1:46 am

Write a handler that sends a short email message to Colin Holgate.

Craig Newman

RossG
Posts: 247
Joined: Thu Jan 08, 2015 7:38 am

Re: A Challenge

Post by RossG » Tue May 17, 2016 3:37 am

dunbarx

If only I could. Show me how - in as many lines
as it takes.
Is age an excuse? Eighty-four and counting.
Programming powered by coffee.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10330
Joined: Wed May 06, 2009 2:28 pm

Re: A Challenge

Post by dunbarx » Tue May 17, 2016 5:51 am

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.
Last edited by dunbarx on Tue May 17, 2016 6:54 am, edited 2 times in total.

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: A Challenge

Post by Dixie » Tue May 17, 2016 6:25 am

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 !...:-)

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10330
Joined: Wed May 06, 2009 2:28 pm

Re: A Challenge

Post by dunbarx » Tue May 17, 2016 6:51 am

Dixie.

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

Craig

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: A Challenge

Post by Dixie » Tue May 17, 2016 7:26 am

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...

ghettocottage
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 366
Joined: Tue Apr 10, 2012 9:18 am

Re: A Challenge

Post by ghettocottage » Tue May 17, 2016 2:42 pm

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

RossG
Posts: 247
Joined: Thu Jan 08, 2015 7:38 am

Re: A Challenge

Post by RossG » Tue May 17, 2016 9:55 pm

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.
Is age an excuse? Eighty-four and counting.
Programming powered by coffee.

Post Reply