omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / si / benchmarks / native / neuralese / nl1r / evidence / boundary-oracle-source.om
| 1 | om2 |
| 2 | note NL6 continuation: independent strict parser, never reads producer summaries. |
| 3 | const JCAP ulong 16384 |
| 4 | global JBuf uchar JCAP |
| 5 | global JIo ulong 2 |
| 6 | global JC ulong 8 |
| 7 | global JR ulong 50 |
| 8 | global JP f64 83 |
| 9 | global JH f64 4 |
| 10 | global JU f64 8 |
| 11 | global JS f64 4 |
| 12 | global JB uchar 32 |
| 13 | global Seen ulong 15 |
| 14 | global Logs uchar 7680 |
| 15 | global Sizes ulong 240 |
| 16 | global Stats ulong 360 |
| 17 | text JBAD "NL1RJ INVALID\n" |
| 18 | text JMAG "NL1RJ1,schema,unit,seed,trainmask,group,partition,total,exact,accepted_correct,wrong_accepted,abstained,feature_errors,collision_pairs,encode_ns,decode_ns\n" |
| 19 | text JREC "M," |
| 20 | text JSEP "," |
| 21 | text JLF "\n" |
| 22 | text JEND "NL1RJ END\n" |
| 23 | fn jout a view uchar * to void |
| 24 | p = ulong 0 |
| 25 | while lt p len a |
| 26 | n = write 1 a p sub len a p |
| 27 | if le n 0 |
| 28 | exit 93 |
| 29 | end |
| 30 | p = add p ulong n |
| 31 | end |
| 32 | end |
| 33 | fn jinvalid to void |
| 34 | n = write 2 JBAD 0 len JBAD |
| 35 | exit 90 |
| 36 | end |
| 37 | fn jnext to long |
| 38 | if eq get JIo 0 get JIo 1 |
| 39 | n = read 0 JBuf 0 JCAP |
| 40 | if lt n 0 |
| 41 | jinvalid |
| 42 | end |
| 43 | if eq n 0 |
| 44 | ret -1 |
| 45 | end |
| 46 | put JIo 0 0 |
| 47 | put JIo 1 ulong n |
| 48 | end |
| 49 | p = get JIo 0 |
| 50 | put JIo 0 add p 1 |
| 51 | ret long get JBuf p |
| 52 | end |
| 53 | fn jexpect c long to void |
| 54 | if ne jnext c |
| 55 | jinvalid |
| 56 | end |
| 57 | end |
| 58 | fn jvalue delim long to ulong |
| 59 | v = ulong 0 |
| 60 | n = ulong 0 |
| 61 | first = long -1 |
| 62 | while true bound 21 |
| 63 | c = jnext |
| 64 | if eq c delim |
| 65 | if eq n 0 |
| 66 | jinvalid |
| 67 | end |
| 68 | if and gt n 1 eq first 48 |
| 69 | jinvalid |
| 70 | end |
| 71 | ret v |
| 72 | end |
| 73 | if or lt c 48 gt c 57 |
| 74 | jinvalid |
| 75 | end |
| 76 | if eq n 0 |
| 77 | first = c |
| 78 | end |
| 79 | if or gt v 1844674407370955161 and eq v 1844674407370955161 gt c 53 |
| 80 | jinvalid |
| 81 | end |
| 82 | v = add mul v 10 ulong sub c 48 |
| 83 | n = add n 1 |
| 84 | end |
| 85 | ret 0 |
| 86 | end |
| 87 | fn jnumber v ulong to void |
| 88 | b = new uchar 20 0 |
| 89 | p = ulong 20 |
| 90 | while true bound 20 |
| 91 | p = sub p 1 |
| 92 | put b p uchar add rem v 10 48 |
| 93 | v = div v 10 |
| 94 | if eq v 0 |
| 95 | break |
| 96 | end |
| 97 | end |
| 98 | while lt p 20 bound 20 |
| 99 | n = write 1 b p sub ulong 20 p |
| 100 | if le n 0 |
| 101 | exit 93 |
| 102 | end |
| 103 | p = add p ulong n |
| 104 | end |
| 105 | end |
| 106 | fn jfield v ulong to void |
| 107 | jnumber v |
| 108 | jout JSEP |
| 109 | end |
| 110 | fn jparity id ulong to ulong |
| 111 | ret and xor xor xor id shr id 1 shr id 2 shr id 3 1 |
| 112 | end |
| 113 | fn jsoft x f64 to f64 |
| 114 | ret div x add 1.0f64 fabs x |
| 115 | end |
| 116 | fn jrelu x f64 to f64 |
| 117 | if gt x 0.0f64 |
| 118 | ret x |
| 119 | end |
| 120 | ret 0.0f64 |
| 121 | end |
| 122 | fn jstore k ulong v ulong to void |
| 123 | for b ulong 8 |
| 124 | put JB add mul k 8 b uchar and shr v mul b 8 255 |
| 125 | end |
| 126 | end |
| 127 | fn jload k ulong to ulong |
| 128 | v = ulong 0 |
| 129 | for b ulong 8 |
| 130 | v = or v shl get JR add 3 add mul k 8 b mul b 8 |
| 131 | end |
| 132 | ret v |
| 133 | end |
| 134 | fn jstat group ulong phase ulong col ulong to ulong |
| 135 | ret add mul add mul group 3 phase 8 col |
| 136 | end |
| 137 | fn jinc group ulong phase ulong col ulong val ulong to void |
| 138 | ix = jstat group phase col |
| 139 | put Stats ix add get Stats ix val |
| 140 | end |
| 141 | note Independent implementation from declared functions and actual transmitted bytes. |
| 142 | note No producer forward/gradient/summary function is linked into this judge. |
| 143 | fn jsender id ulong d ulong to void |
| 144 | for k ulong d |
| 145 | v = get JP add mul 4 d k |
| 146 | for j ulong 4 |
| 147 | v = add v mul f64 and shr id j 1 get JP add mul j d k |
| 148 | end |
| 149 | put JH k jsoft v |
| 150 | end |
| 151 | end |
| 152 | fn jaffine d ulong to void |
| 153 | for j ulong 4 |
| 154 | v = get JP add mul 9 d j |
| 155 | for k ulong d |
| 156 | v = add v mul get JH k get JP add mul 5 d add mul k 4 j |
| 157 | end |
| 158 | put JS j mul 0.5f64 add 1.0f64 jsoft v |
| 159 | end |
| 160 | end |
| 161 | fn jnonlinear to void |
| 162 | for k ulong 8 |
| 163 | v = get JP add 39 k |
| 164 | for j ulong 3 |
| 165 | v = add v mul get JH j get JP add 15 add mul j 8 k |
| 166 | end |
| 167 | put JU k jrelu v |
| 168 | end |
| 169 | for j ulong 4 |
| 170 | v = get JP add 79 j |
| 171 | for k ulong 8 |
| 172 | v = add v mul get JU k get JP add 47 add mul k 4 j |
| 173 | end |
| 174 | put JS j mul 0.5f64 add 1.0f64 jsoft v |
| 175 | end |
| 176 | end |
| 177 | fn jcodec to void |
| 178 | t = mul 3.0f64 get JH 0 |
| 179 | a = jrelu sub t 1.0f64 |
| 180 | b = jrelu sub t 2.0f64 |
| 181 | put JS 0 sub a b |
| 182 | put JS 1 add sub t mul 2.0f64 a mul 2.0f64 b |
| 183 | put JS 2 get JH 1 |
| 184 | put JS 3 get JH 2 |
| 185 | end |
| 186 | fn jcapacitywire to void |
| 187 | arm = get JC 1 |
| 188 | id = get JR 0 |
| 189 | q = get JR 1 |
| 190 | d = get JC 4 |
| 191 | for i ulong 32 |
| 192 | put JB i uchar 0 |
| 193 | end |
| 194 | if eq arm 3 |
| 195 | v = id |
| 196 | if eq q 3 |
| 197 | v = xor v 1 |
| 198 | end |
| 199 | if eq q 4 |
| 200 | v = or and v 12 or shl and v 1 1 shr and v 2 1 |
| 201 | end |
| 202 | if eq q 5 |
| 203 | v = 0 |
| 204 | end |
| 205 | put JB 0 uchar v |
| 206 | ret |
| 207 | end |
| 208 | if eq get JC 7 2 |
| 209 | put JH 0 div f64 add mul and id 1 2 and shr id 1 1 3.0f64 |
| 210 | put JH 1 f64 and shr id 2 1 |
| 211 | put JH 2 f64 and shr id 3 1 |
| 212 | else |
| 213 | jsender id d |
| 214 | end |
| 215 | for k ulong d |
| 216 | v = get JH k |
| 217 | if or eq q 1 eq q 2 |
| 218 | f = 16.0f64 |
| 219 | if eq q 2 |
| 220 | f = 32.0f64 |
| 221 | end |
| 222 | v = div f64 long add mul fabs v f 0.5f64 f |
| 223 | if lt get JH k 0.0f64 |
| 224 | v = neg v |
| 225 | end |
| 226 | end |
| 227 | if and eq q 3 eq k 0 |
| 228 | v = neg v |
| 229 | end |
| 230 | if eq q 5 |
| 231 | v = 0.0f64 |
| 232 | end |
| 233 | put JH k v |
| 234 | end |
| 235 | if eq q 4 |
| 236 | v = get JH 0 |
| 237 | put JH 0 get JH 1 |
| 238 | put JH 1 v |
| 239 | end |
| 240 | for k ulong d |
| 241 | jstore k bitcast ulong get JH k |
| 242 | end |
| 243 | end |
| 244 | fn jcapacitydecode to void |
| 245 | if eq get JC 1 3 |
| 246 | for j ulong 4 |
| 247 | put JS j f64 and shr get JR 3 j 1 |
| 248 | end |
| 249 | ret |
| 250 | end |
| 251 | for k ulong get JC 4 |
| 252 | v = bitcast f64 jload k |
| 253 | if not le fabs v 1.0f64 |
| 254 | jinvalid |
| 255 | end |
| 256 | put JH k v |
| 257 | end |
| 258 | if eq get JC 7 2 |
| 259 | jcodec |
| 260 | else |
| 261 | if eq get JC 1 2 |
| 262 | jnonlinear |
| 263 | else |
| 264 | jaffine get JC 4 |
| 265 | end |
| 266 | end |
| 267 | end |
| 268 | fn jtaskwire to void |
| 269 | id = get JR 0 |
| 270 | arm = get JR 49 |
| 271 | variant = get JR 1 |
| 272 | for i ulong 32 |
| 273 | put JB i uchar 0 |
| 274 | end |
| 275 | if or eq variant 2 eq arm 3 |
| 276 | ret |
| 277 | end |
| 278 | if eq variant 1 |
| 279 | id = rem add id 1 16 |
| 280 | end |
| 281 | if eq arm 0 |
| 282 | v = id |
| 283 | if eq get JC 1 1 |
| 284 | v = jparity id |
| 285 | end |
| 286 | if eq get JC 1 2 |
| 287 | v = shr id 2 |
| 288 | end |
| 289 | put JB 0 uchar v |
| 290 | ret |
| 291 | end |
| 292 | if eq arm 4 |
| 293 | for j ulong 4 |
| 294 | put JB j uchar add and shr id j 1 48 |
| 295 | end |
| 296 | ret |
| 297 | end |
| 298 | jsender id 4 |
| 299 | v = ulong 0 |
| 300 | for j ulong 4 |
| 301 | if eq arm 1 |
| 302 | code = ulong long add mul add get JH j 1.0f64 1.5f64 0.5f64 |
| 303 | if gt code 3 |
| 304 | code = 3 |
| 305 | end |
| 306 | v = or v shl code mul j 2 |
| 307 | else |
| 308 | if ge get JH j 0.0f64 |
| 309 | v = or v shl 1 j |
| 310 | end |
| 311 | end |
| 312 | end |
| 313 | put JB 0 uchar v |
| 314 | end |
| 315 | fn jtaskdecode to void |
| 316 | arm = get JR 49 |
| 317 | task = get JC 1 |
| 318 | for j ulong 4 |
| 319 | put JS j 0.0f64 |
| 320 | end |
| 321 | if eq get JR 1 2 |
| 322 | ret |
| 323 | end |
| 324 | if or eq arm 0 eq arm 4 |
| 325 | id = get JR 3 |
| 326 | if eq arm 4 |
| 327 | id = 0 |
| 328 | for j ulong 4 |
| 329 | v = get JR add 3 j |
| 330 | if and ne v 48 ne v 49 |
| 331 | jinvalid |
| 332 | end |
| 333 | id = or id shl sub v 48 j |
| 334 | end |
| 335 | end |
| 336 | if eq arm 4 |
| 337 | if eq task 1 |
| 338 | id = jparity id |
| 339 | end |
| 340 | if eq task 2 |
| 341 | id = shr id 2 |
| 342 | end |
| 343 | end |
| 344 | if eq task 2 |
| 345 | id = or shl id 2 get JR 47 |
| 346 | end |
| 347 | for j ulong 4 |
| 348 | put JS j f64 and shr id j 1 |
| 349 | end |
| 350 | ret |
| 351 | end |
| 352 | v = get JR 3 |
| 353 | for j ulong 4 |
| 354 | h = 0.0f64 |
| 355 | if eq arm 1 |
| 356 | code = and shr v mul j 2 3 |
| 357 | h = div sub mul f64 code 2.0f64 3.0f64 3.0f64 |
| 358 | end |
| 359 | if eq arm 2 |
| 360 | h = sub mul f64 and shr v j 1 2.0f64 1.0f64 |
| 361 | end |
| 362 | put JH j h |
| 363 | end |
| 364 | jaffine 4 |
| 365 | if eq task 1 |
| 366 | for j ulong 3 |
| 367 | put JS add j 1 0.0f64 |
| 368 | end |
| 369 | end |
| 370 | if eq task 2 |
| 371 | for j ulong 2 |
| 372 | put JS j f64 and shr get JR 47 j 1 |
| 373 | end |
| 374 | end |
| 375 | end |
| 376 | note Native judge validates full input before publishing any metrics. |
| 377 | fn jheader to void |
| 378 | jexpect 67 |
| 379 | jexpect 44 |
| 380 | for i ulong 8 |
| 381 | delim = long 44 |
| 382 | if eq i 7 |
| 383 | delim = 10 |
| 384 | end |
| 385 | put JC i jvalue delim |
| 386 | end |
| 387 | schema = get JC 0 |
| 388 | unit = get JC 1 |
| 389 | if and ne schema 1 ne schema 2 |
| 390 | jinvalid |
| 391 | end |
| 392 | if or eq get JC 2 0 gt get JC 2 4294967295 |
| 393 | jinvalid |
| 394 | end |
| 395 | if or eq get JC 3 0 gt get JC 3 65535 |
| 396 | jinvalid |
| 397 | end |
| 398 | d = ulong 4 |
| 399 | n = ulong 40 |
| 400 | if eq schema 1 |
| 401 | if gt unit 3 |
| 402 | jinvalid |
| 403 | end |
| 404 | if eq unit 0 |
| 405 | d = 3 |
| 406 | n = 31 |
| 407 | end |
| 408 | if eq unit 2 |
| 409 | d = 3 |
| 410 | n = 83 |
| 411 | end |
| 412 | if eq unit 3 |
| 413 | d = 1 |
| 414 | n = 0 |
| 415 | end |
| 416 | else |
| 417 | if or gt unit 2 ne get JC 7 0 |
| 418 | jinvalid |
| 419 | end |
| 420 | end |
| 421 | if or ne get JC 4 d ne get JC 5 n |
| 422 | jinvalid |
| 423 | end |
| 424 | mode = get JC 7 |
| 425 | if or gt mode 5 eq mode 4 |
| 426 | jinvalid |
| 427 | end |
| 428 | if and eq mode 1 ne unit 1 |
| 429 | jinvalid |
| 430 | end |
| 431 | if and or eq mode 2 eq mode 3 ne unit 2 |
| 432 | jinvalid |
| 433 | end |
| 434 | count = ulong 0 |
| 435 | for id ulong 16 |
| 436 | count = add count and shr get JC 3 id 1 |
| 437 | end |
| 438 | updates = mul count 2000 |
| 439 | if or ne mode 0 and eq schema 1 eq unit 3 |
| 440 | updates = 0 |
| 441 | end |
| 442 | if eq mode 5 |
| 443 | if gt get JC 6 32000 |
| 444 | jinvalid |
| 445 | end |
| 446 | else |
| 447 | if ne get JC 6 updates |
| 448 | jinvalid |
| 449 | end |
| 450 | end |
| 451 | for i ulong n |
| 452 | jexpect 80 |
| 453 | jexpect 44 |
| 454 | if ne jvalue 44 i |
| 455 | jinvalid |
| 456 | end |
| 457 | v = bitcast f64 jvalue 10 |
| 458 | if not le fabs v 1000000.0f64 |
| 459 | jinvalid |
| 460 | end |
| 461 | put JP i v |
| 462 | end |
| 463 | end |
| 464 | fn jparse_row to ulong |
| 465 | jexpect 82 |
| 466 | jexpect 44 |
| 467 | put JR 0 jvalue 44 |
| 468 | if eq get JC 0 2 |
| 469 | put JR 49 jvalue 44 |
| 470 | end |
| 471 | for i ulong 46 |
| 472 | ix = add i 1 |
| 473 | delim = long 44 |
| 474 | if and eq ix 46 eq get JC 0 1 |
| 475 | delim = 10 |
| 476 | end |
| 477 | put JR ix jvalue delim |
| 478 | end |
| 479 | if eq get JC 0 2 |
| 480 | put JR 47 jvalue 44 |
| 481 | put JR 48 jvalue 10 |
| 482 | end |
| 483 | id = get JR 0 |
| 484 | if gt id 15 |
| 485 | jinvalid |
| 486 | end |
| 487 | group = get JR 1 |
| 488 | if eq get JC 0 1 |
| 489 | if gt group 5 |
| 490 | jinvalid |
| 491 | end |
| 492 | else |
| 493 | if or gt group 2 gt get JR 49 4 |
| 494 | jinvalid |
| 495 | end |
| 496 | group = add mul get JR 49 3 group |
| 497 | context = ulong 0 |
| 498 | if eq get JC 1 2 |
| 499 | context = and id 3 |
| 500 | end |
| 501 | if or ne get JR 47 context ne get JR 48 0 |
| 502 | jinvalid |
| 503 | end |
| 504 | end |
| 505 | bit = shl ulong 1 id |
| 506 | if ne and get Seen group bit 0 |
| 507 | jinvalid |
| 508 | end |
| 509 | put Seen group or get Seen group bit |
| 510 | for i ulong 32 |
| 511 | if gt get JR add i 3 255 |
| 512 | jinvalid |
| 513 | end |
| 514 | end |
| 515 | ret group |
| 516 | end |
| 517 | fn jwirecheck to void |
| 518 | n = mul get JC 4 8 |
| 519 | if eq get JC 0 1 |
| 520 | if eq get JC 1 3 |
| 521 | n = 1 |
| 522 | end |
| 523 | jcapacitywire |
| 524 | else |
| 525 | n = 1 |
| 526 | if eq get JR 49 4 |
| 527 | n = 4 |
| 528 | end |
| 529 | if or eq get JR 1 2 eq get JR 49 3 |
| 530 | n = 0 |
| 531 | end |
| 532 | jtaskwire |
| 533 | end |
| 534 | if ne get JR 2 n |
| 535 | jinvalid |
| 536 | end |
| 537 | for b ulong 32 |
| 538 | if ne get JR add b 3 ulong get JB b |
| 539 | jinvalid |
| 540 | end |
| 541 | end |
| 542 | end |
| 543 | fn jactive j ulong to bool |
| 544 | if eq get JC 0 1 |
| 545 | ret true |
| 546 | end |
| 547 | if eq get JC 1 1 |
| 548 | ret eq j 0 |
| 549 | end |
| 550 | if eq get JC 1 2 |
| 551 | ret ge j 2 |
| 552 | end |
| 553 | ret true |
| 554 | end |
| 555 | fn jtarget to ulong |
| 556 | id = get JR 0 |
| 557 | if and eq get JC 0 2 eq get JC 1 1 |
| 558 | ret jparity id |
| 559 | end |
| 560 | ret id |
| 561 | end |
| 562 | fn jgrade group ulong to void |
| 563 | status = ulong 0 |
| 564 | if and eq get JC 0 2 eq get JR 1 2 |
| 565 | status = 2 |
| 566 | end |
| 567 | if ne get JR 46 status |
| 568 | jinvalid |
| 569 | end |
| 570 | if eq get JC 0 1 |
| 571 | jcapacitydecode |
| 572 | else |
| 573 | jtaskdecode |
| 574 | end |
| 575 | exact = ulong 1 |
| 576 | abst = ulong 0 |
| 577 | errors = ulong 0 |
| 578 | if ne status 0 |
| 579 | abst = 1 |
| 580 | exact = 0 |
| 581 | end |
| 582 | for j ulong 4 |
| 583 | score = bitcast f64 get JR add j 35 |
| 584 | if not le fabs sub score get JS j 0.000000000001f64 |
| 585 | jinvalid |
| 586 | end |
| 587 | pred = ulong 0 |
| 588 | if and eq status 0 ge get JS j 0.5f64 |
| 589 | pred = 1 |
| 590 | end |
| 591 | if ne get JR add j 39 pred |
| 592 | jinvalid |
| 593 | end |
| 594 | if jactive j |
| 595 | if eq status 0 |
| 596 | if lt fabs sub get JS j 0.5f64 0.1f64 |
| 597 | abst = 1 |
| 598 | end |
| 599 | end |
| 600 | if ne pred and shr jtarget j 1 |
| 601 | exact = 0 |
| 602 | errors = add errors 1 |
| 603 | end |
| 604 | end |
| 605 | end |
| 606 | if ne get JR 43 abst |
| 607 | jinvalid |
| 608 | end |
| 609 | for phase ulong 3 |
| 610 | belongs = true |
| 611 | train = ne and shr get JC 3 get JR 0 1 0 |
| 612 | if eq phase 1 |
| 613 | belongs = train |
| 614 | end |
| 615 | if eq phase 2 |
| 616 | belongs = not train |
| 617 | end |
| 618 | if belongs |
| 619 | jinc group phase 0 1 |
| 620 | jinc group phase 1 exact |
| 621 | if eq abst 0 |
| 622 | if eq exact 1 |
| 623 | jinc group phase 2 1 |
| 624 | else |
| 625 | jinc group phase 3 1 |
| 626 | end |
| 627 | end |
| 628 | jinc group phase 4 abst |
| 629 | jinc group phase 5 errors |
| 630 | jinc group phase 6 get JR 44 |
| 631 | jinc group phase 7 get JR 45 |
| 632 | end |
| 633 | end |
| 634 | row = add mul group 16 get JR 0 |
| 635 | put Sizes row get JR 2 |
| 636 | for b ulong 32 |
| 637 | put Logs add mul row 32 b uchar get JR add b 3 |
| 638 | end |
| 639 | end |
| 640 | fn jmember id ulong phase ulong to bool |
| 641 | if eq phase 0 |
| 642 | ret true |
| 643 | end |
| 644 | train = ne and shr get JC 3 id 1 0 |
| 645 | if eq phase 1 |
| 646 | ret train |
| 647 | end |
| 648 | ret not train |
| 649 | end |
| 650 | fn jpayseq ai ulong bi ulong to bool |
| 651 | if ne get Sizes ai get Sizes bi |
| 652 | ret false |
| 653 | end |
| 654 | for k ulong 32 |
| 655 | if ne get Logs add mul ai 32 k get Logs add mul bi 32 k |
| 656 | ret false |
| 657 | end |
| 658 | end |
| 659 | ret true |
| 660 | end |
| 661 | fn jcollisions group ulong phase ulong to ulong |
| 662 | n = ulong 0 |
| 663 | for a ulong 16 |
| 664 | for b ulong 16 |
| 665 | if and lt a b and jmember a phase jmember b phase |
| 666 | ai = add mul group 16 a |
| 667 | bi = add mul group 16 b |
| 668 | if jpayseq ai bi |
| 669 | n = add n 1 |
| 670 | end |
| 671 | end |
| 672 | end |
| 673 | end |
| 674 | ret n |
| 675 | end |
| 676 | fn jreport groups ulong to void |
| 677 | jout JMAG |
| 678 | for group ulong groups |
| 679 | for phase ulong 3 |
| 680 | jout JREC |
| 681 | for i ulong 4 |
| 682 | jfield get JC i |
| 683 | end |
| 684 | jfield group |
| 685 | jfield phase |
| 686 | for i ulong 6 |
| 687 | jfield get Stats jstat group phase i |
| 688 | end |
| 689 | jfield jcollisions group phase |
| 690 | jfield get Stats jstat group phase 6 |
| 691 | jnumber get Stats jstat group phase 7 |
| 692 | jout JLF |
| 693 | end |
| 694 | end |
| 695 | jout JEND |
| 696 | end |
| 697 | note Compose after io.om, arithmetic.om and judge.om through jreport (not main). |
| 698 | note This post-reveal transport oracle cannot change frozen scientific metrics. |
| 699 | note No output is released before all 240 producer rows and EOF validate. |
| 700 | global BCases ulong 2400 |
| 701 | global BCount ulong 1 |
| 702 | text BRec "B," |
| 703 | text BOut "O,NL4R1 0 3 " |
| 704 | text BTail " 0 1 1 0 1 0 " |
| 705 | text BErr "E,NL4R1 " |
| 706 | text BZeros " 0 0 0 0 0 0 0 0 0\n" |
| 707 | text BDone "D\n" |
| 708 | fn bjput row ulong col ulong v ulong to void |
| 709 | put BCases add mul row 10 col v |
| 710 | end |
| 711 | fn bjget row ulong col ulong to ulong |
| 712 | ret get BCases add mul row 10 col |
| 713 | end |
| 714 | fn bjkeep row ulong to void |
| 715 | bjput row 0 get JR 0 |
| 716 | bjput row 1 get JR 49 |
| 717 | bjput row 2 get JR 1 |
| 718 | bjput row 3 get JC 1 |
| 719 | pred = ulong 0 |
| 720 | abst = ulong 0 |
| 721 | if eq get JR 1 2 |
| 722 | abst = 1 |
| 723 | else |
| 724 | for j ulong 4 |
| 725 | if ge get JS j 0.5f64 |
| 726 | pred = or pred shl 1 j |
| 727 | end |
| 728 | if and jactive j lt fabs sub get JS j 0.5f64 0.1f64 |
| 729 | abst = 1 |
| 730 | end |
| 731 | end |
| 732 | end |
| 733 | bjput row 4 pred |
| 734 | bjput row 5 jtarget |
| 735 | bjput row 6 abst |
| 736 | bjput row 7 0 |
| 737 | end |
| 738 | fn bjctrl pred ulong target ulong task ulong abst ulong kind ulong to void |
| 739 | row = get BCount 0 |
| 740 | bjput row 0 row |
| 741 | bjput row 3 task |
| 742 | bjput row 4 pred |
| 743 | bjput row 5 target |
| 744 | bjput row 6 abst |
| 745 | bjput row 7 kind |
| 746 | put BCount 0 add row 1 |
| 747 | end |
| 748 | fn bjexpect row ulong to void |
| 749 | pred = bjget row 4 |
| 750 | target = bjget row 5 |
| 751 | task = bjget row 3 |
| 752 | abst = bjget row 6 |
| 753 | kind = bjget row 7 |
| 754 | rc = ulong 0 |
| 755 | frames = ulong 0 |
| 756 | if or gt task 2 or gt pred 15 gt target 15 |
| 757 | rc = 80 |
| 758 | end |
| 759 | if and eq task 1 or gt pred 1 gt target 1 |
| 760 | rc = 80 |
| 761 | end |
| 762 | if or eq kind 4 eq kind 5 |
| 763 | rc = 80 |
| 764 | end |
| 765 | if eq rc 0 |
| 766 | if eq abst 1 |
| 767 | rc = 2 |
| 768 | else |
| 769 | if eq kind 3 |
| 770 | rc = 80 |
| 771 | else |
| 772 | frames = 1 |
| 773 | if eq kind 1 |
| 774 | rc = 11 |
| 775 | else |
| 776 | if eq kind 2 |
| 777 | rc = 18 |
| 778 | else |
| 779 | if ne and pred 3 and target 3 |
| 780 | rc = 49 |
| 781 | else |
| 782 | if ne task 1 |
| 783 | frames = 2 |
| 784 | if ne and shr pred 2 3 and shr target 2 3 |
| 785 | rc = 49 |
| 786 | end |
| 787 | end |
| 788 | end |
| 789 | end |
| 790 | end |
| 791 | end |
| 792 | end |
| 793 | end |
| 794 | bjput row 8 rc |
| 795 | bjput row 9 frames |
| 796 | end |
| 797 | fn bjprint row ulong to void |
| 798 | bjexpect row |
| 799 | jout BRec |
| 800 | for i ulong 10 |
| 801 | if eq i 9 |
| 802 | jnumber bjget row i |
| 803 | else |
| 804 | jfield bjget row i |
| 805 | end |
| 806 | end |
| 807 | jout JLF |
| 808 | rc = bjget row 8 |
| 809 | if eq rc 0 |
| 810 | chunks = ulong 2 |
| 811 | if eq bjget row 3 1 |
| 812 | chunks = 1 |
| 813 | end |
| 814 | for c ulong chunks |
| 815 | v = and shr bjget row 4 mul c 2 3 |
| 816 | jout BOut |
| 817 | jnumber v |
| 818 | jout BTail |
| 819 | jnumber v |
| 820 | jout JLF |
| 821 | end |
| 822 | else |
| 823 | jout BErr |
| 824 | jnumber rc |
| 825 | jout BZeros |
| 826 | end |
| 827 | jout BDone |
| 828 | end |
| 829 | fn bjtests to void |
| 830 | bjctrl 6 6 2 0 0 |
| 831 | bjctrl 9 9 2 0 0 |
| 832 | bjctrl 0 0 2 0 0 |
| 833 | bjctrl 15 15 2 0 0 |
| 834 | bjctrl 1 1 1 0 0 |
| 835 | bjctrl 0 0 1 0 0 |
| 836 | bjctrl 6 2 2 0 0 |
| 837 | bjctrl 6 4 2 0 0 |
| 838 | bjctrl 1 0 1 0 0 |
| 839 | bjctrl 2 2 1 0 0 |
| 840 | bjctrl 1 1 3 0 0 |
| 841 | bjctrl 16 1 2 0 0 |
| 842 | bjctrl 6 6 2 1 0 |
| 843 | bjctrl 6 6 2 0 4 |
| 844 | bjctrl 6 6 2 0 3 |
| 845 | bjctrl 6 6 2 0 5 |
| 846 | bjctrl 6 6 2 0 1 |
| 847 | bjctrl 6 6 2 0 2 |
| 848 | for i ulong get BCount 0 |
| 849 | bjprint i |
| 850 | end |
| 851 | jout JEND |
| 852 | end |
| 853 | fn main to int |
| 854 | note An extra argument selects fixed argument/envelope/abstention control cases. |
| 855 | if eq argcnt 2 |
| 856 | bjtests |
| 857 | ret 0 |
| 858 | end |
| 859 | if ne argcnt 1 |
| 860 | jinvalid |
| 861 | end |
| 862 | jheader |
| 863 | if ne get JC 0 2 |
| 864 | jinvalid |
| 865 | end |
| 866 | for i ulong 240 |
| 867 | group = jparse_row |
| 868 | jwirecheck |
| 869 | jgrade group |
| 870 | bjkeep i |
| 871 | end |
| 872 | for group ulong 15 |
| 873 | if ne get Seen group 65535 |
| 874 | jinvalid |
| 875 | end |
| 876 | end |
| 877 | jexpect 84 |
| 878 | jexpect 44 |
| 879 | start = jvalue 44 |
| 880 | finish = jvalue 10 |
| 881 | if or eq start 0 lt finish start |
| 882 | jinvalid |
| 883 | end |
| 884 | jexpect 69 |
| 885 | jexpect 78 |
| 886 | jexpect 68 |
| 887 | jexpect 10 |
| 888 | if ne jnext -1 |
| 889 | jinvalid |
| 890 | end |
| 891 | for i ulong 240 |
| 892 | bjprint i |
| 893 | end |
| 894 | jout JEND |
| 895 | ret 0 |
| 896 | end |