comparison src/solver.tp @ 48:855c05c9cae1

Updated myproblems.json. Some solver fixes
author Mike Pavone <pavone@retrodev.com>
date Sun, 11 Aug 2013 04:03:51 -0700
parents e795f7179456
children 8409af16d6e5
comparison
equal deleted inserted replaced
47:c55d4271bb77 48:855c05c9cae1
139 139
140 solve:withAuth:andInfo:andProg <- :progId :authKey :info :prog { 140 solve:withAuth:andInfo:andProg <- :progId :authKey :info :prog {
141 start <- os time 141 start <- os time
142 resp <- (requests evalId: progId (info allInputs)) sendWithKey: authKey 142 resp <- (requests evalId: progId (info allInputs)) sendWithKey: authKey
143 end <- os time 143 end <- os time
144 if: (end - start) < 4 {
145 os sleep: (4 - (end - start))
146 }
144 if: (resp status) = "ok" { 147 if: (resp status) = "ok" {
145 print: "Start: " . (string: start) . ", End: " . (string: start) . "Duration: " . (string: end - start) 148 print: "Start: " . (string: start) . ", End: " . (string: start) . "Duration: " . (string: end - start) . "\n"
146 matches <- info findMatches: (resp outputs) at: 0 149 matches <- info findMatches: (resp outputs) at: 0
147 noSuccess <- true 150 noSuccess <- true
148 cur <- 0 151 cur <- 0
149 if: (matches length) = 0 { 152 if: (matches length) = 0 {
150 print: "No matches? :(\n" 153 print: "No matches? :(\n"
153 while: { noSuccess && cur < (matches length) } do: { 156 while: { noSuccess && cur < (matches length) } do: {
154 prog root!: (matches get: cur) 157 prog root!: (matches get: cur)
155 gstart <- os time 158 gstart <- os time
156 gresp <- (requests guess: progId (string: prog)) sendWithKey: authKey 159 gresp <- (requests guess: progId (string: prog)) sendWithKey: authKey
157 gend <- os time 160 gend <- os time
158 print: "Start: " . (string: gstart) . ", End: " . (string: gend) . "Duration: " . (string: gend - gstart) 161 print: "Start: " . (string: gstart) . ", End: " . (string: gend) . "Duration: " . (string: gend - gstart) . "\n"
162 if: (gend - gstart) < 4 {
163 os sleep: (4 - (gend - gstart))
164 }
159 if: (gresp status) = "win" { 165 if: (gresp status) = "win" {
160 noSuccess <- false 166 noSuccess <- false
161 } else: { 167 } else: {
162 if: (gresp status) = "mismatch" { 168 if: (gresp status) = "mismatch" {
163 failInput <- (gresp values) get: 0 169 failInput <- (gresp values) get: 0