comparison src/requests.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 e9e01cd64993
children 8409af16d6e5
comparison
equal deleted inserted replaced
47:c55d4271bb77 48:855c05c9cae1
182 _id <- decoded get: "id" withDefault: -1 182 _id <- decoded get: "id" withDefault: -1
183 _size <- decoded get: "size" withDefault: -1 183 _size <- decoded get: "size" withDefault: -1
184 _ops <- decoded get: "operators" withDefault: #[] 184 _ops <- decoded get: "operators" withDefault: #[]
185 _timeLeft <- decoded get: "timeLeft" withDefault: 301 185 _timeLeft <- decoded get: "timeLeft" withDefault: 301
186 _challenge <- decoded get: "challenge" withDefault: "" 186 _challenge <- decoded get: "challenge" withDefault: ""
187 _solved <- decoded get: "solved" withDefault: false
187 #{ 188 #{
188 id <- { _id } 189 id <- { _id }
189 size <- { _size } 190 size <- { _size }
190 operators <- { _ops } 191 operators <- { _ops }
191 //solved <- decoded get: "solved" withDefault: false // todo: B ool up ean this son of a j 192 solved <- { _solved }
192 timeLeft <- { _timeLeft } 193 timeLeft <- { _timeLeft }
193 // training problems have a challenge, real ones do not.: 194 // training problems have a challenge, real ones do not.:
194 challenge <- { _challenge } 195 challenge <- { _challenge }
195 string <- { 196 string <- {
196 str <- "problem '" . id . "' has size '" . size . "' and operators:" 197 str <- "problem '" . id . "' has size '" . size . "' and operators:"
197 foreach: operators :idx val { 198 foreach: operators :idx val {
198 str <- str . "\n " . (string: idx) . ": " . val 199 str <- str . "\n " . (string: idx) . ": " . val
199 } 200 }
201 str <- str . "\nsolved?: " . (if: solved { "true" } else: { "false" })
200 str . "\ntimeLeft: " . timeLeft 202 str . "\ntimeLeft: " . timeLeft
201 } 203 }
202 print <- { 204 print <- {
203 print: string . "\n" 205 print: string . "\n"
204 } 206 }
211 } 213 }
212 214
213 problems <- :bod { 215 problems <- :bod {
214 decoded <- json decode: bod 216 decoded <- json decode: bod
215 decoded map: :el{ 217 decoded map: :el{
216 _problem: el 218 p <- _problem: el
219 //print: p
220 p
217 } 221 }
218 } 222 }
219 223
220 main <- :args { 224 main <- :args {
221 print: "Program Start." 225 print: "Program Start."