-- a, b is our "buffer" for last 2 chars pairs = {} function p(m, s) if s ~= nil then -- fill buffer for i = 1, s:len() do a = b b = s:sub(i) if a ~= nil then pairs[a] = b end end end return pairs[b] end
m = max chars to return s = fed "real" input
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
1 comment(s) hidden. show
Snippet ID: | #1004708 |
Snippet name: | 2-Grams Predictor [Lua] |
Eternal ID of this version: | #1004708/1 |
Text MD5: | 976a4a3f7326762539f30de71b59d06f |
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 15:52:01 |
Source code size: | 267 bytes / 15 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 948 / 198 |
Referenced in: | [show references] |