changeset 31:8a2925ab0d4a

working guess request and response.
author William Morgan <bill@mrgn.org>
date Sat, 10 Aug 2013 21:23:33 -0700
parents a4bffcd381cd
children 732d9739356e
files src/requests.tp
diffstat 1 files changed, 17 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/requests.tp	Sat Aug 10 20:30:05 2013 -0700
+++ b/src/requests.tp	Sat Aug 10 21:23:33 2013 -0700
@@ -62,13 +62,19 @@
 		}
 	}
 
-	guessRequest <- :id :prog {
+	guess <- :id :prog {
 		#{
 			string <- {
 				idStr <- "\"id\":\"" . id . "\""
 				progStr <- "\"program\":\"" . prog . "\""
 				"{" . idStr . "," . progStr . "}"
 			}
+			sendWithKey <- :key {
+				print: "Sending: " . string . "\n"
+				cli <- http client: "icfpc2013.cloudapp.net"
+				resp <- cli post: string toPath: "/guess?auth=" . key withType: "application/json"
+				guessResponse: resp
+			}
 		}
 	}
 
@@ -173,13 +179,20 @@
 	}
 
 	main <- :args {
-		print: ((evalId: "someId" #[1u64 2u64 3u64]) string) . "\n"
-		print: ((guessRequest: "someId" "someProg") string) . "\n"
+		//print: ((evalId: "someId" #[1u64 2u64 3u64]) string) . "\n"
+		//print: ((guess: "someId" "someProg") string) . "\n"
 
 		if: (args length) > 1 {
 			key <- args get: 1
+			testId <- "wdThP1AgVrS2rp7q6qt9mLqp" // my first training problem
+			someId <- "QwhG7ZpaVsfXiLRvbJfIfxl8" // TRAINING PROGRAM IDs!!!  not real ones.
+
+			someProgram <- "(lambda (input) (shl1 input))"
+
 			//print: ((evalProgram: "(lambda (input) (shl1 input))" #[1u64 0xEFFFFFFFFFFFFFu64]) sendWithKey: key)
-			print: ((evalId: "QwhG7ZpaVsfXiLRvbJfIfxl8" #[1u64 0xEFFFFFFFFFFFFFu64]) sendWithKey: key)
+			//print: ((evalId: testId #[1u64 0xEFFFFFFFFFFFFFu64]) sendWithKey: key)
+			print: ((guess: testId someProgram) sendWithKey: key)
+		
 		}
 	}
 }