-- expects two snippet IDs (solution, test case) as input -- example: "#121 #122" if input == nil then error("Needs input.") end solutionID, testCaseID = input:match("([^ ]+) +([^ ]+)") if not solutionID then error("Could not parse input, expected two snippet IDs") end solutionF = loadSnippet(solutionID) assert(solutionF, 'Solution does not parse: '..solutionID) pcall(solutionF) if solution == nil then solution = function(_input) input = _input -- yeah the whole env thing is hacky right here return solutionF() end end verifierF = loadSnippet(testCaseID) assert(verifierF, 'Test case does not parse: '..testCaseID) if verifierF() then print "Verified!" solution = nil -- to not apply RunCmd/DebugCmd's "find solution function" magic... return true else error("Not verified.") 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
| ID | Author/Program | Comment | Date | |
|---|---|---|---|---|
| 1010 | #1000604 (pitcher) | 2015-08-20 15:28:24 | ||
| 1009 | #1000610 | Edit suggestion: !636 !629 main { static Object androidContext; static String programID; public static void main(String[] args) throws Exception { -- expects two snippet IDs (solution, test case) as input -- example: "#121 #122" if input == nil then error("Needs input.") end solutionID, testCaseID = input:match("([^ ]+) +([^ ]+)") if not solutionID then error("Could not parse input, expected two snippet IDs") end solutionF = loadSnippet(solutionID) assert(solutionF, 'Solution does not parse: '..solutionID) pcall(solutionF) if solution == nil then solution = function(_input) input = _input -- yeah the whole env thing is hacky right here return solutionF() end end verifierF = loadSnippet(testCaseID) assert(verifierF, 'Test case does not parse: '..testCaseID) if verifierF() then print "Verified!" solution = nil -- to not apply RunCmd/DebugCmd's "find solution function" magic... return true else error("Not verified.") end }} | 2015-08-20 14:46:43 | delete |
| Recognizer | Recognition Result | Visualize | Recalc |
|---|---|---|---|
| #308 | 833 | [visualize] |
| Snippet ID: | #123 |
| Snippet name: | Pitcher core |
| Eternal ID of this version: | #123/1 |
| Text MD5: | 39f2e40d59c77373172a22a1afc52849 |
| Author: | stefan |
| Category: | |
| Type: | Lua code |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2014-01-10 19:41:01 |
| Source code size: | 833 bytes / 28 lines |
| Pitched / IR pitched: | Yes / Yes |
| Views / Downloads: | 2178 / 5025 |
| Referenced in: | [show references] |