Mercurial > repos > icfp2013
changeset 41:4750da71cae6
parsing myproblems.json, needs fix
author | William Morgan <bill@mrgn.org> |
---|---|
date | Sun, 11 Aug 2013 02:16:55 -0700 |
parents | c42d3c8b1d75 |
children | a8db0f4039aa |
files | src/requests.tp |
diffstat | 1 files changed, 25 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/requests.tp Sat Aug 10 23:30:12 2013 -0700 +++ b/src/requests.tp Sun Aug 11 02:16:55 2013 -0700 @@ -178,8 +178,7 @@ } } - problem <- :bod { - decoded <- json decode: bod + _problem <- :decoded { #{ id <- decoded get: "id" withDefault: -1 size <- decoded get: "size" withDefault: -1 @@ -201,7 +200,20 @@ } } + problem <- :bod { + decoded <- json decode: bod + _problem: decoded + } + + problems <- :bod { + decoded <- json decode: bod + decoded map: :idx el{ + _problem: el + } + } + main <- :args { + print: "Program Start." testId0 <- "wdThP1AgVrS2rp7q6qt9mLqp" // TRAINING PROGRAM ID! not real one. response in data folder. testId1 <- "QwhG7ZpaVsfXiLRvbJfIfxl8" // TRAINING PROGRAM ID! not real one. response in data folder. someProblem <- "{\"id\":\"QwhG7ZpaVsfXiLRvbJfIfxl8\",\"size\":15,\"operators\":[\"and\",\"if0\",\"shl1\",\"shr16\",\"tfold\"]}" @@ -209,15 +221,23 @@ //print: ((evalId: "someId" #[1u64 2u64 3u64]) string) . "\n" //print: ((guess: "someId" "someProg") string) . "\n" - print: ((problem: someProblem) string) . "\n" + //print: ((problem: someProblem) string) . "\n" + + file <- os open: "/home/wbm25/Desktop/icfp2013/data/myproblems.json" (os O_RDONLY) + fstr <- (os read: file 400 * 1024) // file was 276k before bonus problems... + os close: file + + print: (((problems: fstr) get: 0) string ) + + if: (args length) > 1 { key <- args get: 1 //print: ((evalProgram: "(lambda (input) (shl1 input))" #[1u64 0xEFFFFFFFFFFFFFu64]) sendWithKey: key) //print: ((evalId: testId0 #[1u64 0xEFFFFFFFFFFFFFu64]) sendWithKey: key) - print: ((guess: testId0 someProgram) sendWithKey: key) - + //print: ((guess: testId0 someProgram) sendWithKey: key) + println: "derp" } } }