# HG changeset patch # User Mike Pavone # Date 1376212735 25200 # Node ID b90ccee0baceded95d2eca841b9bd1f17eb3aea9 # Parent e795f7179456e99ddd7adbbec168f0caecf09b4d# Parent a8db0f4039aa8e7916d19a33bb6bd90f47a3e2cb Merge diff -r e795f7179456 -r b90ccee0bace src/requests.tp --- a/src/requests.tp Sun Aug 11 02:16:44 2013 -0700 +++ b/src/requests.tp Sun Aug 11 02:18: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" } } }