n = 100 function strategy(text) local lines = toLines(text) print("Lines found: " ..tostring(#lines)) if #lines > n then local i1 = math.random(1, #lines-n) local i2 = i1+n print(table.concat(lines, "\n", i1, i2)) end end function toLines(str) local t = {} local function helper(line) table.insert(t, line) return "" end helper((str:gsub("(.-)\r?\n", helper))) return t end
test run test run with input download show line numbers
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1004715 |
Snippet name: | Demo Lua Strategy |
Eternal ID of this version: | #1004715/1 |
Text MD5: | 780cc77cb25970f34a8e8d32dff4c9c1 |
Author: | stefan |
Category: | javax / a.i. |
Type: | Lua code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-08-27 19:20:38 |
Source code size: | 420 bytes / 18 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 797 / 399 |
Referenced in: | [show references] |