changeset 45:b90ccee0bace

Merge
author Mike Pavone <pavone@retrodev.com>
date Sun, 11 Aug 2013 02:18:55 -0700
parents e795f7179456 (current diff) a8db0f4039aa (diff)
children e9e01cd64993
files
diffstat 1 files changed, 25 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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"
 		}
 	}
 }