An interesting programming challenge

Jerry Jensen jhj at jhj.com
Thu Apr 9 21:43:02 EDT 2015


> On Apr 9, 2015, at 6:37 PM, Colin Holgate <colinholgate at gmail.com> wrote:
> 
> So you thought…
> 
> Is it that huge a script that you can’t paste it?
> 
> 
>> On Apr 9, 2015, at 9:36 PM, Jerry Jensen <jhj at jhj.com> wrote:
>> 
>> This time with the stack attached . . .

Aw, crap, no attachments allowed. Here’s the script, after a bunch of returns for the anti-spoiler:







































on mouseUp
   local tRay, tSlices, tRunningSum, tLoopCount, tItem, tMsec
   put the milliseconds into tMsec
   put -22,-26,16,8,7,-18,23,1,27,30,-14,-27,-22,-28,5,-16,7,17,-24,-29,-31,13,31,24,27,-26,6,\
   -29,10,-13,-22,-29,-18,15,-23,32,15,17,14,-1,-9,-10,-11,19,-13,-9,-19,-29,0,10,10,-17,12,-4,\
   -24,-12,12,9,-31,-4,22,24,-9,-12,-31,6,23,-29,-17,-32,30,-29,16,18,13,10,3,-3,-16,-2,16,-6,22,\
   26,19,4,-30,16,16,-2,25,18,1,29,-20,7,-27,30,-25,-11,-9,-2,32,1,32,-32,-13,-2,-27,0,11,-7,14,\
   32,-12,30,-23,30,-9,-31,22,8,26,15,3,22,-8,26,9,-18,31,18,-12,4,-28,20,19,-8,-32,15,0,-14,-1,\
   13,16,-1,-2,6,1,-19,3,29,-14,19,7,10,2,19,-28,-22,-1,-18,-28,0,-10,-28,-1,-22,16,-21,-14,3,-19,\
   13,-17,-1,10,-25,10,7,1,-7,-11,8,-28,-12,-20,-11,-4,-3,1,13,2,-26,29,-3,22,-11,18,-17,1,-22,32,\
   -10,7,15,-6,-7,-18,-29,27,28,20,-4,-13,-21,15,21,10,-15,22,-25,-5,5,-32,26,-14,26,-14,-3,-4,12,\
   1,15,-24,12,-9,-4,-7,-25,-26,32,32,21,-14,-25,20,-2,-3,1,1,10,-12,-31,27,2,-6,12,18,16,16,18,\
   -32,-11,-12,1,7,-13,27,-6,-1,-2,12,-18,-13,-9,13,-28,-23,27,-7,22,-10,-20,-32,32,-14,3,-29,-26,\
   -7,11,-25,-26,-32,18,21,-12,6,-1,3,-31,1,-3,30,28,-12,23,27,-15,2,27,5,29,-16,-9,13,-14,-32,24,\
   -7,17,-25,18,-16,-26,6,-6,12,19,10,14,-13,-27,-19,-24,-24,28,-31,27,10,-26,30,1,-30,27,0,-17,\
   -27,-15,-7,21,5,9,-17,-28,-23,11,-10,-32,-3,-31,-2,11,-21,29,17,12,30,-10,-17,-29,-6,-9,-4,3,6,\
   26,9,-12,-4,12,4,-13,-26,-1,19,-10,28,-24,21,-32,-20,9,31,-24,15,4,23,-4,1,30,30,-10,14,13,2,\
   -15,-8,2,-7,26,23,-8,-23,-14,-4,1,-26,5,10,-7,-16,23,28,-8,8,26,-2,31,20,28,-14,18,-14,-12,31,\
   -22,-31,-12,-27,18,22,-26,-24,-12,-12,-3,-24,6,-17,-1,1,11,13,-1,-4,-21,-6,26,17,-10,24,-21,9,\
   28,-16,-5,-20,-21,-19,-24,20,-11,12,-13,27,28,17,26,4,10,28,-10,-3,-28,-26,18,28,15,-2,3,-7,\
   -17,-8,31,27,-4,7,-28,-30,-16,-10,6,4,-6,15,2,-10,-13,30,11,-6,20,9,-17,20,16,-20,31,-23,6,\
   -31,26,-16,-1,-28,-8,29,14,31,-5,15,18,-10,-2,-25,-13,4,29,-9,19,6,-20,9,1,12,27,-16,22,-22,\
   9,2,-8,-16,-7,-29,-12,24,8,6,-16,11,0,-4,-10,-20,5,14,-16,-5,-2,-9,-10,32,-1,-12,31,-12,30,4,\
   4,13,-9,2,-25,31,-26,32,18,31,-7,-23,-28,-30,23,0,21,2,-19,-2,-24,-13,-7,-25,1,-8,4,13,15,20,\
   -17,8,27,-29,-12,-3,27,20,9,0,-9,-15,-31,-15,-13,-17,13,-13,-15,7,30,8,-22,-17,28,11,15,27,\
   -11,3,-5,-30,19,-32,-21,-31,-7,-22,-30,-20,19,-27,-20,6,29,-5,-18,-4,-8,-28,-21,14,-22,-10,\
   17,32,-9,26,21,25,5,-1,7,-25,-27,30,23,18,15,-15,-12,6,20,-2,-9,14,7,-27,-10,27,28,18,21,26,\
   -16,21,18,-9,-26,31,8,-11,-32,-23,-17,20,6,11,19,-10,15,18,-23,-28,-28,-5,1,21,-5,-6,20,-26,\
   -30,4,23,20,-15,9,6,27,30,-25,-1,-13,-15,-18,15,4,-27,-29,-3,-22,-25,-17,-17,-10,18,29,0,\
   -16,10,10,-26,11,-12,21,-1,8,0,31,-1,-17,-8,9,-18,-25,-10,-15,-13,-1,-7,0,-23,17,1,26,2,-28,\
   24,-27,10,-29,20,4,-1,-26,-11,29,-5,9,10,21,-1,30,-19,32,3,-27,26,11,6,21,20,4,-28,29,1,-27,\
   6,21,-25,-16,-26,-8,32,31,-31,-6,-28,-27,-1,-17,0,29,1,13,20,-3,3,1,-27,0,27,-25,21,28,-26,24,\
   -32,-21,23,4,-17,8,-19,-19,-24,14,-13,13,28,8,-11,-5,24,11,11,-15,-14,17,-31,-21,3,28,-31,29,\
   -13,-3,-5,-27,-21,21,-26,-14,16,-10,-1,-12,5,15,-8,8,-21,-15,2,11,-5,11,4,5,17,-29,27,-5,21,10,\
   -11,-13,13,9,14,-14,-14,-28,-4,20,27,5,11,11,0,-30,3,7,21,32,18,21,-30,1,-16,20,-27,-3,-19,9,\
   13,14,28,-12,31,-25,19,-32,-9,-4,19,13,25,19,-31,9,23,13,-4,-26,-14,7,6,0,-12,13,-19,-7,-28,\
   -3,31,-9,-16,-4,-11,-25,-23,18,20,0,21,30,-6,-21,-10,-2,-20,-13,-6,8,-19,-1,-13,-31,27,18,26,\
   -16,-27,21,-32,-1,-30,-26,16,28,23,-27,29,16,-16,-9,-26,-23,30,24,3,4,4,6,-29,13,-5,13,-15,-26,\
   -11,20,-7,-15,32,-23,5,20,21,18,32 into tRay
   put 0 into tSlices
   put 0 into tRunningSum
   put the number of items in tRay into tLoopCount
   repeat tLoopCount times
      put 0 into tRunningSum
      repeat for each item tItem in tRay
         add tItem to tRunningSum
         if tRunningSum >= 32 then add 1 to tSlices
      end repeat
      delete item 1 of tRay
   end repeat
   --put the milliseconds - tMsec into fld "elapsed"
   --put tSlices into fld "answer"
   put tSlices
end mouseUp






More information about the use-livecode mailing list