interplane.Get Omega
Read in your language

omega-tool-model

First-party Omega tool-use model source, serving harnesses, and verification records

Brought by drakestapleton

branch main Branches Tags History

omega-tool-model / deployment / workbench / server.om

3079 lines · 60672 bytes Raw Blame History
1text z0 "fn calc x int to int\n"
2text z1 "s = x\nfor i ulong "
3text z2 "\ns = "
4text z3 "add"
5text z4 "plus"
6text z5 " s int "
7text z6 "\nend\nret s\nend\n"
8text z7 "ret "
9text z8 "mul"
10text z9 "sub"
11text z10 "times"
12text z11 " x int "
13text z12 "\nend\n"
14text z13 "fn main to int\nret calc int "
15text z14 "Could not read the practice file."
16text z15 "Refused unsupported source."
17text z16 "Could not prepare the test."
18text z17 "The compiler did not complete."
19text z18 "Compilation failed."
20text z19 "The test did not complete."
21text z20 "{\"type\":\"test\",\"input\":"
22text z21 ",\"expected\":"
23text z22 ",\"actual\":"
24text z23 "}"
25text z24 "The browser disconnected."
26text z25 "Test failed: calc("
27text z26 ") expected "
28text z27 ", got "
29text z28 "."
30text z29 "Tests passed."
31text z30 "tool"
32text z31 "path"
33text z32 "old"
34text z33 "new"
35text z34 "replace_text"
36text z35 "Task: Fix the error in this file and confirm its goal.\nFile: "
37text z36 "\nGoal: "
38text z37 "\nState: "
39text z38 "unread"
40text z39 "read"
41text z40 "failed"
42text z41 "edited"
43text z42 "checked"
44text z43 "missing"
45text z44 "Source:\n"
46text z45 "Tool result: "
47text z46 "Answer:\n"
48text z47 "read_file"
49text z48 "File not found."
50text z49 "Read succeeded."
51text z50 "observation"
52text z51 "omega_check"
53text z52 "Edit saved."
54text z53 "source"
55text z54 "original"
56text z55 "The model could not complete this request."
57text z56 "action"
58text z57 "The model completed the job and all four checks passed."
59text z58 "The model claimed success before verification. No success was recorded."
60text z59 "The model correctly reported the missing practice file."
61text z60 "The model incorrectly reported a missing file."
62text z61 "The model returned an unsupported action. The run stopped."
63text z62 "The model requested the wrong file. The run stopped."
64text z63 "The requested action was refused or could not finish."
65text z64 "The model reached the seven-step limit without finishing."
66text z65 "This practice area accepts only the small arithmetic program shapes shown in the examples. Keep the same main input."
67text z66 "jobs/item76666.om"
68text z67 "calc starts with x and adds 4 exactly 3 times in a for loop. main calls calc with 70."
69text z68 "jobs/item96171.om"
70text z69 "calc starts with x and adds 3 exactly 3 times in a for loop. main calls calc with 74."
71text z70 "jobs/item96294.om"
72text z71 "calc returns x plus 5. main calls calc with 73."
73text z72 "jobs/item82028.om"
74text z73 "calc returns x times 1. main calls calc with 72."
75text z74 "jobs/item82342.om"
76text z75 "calc starts with x and adds 1 exactly 6 times in a for loop. main calls calc with 72."
77text z76 "jobs/item85188.om"
78text z77 "calc starts with x and adds 2 exactly 4 times in a for loop. main calls calc with 70."
79text z78 "jobs/item83423.om"
80text z79 "calc starts with x and adds 5 exactly 3 times in a for loop. main calls calc with 71."
81text z80 "jobs/item80896.om"
82text z81 "jobs/item99846.om"
83text z82 "calc returns x plus 1. main calls calc with 70."
84text z83 "jobs/item86548.om"
85text z84 "calc returns x plus 1. main calls calc with 72."
86text z85 "jobs/item73182.om"
87text z86 "calc returns x times 1. main calls calc with 71."
88text z87 "jobs/item87470.om"
89text z88 "calc returns x times 1. main calls calc with 74."
90text z89 "jobs/item74558.om"
91text z90 "calc returns x times 1. main calls calc with 73."
92text z91 "{\"type\":\""
93text z92 "\",\"text\":"
94text z93 "{\"type\":\"done\",\"passed\":"
95text z94 "true"
96text z95 "false"
97text z96 ",\"message\":\""
98text z97 "\",\"source\":"
99note Private local protocol. No model-generated bytes are executed.
100global naddr uchar 110
101global nbuf uchar 8192
102global nfd int 1
103global nerr ulong 1
104text nsock "$HOME/.local/share/omega-tool-model/run/model.sock"
105text nlock "$HOME/.local/share/omega-tool-model/run/model.lock"
106
107fn naddress to void
108put naddr 0 1
109for i ulong len nsock
110put naddr add i 2 get nsock i
111end
112end
113
114fn nreceive off ulong n ulong timeout long to bool
115p = ulong 0
116deadline = add monons timeout
117while lt p n bound 8192
118left = sub deadline monons
119if le left 0
120ret false
121end
122r = waitio get nfd 0 1 left
123if le r 0
124ret false
125end
126r = recv get nfd 0 nbuf add off p sub n p 64
127if eq r neg long 11
128continue
129end
130if le r 0
131ret false
132end
133p = add p ulong r
134end
135ret true
136end
137
138fn nsend off ulong n ulong to bool
139p = ulong 0
140deadline = add monons long 2000000000
141while lt p n bound 8192
142left = sub deadline monons
143if le left 0
144ret false
145end
146r = waitio get nfd 0 4 left
147if le r 0
148ret false
149end
150r = send get nfd 0 nbuf add off p sub n p 64
151if eq r neg long 11
152continue
153end
154if le r 0
155ret false
156end
157p = add p ulong r
158end
159ret true
160end
161
162fn nlength to ulong
163ret add ulong get nbuf 0 mul ulong get nbuf 1 256
164end
165
166fn nheader n ulong to void
167put nbuf 0 uchar and n 255
168put nbuf 1 uchar and shr n 8 255
169end
170
171fn nstatus code ulong to void
172if eq code 0
173nheader 0
174r = nsend 0 2
175else
176nheader 65535
177put nbuf 2 uchar code
178r = nsend 0 3
179end
180end
181
182note Private, bounded HTTP adapter. No generated text is executed or interpreted as HTML.
183global hreq uchar 12288
184global hbuf uchar 65536
185global haddr uchar 16
186global hopt uchar 4
187global hstat uchar 4
188global hfd int 1
189global hcount ulong 1
190global hend ulong 1
191global hsize ulong 1
192global hseen ulong 1
193global hguard ulong 1
194global hhost ulong 1
195global hroute ulong 1
196text hex "0123456789abcdef"
197
198fn hsend n ulong to bool
199p = ulong 0
200deadline = add monons long 3000000000
201while lt p n bound 65536
202left = sub deadline monons
203if le left 0
204ret false
205end
206r = waitio get hfd 0 4 left
207if le r 0
208ret false
209end
210r = send get hfd 0 hbuf p sub n p 64
211if eq r neg long 11
212continue
213end
214if le r 0
215ret false
216end
217p = add p ulong r
218end
219ret true
220end
221
222fn hfind start ulong total ulong to bool
223while lt add start 3 total bound 8192
224if and eq get hreq start 13 eq get hreq add start 1 10
225if and eq get hreq add start 2 13 eq get hreq add start 3 10
226put hend 0 add start 4
227ret true
228end
229end
230start = add start 1
231end
232ret false
233end
234
235fn hread to bool
236put hcount 0 0
237put hend 0 0
238deadline = add monons long 5000000000
239for step ulong 8192
240n = get hcount 0
241if ge n 8192
242ret false
243end
244left = sub deadline monons
245if le left 0
246ret false
247end
248if le waitio get hfd 0 1 left 0
249ret false
250end
251r = recv get hfd 0 hreq n sub 8192 n 64
252if eq r neg long 11
253continue
254end
255if le r 0
256ret false
257end
258total = add n ulong r
259put hcount 0 total
260start = ulong 0
261if gt n 3
262start = sub n 3
263end
264if hfind start total
265ret true
266end
267end
268ret false
269end
270
271fn hline a ulong b ulong to bool
272if eq a b
273ret true
274end
275if iscl a b
276if ne get hseen 0 0
277ret false
278end
279put hseen 0 1
280p = add a 15
281while lt p b bound 8192
282if not or eq get hreq p 32 eq get hreq p 9
283break
284end
285p = add p 1
286end
287if eq p b
288ret false
289end
290v = ulong 0
291while lt p b bound 8192
292c = get hreq p
293if or lt c 48 gt c 57
294ret false
295end
296v = add mul v 10 ulong sub c 48
297if gt v 4000
298ret false
299end
300p = add p 1
301end
302put hsize 0 v
303ret true
304end
305if iste a b
306ret false
307end
308if isguard a b
309put hguard 0 add get hguard 0 1
310end
311if ishost a b
312if not goodhost a b
313ret false
314end
315put hhost 0 add get hhost 0 1
316end
317ret true
318end
319
320fn hparse to bool
321put hsize 0 0
322put hseen 0 0
323put hguard 0 0
324put hhost 0 0
325put hroute 0 0
326n = get hend 0
327a = ulong 0
328first = true
329for i ulong sub n 1
330c = get hreq i
331if and eq c 13 eq get hreq add i 1 10
332if first
333if isroot a i
334put hroute 0 1
335end
336if isgen a i
337put hroute 0 2
338end
339if isrepair a i
340put hroute 0 3
341end
342first = false
343else
344if not hline a i
345ret false
346end
347end
348a = add i 2
349else
350if not first
351if and ge c 65 le c 90
352put hreq i add c 32
353end
354end
355end
356end
357ret eq get hhost 0 1
358end
359
360fn hbody to bool
361n = get hsize 0
362off = get hend 0
363total = add off n
364if or eq n 0 gt n 4000
365ret false
366end
367if gt get hcount 0 total
368ret false
369end
370deadline = add monons long 5000000000
371while lt get hcount 0 total bound 4000
372p = get hcount 0
373left = sub deadline monons
374if le left 0
375ret false
376end
377if le waitio get hfd 0 1 left 0
378ret false
379end
380r = recv get hfd 0 hreq p sub total p 64
381if eq r neg long 11
382continue
383end
384if le r 0
385ret false
386end
387put hcount 0 add p ulong r
388end
389nheader n
390for i ulong n
391c = get hreq add off i
392if eq c 0
393ret false
394end
395put nbuf add i 2 c
396end
397ret true
398end
399
400fn hchunk n ulong to bool
401for i ulong 4
402shift = mul sub 3 i 4
403put hbuf i get hex and shr n shift 15
404end
405put hbuf 4 13
406put hbuf 5 10
407for i ulong n
408put hbuf add i 6 get nbuf i
409end
410put hbuf add n 6 13
411put hbuf add n 7 10
412ret hsend add n 8
413end
414
415fn hstream to void
416started = false
417for frame ulong 1024
418if not nreceive 0 2 30000000000
419if not started
420r = respond502
421end
422ret
423end
424n = nlength
425if eq n 65535
426if not started
427if nreceive 0 1 2000000000
428if eq get nbuf 0 3
429r = respond422
430else
431r = respond502
432end
433else
434r = respond502
435end
436end
437ret
438end
439if gt n 4096
440if not started
441r = respond502
442end
443ret
444end
445if not started
446if not streamhead
447ret
448end
449started = true
450end
451if eq n 0
452r = streamend
453ret
454end
455if not nreceive 0 n 2000000000
456ret
457end
458if not hchunk n
459ret
460end
461end
462end
463
464fn hmodel to void
465naddress
466fd = socknew 1 524289 0
467if lt fd 0
468r = respond503
469ret
470end
471if ne connect int fd naddr 0 add len nsock 3 0
472closed = fclose int fd
473r = respond503
474ret
475end
476put nfd 0 int fd
477if nsend 0 add get hsize 0 2
478hstream
479else
480r = respond502
481end
482closed = fclose int fd
483end
484
485fn hserve to void
486if not hread
487r = respond400
488ret
489end
490if not hparse
491r = respond400
492ret
493end
494route = get hroute 0
495if eq route 1
496if ne get hsize 0 0
497r = respond400
498ret
499end
500r = respondpage
501ret
502end
503if or eq route 2 eq route 3
504if or ne get hguard 0 1 ne get hseen 0 1
505r = respond400
506ret
507end
508if not hbody
509r = respond400
510ret
511end
512if eq route 3
513wrepair
514else
515hmodel
516end
517else
518r = respond404
519end
520end
521
522fn main to int
523put haddr 0 2
524put haddr 2 70
525put haddr 3 253
526put haddr 4 127
527put haddr 7 1
528put hopt 0 1
529fd = socknew 2 524289 0
530if lt fd 0
531ret 70
532end
533r = sockopt int fd 1 2 hopt 0 4
534if ne bind int fd haddr 0 16 0
535ret 71
536end
537if ne listen int fd 16 0
538ret 72
539end
540active = ulong 0
541for request ulong 1000000
542for reap ulong 16
543done = waitpid -1 hstat 0 4 1
544if le done 0
545break
546end
547if gt active 0
548active = sub active 1
549end
550end
551if ge active 16
552r = sleepns 10000000
553continue
554end
555if le waitio int fd 1 1000000000 0
556continue
557end
558client = accept int fd 524288
559if lt client 0
560continue
561end
562pid = fork
563if eq pid 0
564r = fclose int fd
565put hfd 0 int client
566r = sockopt int client 6 1 hopt 0 4
567hserve
568r = fclose int client
569ret 0
570end
571r = fclose int client
572if gt pid 0
573active = add active 1
574end
575end
576ret 0
577end
578
579note Model-driven tools for one bounded arithmetic practice file. Paths from the model never become OS paths.
580global wsrc uchar 1024
581global wslen ulong 1
582global wobs uchar 1024
583global wolen ulong 1
584global wans uchar 4096
585global walen ulong 1
586global wpath uchar 128
587global wplen ulong 1
588global wgoal uchar 256
589global wglen ulong 1
590global wbuf uchar 8192
591global wlen ulong 1
592global wjob ulong 5
593global wstate ulong 1
594global wvalid ulong 1
595global wcall ulong 1
596global wclen ulong 1
597global wtmp uchar 1024
598global wtlen ulong 1
599global wargv uchar 1024
600global wstat uchar 4
601global wdir uchar 256
602global wdlen ulong 1
603global wout uchar 4096
604global wused ulong 1
605global wfld uchar 512
606global wflen ulong 4
607global wpos ulong 1
608global wtok uchar 128
609global wtkn ulong 1
610text wprog "program.om"
611text wtest "test.om"
612text wexe "test.bin"
613text werr "check.err"
614text wrout "run.out"
615text wbase "$HOME/.local/share/omega-tool-model/practice/"
616text wcomp "$HOME/.local/share/omega-tool-model/round40-workbench/omc"
617text wexec "./test.bin"
618
619fn wb c uchar to void
620if ge get wlen 0 8192
621exit 90
622end
623put wbuf get wlen 0 c
624put wlen 0 add get wlen 0 1
625end
626fn wn n ulong to void
627if ge n 10
628wn div n 10
629end
630wb uchar add rem n 10 48
631end
632fn wz to void
633put wlen 0 0
634end
635fn wbyte mode ulong i ulong to uchar
636if eq mode 1
637ret get wsrc i
638end
639if eq mode 2
640ret get wobs i
641end
642if eq mode 3
643ret get wans i
644end
645if eq mode 4
646ret get wpath i
647end
648if eq mode 5
649ret get wgoal i
650end
651ret get wfld add mul sub mode 6 128 i
652end
653fn wlength mode ulong to ulong
654if eq mode 1
655ret get wslen 0
656end
657if eq mode 2
658ret get wolen 0
659end
660if eq mode 3
661ret get walen 0
662end
663if eq mode 4
664ret get wplen 0
665end
666if eq mode 5
667ret get wglen 0
668end
669ret get wflen sub mode 6
670end
671fn wa mode ulong to void
672for i ulong wlength mode
673wb wbyte mode i
674end
675end
676fn wj mode ulong to void
677wb 34
678for i ulong wlength mode
679c = wbyte mode i
680if or eq c 34 eq c 92
681wb 92
682wb c
683else
684if eq c 10
685wb 92
686wb 110
687else
688if eq c 13
689wb 92
690wb 114
691else
692if eq c 9
693wb 92
694wb 116
695else
696if lt c 32
697wb 63
698else
699wb c
700end
701end
702end
703end
704end
705end
706wb 34
707end
708fn wobsbuf to void
709if gt get wlen 0 1024
710exit 90
711end
712put wolen 0 get wlen 0
713for i ulong get wlen 0
714put wobs i get wbuf i
715end
716end
717fn wemit to bool
718wb 10
719n = get wlen 0
720for i ulong n
721put nbuf i get wbuf i
722end
723ret hchunk n
724end
725fn wsmall at ulong to ulong
726if ge at get wslen 0
727ret 10000
728end
729c = get wsrc at
730if or lt c 49 gt c 54
731ret 10000
732end
733ret add at 1
734end
735fn wgrammar to bool
736put wcall 0 0
737put wclen 0 0
738p = wconsumec0 0
739if wmc1 p
740p = wconsumec2 p
741p = wsmall p
742p = wconsumec3 p
743if wmc4 p
744p = add p 3
745else
746p = wconsumec5 p
747end
748p = wconsumec6 p
749p = wsmall p
750p = wconsumec7 p
751else
752if eq get wjob 0 2
753ret false
754end
755p = wconsumec8 p
756if or wmc4 p or wmc9 p wmc10 p
757p = add p 3
758else
759if wmc11 p
760p = add p 4
761else
762p = wconsumec12 p
763end
764end
765p = wconsumec13 p
766p = wsmall p
767p = wconsumec14 p
768end
769p = wconsumec15 p
770if ge p get wslen 0
771ret false
772end
773put wcall 0 p
774v = ulong 0
775start = p
776while lt p get wslen 0 bound 1024
777c = get wsrc p
778if or lt c 48 gt c 57
779break
780end
781v = add mul v 10 ulong sub c 48
782if gt v 99
783ret false
784end
785p = add p 1
786end
787if or eq p start gt sub p start 2
788ret false
789end
790put wclen 0 sub p start
791if ne v get wjob 1
792ret false
793end
794p = wconsumec14 p
795ret eq p get wslen 0
796end
797
798fn wsave to bool
799fd = fopen wprog 0 len wprog 524865 384
800if lt fd 0
801ret false
802end
803n = write int fd wsrc 0 get wslen 0
804r = fclose int fd
805ret and eq n long get wslen 0 eq r 0
806end
807fn wload to bool
808fd = fopen wprog 0 len wprog 524288 0
809if lt fd 0
810ret false
811end
812n = read int fd wsrc 0 1024
813r = fclose int fd
814if or le n 0 gt n 600
815ret false
816end
817put wslen 0 ulong n
818ret eq r 0
819end
820fn wmkdir to bool
821wz
822wtc16
823wn ulong getpid
824wb 45
825wn ulong monons
826n = get wlen 0
827for i ulong n
828put wdir i get wbuf i
829end
830put wdlen 0 n
831if ne makedir wdir 0 n 448 0
832ret false
833end
834ret eq chdir wdir 0 n 0
835end
836fn wclean to void
837r = unlink wprog 0 len wprog
838r = unlink wtest 0 len wtest
839r = unlink wexe 0 len wexe
840r = unlink werr 0 len werr
841r = unlink wrout 0 len wrout
842r = chdir wbase 0 len wbase
843r = rmdir wdir 0 get wdlen 0
844end
845fn wwait pid int timeout long to long
846deadline = add monons timeout
847for poll ulong 10000
848r = waitpid pid wstat 0 4 1
849if eq r long pid
850if ne get wstat 0 0
851ret -2
852end
853ret long get wstat 1
854end
855if lt r 0
856ret -3
857end
858if ge monons deadline
859r = killpid pid 9
860r = waitpid pid wstat 0 4 0
861ret -1
862end
863r = sleepns 1000000
864end
865r = killpid pid 9
866r = waitpid pid wstat 0 4 0
867ret -1
868end
869fn wlaunch mode ulong ifd int ofd int efd int to long
870wz
871if eq mode 0
872wtc17
873else
874wtc18
875end
876n = get wlen 0
877put wargv 0 1
878put wargv 1 0
879put wargv 2 uchar and n 255
880put wargv 3 uchar shr n 8
881for i ulong n
882put wargv add i 4 get wbuf i
883end
884pid = fork
885if lt pid 0
886ret -3
887end
888if eq pid 0
889if ne dupfd ifd 0 0 0
890exit 98
891end
892if ne dupfd ofd 1 0 1
893exit 98
894end
895if ne dupfd efd 2 0 2
896exit 98
897end
898r = execprog wargv 0 add n 4
899exit 98
900end
901ret wwait int pid 2000000000
902end
903fn wcompile to long
904inf = fopen wtest 0 len wtest 524288 0
905outf = fopen wexe 0 len wexe 524865 384
906errf = fopen werr 0 len werr 524865 384
907if or lt inf 0 or lt outf 0 lt errf 0
908r = fclose int inf
909r = fclose int outf
910r = fclose int errf
911ret -3
912end
913rc = wlaunch 0 int inf int outf int errf
914r = fclose int inf
915r = fclose int outf
916r = fclose int errf
917ret rc
918end
919fn wrun to long
920inf = fopen wtest 0 len wtest 524288 0
921outf = fopen wrout 0 len wrout 524865 384
922errf = fopen werr 0 len werr 524865 384
923if or lt inf 0 or lt outf 0 lt errf 0
924r = fclose int inf
925r = fclose int outf
926r = fclose int errf
927ret -3
928end
929if ne chmod wexe 0 len wexe 448 0
930r = fclose int inf
931r = fclose int outf
932r = fclose int errf
933ret -3
934end
935rc = wlaunch 1 int inf int outf int errf
936r = fclose int inf
937r = fclose int outf
938r = fclose int errf
939ret rc
940end
941fn wtestsrc x ulong to bool
942wz
943for i ulong get wcall 0
944wb get wsrc i
945end
946wn x
947p = add get wcall 0 get wclen 0
948while lt p get wslen 0 bound 1024
949wb get wsrc p
950p = add p 1
951end
952fd = fopen wtest 0 len wtest 524865 384
953if lt fd 0
954ret false
955end
956n = write int fd wbuf 0 get wlen 0
957r = fclose int fd
958ret and eq n long get wlen 0 eq r 0
959end
960fn wexpected x ulong to ulong
961if eq get wjob 0 0
962ret add x get wjob 2
963end
964if eq get wjob 0 1
965ret mul x get wjob 2
966end
967ret add x mul get wjob 2 get wjob 3
968end
969fn wcheck to bool
970if not wload
971woc19
972ret false
973end
974if not wgrammar
975woc20
976ret false
977end
978for test ulong 4
979x = get wjob 1
980if eq test 1
981x = 0
982end
983if eq test 2
984x = 3
985end
986if eq test 3
987x = 7
988end
989if not wtestsrc x
990woc21
991ret false
992end
993rc = wcompile
994if ne rc 0
995if lt rc 0
996woc22
997ret false
998end
999fd = fopen werr 0 len werr 524288 0
1000n = read int fd wobs 0 1024
1001r = fclose int fd
1002if le n 0
1003woc23
1004else
1005put wolen 0 ulong n
1006while gt get wolen 0 0 bound 1024
1007p = sub get wolen 0 1
1008if ne get wobs p 10
1009break
1010end
1011put wolen 0 p
1012end
1013end
1014ret false
1015end
1016actual = wrun
1017if lt actual 0
1018woc24
1019ret false
1020end
1021want = wexpected x
1022wz
1023wtc25
1024wn x
1025wtc26
1026wn want
1027wtc27
1028wn ulong actual
1029wtc28
1030if not wemit
1031woc29
1032ret false
1033end
1034if ne ulong actual want
1035wz
1036wtc30
1037wn x
1038wtc31
1039wn want
1040wtc32
1041wn ulong actual
1042wtc33
1043wobsbuf
1044ret false
1045end
1046end
1047woc34
1048ret true
1049end
1050
1051note Strict JSON object with exactly tool/path, or tool/path/old/new, all bounded strings.
1052fn wspace to void
1053while lt get wpos 0 get walen 0 bound 4096
1054c = get wans get wpos 0
1055if not or or eq c 32 eq c 10 or eq c 13 eq c 9
1056ret
1057end
1058put wpos 0 add get wpos 0 1
1059end
1060end
1061fn wpunc c uchar to bool
1062wspace
1063p = get wpos 0
1064if ge p get walen 0
1065ret false
1066end
1067if ne get wans p c
1068ret false
1069end
1070put wpos 0 add p 1
1071ret true
1072end
1073fn wstring to bool
1074put wtkn 0 0
1075if not wpunc 34
1076ret false
1077end
1078while lt get wpos 0 get walen 0 bound 4096
1079p = get wpos 0
1080c = get wans p
1081put wpos 0 add p 1
1082if eq c 34
1083ret true
1084end
1085if lt c 32
1086ret false
1087end
1088if eq c 92
1089p = get wpos 0
1090if ge p get walen 0
1091ret false
1092end
1093c = get wans p
1094put wpos 0 add p 1
1095if eq c 110
1096c = 10
1097else
1098if eq c 114
1099c = 13
1100else
1101if eq c 116
1102c = 9
1103else
1104if not or eq c 34 or eq c 92 eq c 47
1105ret false
1106end
1107end
1108end
1109end
1110end
1111if ge get wtkn 0 127
1112ret false
1113end
1114put wtok get wtkn 0 c
1115put wtkn 0 add get wtkn 0 1
1116end
1117ret false
1118end
1119fn wjson to bool
1120put wpos 0 0
1121for i ulong 4
1122put wflen i 0
1123end
1124if not wpunc 123
1125ret false
1126end
1127mask = ulong 0
1128for field ulong 4
1129if not wstring
1130ret false
1131end
1132slot = ulong 4
1133if wtokenc35
1134slot = 0
1135end
1136if wtokenc36
1137slot = 1
1138end
1139if wtokenc37
1140slot = 2
1141end
1142if wtokenc38
1143slot = 3
1144end
1145if eq slot 4
1146ret false
1147end
1148bit = shl ulong 1 slot
1149if ne and mask bit 0
1150ret false
1151end
1152mask = or mask bit
1153if not wpunc 58
1154ret false
1155end
1156if not wstring
1157ret false
1158end
1159put wflen slot get wtkn 0
1160for i ulong get wtkn 0
1161put wfld add mul slot 128 i get wtok i
1162end
1163wspace
1164p = get wpos 0
1165if ge p get walen 0
1166ret false
1167end
1168if eq get wans p 125
1169put wpos 0 add p 1
1170wspace
1171if ne get wpos 0 get walen 0
1172ret false
1173end
1174if wfieldc39 0
1175ret eq mask 15
1176end
1177ret eq mask 3
1178end
1179if not wpunc 44
1180ret false
1181end
1182end
1183ret false
1184end
1185fn wmatchold at ulong to bool
1186n = get wflen 2
1187if gt add at n get wslen 0
1188ret false
1189end
1190for i ulong n
1191if ne get wsrc add at i get wfld add 256 i
1192ret false
1193end
1194end
1195ret true
1196end
1197fn wpatch to bool
1198oldn = get wflen 2
1199newn = get wflen 3
1200if or eq oldn 0 or gt oldn 40 gt newn 40
1201ret false
1202end
1203count = ulong 0
1204found = ulong 0
1205for i ulong get wslen 0
1206if wmatchold i
1207count = add count 1
1208found = i
1209end
1210end
1211if ne count 1
1212ret false
1213end
1214newsize = add sub get wslen 0 oldn newn
1215if gt newsize 600
1216ret false
1217end
1218put wtlen 0 get wslen 0
1219for i ulong get wslen 0
1220put wtmp i get wsrc i
1221end
1222p = found
1223for i ulong newn
1224put wsrc p get wfld add 384 i
1225p = add p 1
1226end
1227tail = add found oldn
1228while lt tail get wtlen 0 bound 1024
1229put wsrc p get wtmp tail
1230p = add p 1
1231tail = add tail 1
1232end
1233put wslen 0 newsize
1234if not wgrammar
1235put wslen 0 get wtlen 0
1236for i ulong get wtlen 0
1237put wsrc i get wtmp i
1238end
1239ret false
1240end
1241ret wsave
1242end
1243
1244fn wprompt to void
1245wz
1246wtc40
1247wa 4
1248wtc41
1249wa 5
1250wtc42
1251s = get wstate 0
1252if eq s 0
1253wtc43
1254end
1255if eq s 1
1256wtc44
1257end
1258if eq s 2
1259wtc45
1260end
1261if eq s 3
1262wtc46
1263end
1264if eq s 4
1265wtc47
1266end
1267if eq s 5
1268wtc48
1269end
1270wb 10
1271if and ne s 0 ne s 5
1272wtc49
1273wa 1
1274end
1275if ne s 0
1276wtc50
1277wa 2
1278wb 10
1279end
1280wtc51
1281end
1282fn wresponse to bool
1283put walen 0 0
1284for frame ulong 1024
1285if not nreceive 0 2 30000000000
1286ret false
1287end
1288n = nlength
1289if eq n 0
1290ret true
1291end
1292if or eq n 65535 gt n 4096
1293ret false
1294end
1295if gt add get walen 0 n 4096
1296ret false
1297end
1298if not nreceive 0 n 2000000000
1299ret false
1300end
1301for i ulong n
1302put wans add get walen 0 i get nbuf i
1303end
1304put walen 0 add get walen 0 n
1305end
1306ret false
1307end
1308fn wask to bool
1309wprompt
1310n = get wlen 0
1311if gt n 4000
1312ret false
1313end
1314nheader n
1315for i ulong n
1316put nbuf add i 2 get wbuf i
1317end
1318naddress
1319fd = socknew 1 524289 0
1320if lt fd 0
1321ret false
1322end
1323if ne connect int fd naddr 0 add len nsock 3 0
1324r = fclose int fd
1325ret false
1326end
1327put nfd 0 int fd
1328ok = false
1329if nsend 0 add n 2
1330ok = wresponse
1331end
1332r = fclose int fd
1333ret ok
1334end
1335fn wrightpath to bool
1336if ne get wflen 1 get wplen 0
1337ret false
1338end
1339for i ulong get wplen 0
1340if ne get wfld add 128 i get wpath i
1341ret false
1342end
1343end
1344ret true
1345end
1346fn waction to bool
1347s = get wstate 0
1348if and wfieldc52 0 eq s 0
1349if eq get wjob 4 1
1350put wslen 0 0
1351put wstate 0 5
1352woc53
1353else
1354if not wload
1355ret false
1356end
1357put wstate 0 1
1358woc54
1359end
1360ret weventc55 2
1361end
1362if and wfieldc56 0 or eq s 1 eq s 3
1363put wvalid 0 0
1364if wcheck
1365put wstate 0 4
1366put wvalid 0 1
1367else
1368put wstate 0 2
1369end
1370ret weventc55 2
1371end
1372if and wfieldc39 0 eq s 2
1373if not wpatch
1374ret false
1375end
1376put wstate 0 3
1377put wvalid 0 0
1378woc57
1379if not weventc58 1
1380ret false
1381end
1382ret weventc55 2
1383end
1384ret false
1385end
1386fn wloop to void
1387put wstate 0 0
1388put wvalid 0 0
1389if not weventc59 1
1390ret
1391end
1392for turn ulong 7
1393if not wask
1394wfinishc60 false
1395ret
1396end
1397if not weventc61 3
1398ret
1399end
1400if wanswerc62
1401if and eq get wstate 0 4 eq get wvalid 0 1
1402wfinishc63 true
1403else
1404wfinishc64 false
1405end
1406ret
1407end
1408if wanswerc65
1409if eq get wstate 0 5
1410wfinishc66 false
1411else
1412wfinishc67 false
1413end
1414ret
1415end
1416if not wjson
1417wfinishc68 false
1418ret
1419end
1420if not wrightpath
1421wfinishc69 false
1422ret
1423end
1424if not waction
1425wfinishc70 false
1426ret
1427end
1428end
1429wfinishc71 false
1430end
1431fn wrepair to void
1432n = get hsize 0
1433off = get hend 0
1434if lt n 2
1435r = respond400
1436ret
1437end
1438id = get hreq off
1439if or lt id 65 gt id 77
1440r = respond400
1441ret
1442end
1443if ne get hreq add off 1 10
1444r = respond400
1445ret
1446end
1447wjobload ulong sub id 65
1448if gt sub n 2 600
1449r = respond400
1450ret
1451end
1452put wslen 0 sub n 2
1453for i ulong get wslen 0
1454put wsrc i get hreq add add off 2 i
1455end
1456if eq get wjob 4 1
1457put wslen 0 0
1458else
1459if not wgrammar
1460if streamhead
1461wfinishc72 false
1462end
1463ret
1464end
1465end
1466if not wmkdir
1467r = respond503
1468ret
1469end
1470if ne get wjob 4 1
1471if not wsave
1472wclean
1473r = respond503
1474ret
1475end
1476end
1477if streamhead
1478wloop
1479end
1480wclean
1481end
1482
1483fn wjobload id ulong to void
1484if eq id 0
1485put wjob 0 2
1486put wjob 1 70
1487put wjob 2 4
1488put wjob 3 3
1489put wjob 4 0
1490wz
1491wtc73
1492put wplen 0 get wlen 0
1493for i ulong get wlen 0
1494put wpath i get wbuf i
1495end
1496wz
1497wtc74
1498put wglen 0 get wlen 0
1499for i ulong get wlen 0
1500put wgoal i get wbuf i
1501end
1502ret
1503end
1504if eq id 1
1505put wjob 0 2
1506put wjob 1 74
1507put wjob 2 3
1508put wjob 3 3
1509put wjob 4 0
1510wz
1511wtc75
1512put wplen 0 get wlen 0
1513for i ulong get wlen 0
1514put wpath i get wbuf i
1515end
1516wz
1517wtc76
1518put wglen 0 get wlen 0
1519for i ulong get wlen 0
1520put wgoal i get wbuf i
1521end
1522ret
1523end
1524if eq id 2
1525put wjob 0 0
1526put wjob 1 73
1527put wjob 2 5
1528put wjob 3 0
1529put wjob 4 0
1530wz
1531wtc77
1532put wplen 0 get wlen 0
1533for i ulong get wlen 0
1534put wpath i get wbuf i
1535end
1536wz
1537wtc78
1538put wglen 0 get wlen 0
1539for i ulong get wlen 0
1540put wgoal i get wbuf i
1541end
1542ret
1543end
1544if eq id 3
1545put wjob 0 1
1546put wjob 1 72
1547put wjob 2 1
1548put wjob 3 0
1549put wjob 4 0
1550wz
1551wtc79
1552put wplen 0 get wlen 0
1553for i ulong get wlen 0
1554put wpath i get wbuf i
1555end
1556wz
1557wtc80
1558put wglen 0 get wlen 0
1559for i ulong get wlen 0
1560put wgoal i get wbuf i
1561end
1562ret
1563end
1564if eq id 4
1565put wjob 0 2
1566put wjob 1 72
1567put wjob 2 1
1568put wjob 3 6
1569put wjob 4 0
1570wz
1571wtc81
1572put wplen 0 get wlen 0
1573for i ulong get wlen 0
1574put wpath i get wbuf i
1575end
1576wz
1577wtc82
1578put wglen 0 get wlen 0
1579for i ulong get wlen 0
1580put wgoal i get wbuf i
1581end
1582ret
1583end
1584if eq id 5
1585put wjob 0 2
1586put wjob 1 70
1587put wjob 2 2
1588put wjob 3 4
1589put wjob 4 0
1590wz
1591wtc83
1592put wplen 0 get wlen 0
1593for i ulong get wlen 0
1594put wpath i get wbuf i
1595end
1596wz
1597wtc84
1598put wglen 0 get wlen 0
1599for i ulong get wlen 0
1600put wgoal i get wbuf i
1601end
1602ret
1603end
1604if eq id 6
1605put wjob 0 2
1606put wjob 1 71
1607put wjob 2 5
1608put wjob 3 3
1609put wjob 4 1
1610wz
1611wtc85
1612put wplen 0 get wlen 0
1613for i ulong get wlen 0
1614put wpath i get wbuf i
1615end
1616wz
1617wtc86
1618put wglen 0 get wlen 0
1619for i ulong get wlen 0
1620put wgoal i get wbuf i
1621end
1622ret
1623end
1624if eq id 7
1625put wjob 0 0
1626put wjob 1 73
1627put wjob 2 5
1628put wjob 3 0
1629put wjob 4 0
1630wz
1631wtc87
1632put wplen 0 get wlen 0
1633for i ulong get wlen 0
1634put wpath i get wbuf i
1635end
1636wz
1637wtc78
1638put wglen 0 get wlen 0
1639for i ulong get wlen 0
1640put wgoal i get wbuf i
1641end
1642ret
1643end
1644if eq id 8
1645put wjob 0 0
1646put wjob 1 70
1647put wjob 2 1
1648put wjob 3 0
1649put wjob 4 0
1650wz
1651wtc88
1652put wplen 0 get wlen 0
1653for i ulong get wlen 0
1654put wpath i get wbuf i
1655end
1656wz
1657wtc89
1658put wglen 0 get wlen 0
1659for i ulong get wlen 0
1660put wgoal i get wbuf i
1661end
1662ret
1663end
1664if eq id 9
1665put wjob 0 0
1666put wjob 1 72
1667put wjob 2 1
1668put wjob 3 0
1669put wjob 4 1
1670wz
1671wtc90
1672put wplen 0 get wlen 0
1673for i ulong get wlen 0
1674put wpath i get wbuf i
1675end
1676wz
1677wtc91
1678put wglen 0 get wlen 0
1679for i ulong get wlen 0
1680put wgoal i get wbuf i
1681end
1682ret
1683end
1684if eq id 10
1685put wjob 0 1
1686put wjob 1 71
1687put wjob 2 1
1688put wjob 3 0
1689put wjob 4 0
1690wz
1691wtc92
1692put wplen 0 get wlen 0
1693for i ulong get wlen 0
1694put wpath i get wbuf i
1695end
1696wz
1697wtc93
1698put wglen 0 get wlen 0
1699for i ulong get wlen 0
1700put wgoal i get wbuf i
1701end
1702ret
1703end
1704if eq id 11
1705put wjob 0 1
1706put wjob 1 74
1707put wjob 2 1
1708put wjob 3 0
1709put wjob 4 0
1710wz
1711wtc94
1712put wplen 0 get wlen 0
1713for i ulong get wlen 0
1714put wpath i get wbuf i
1715end
1716wz
1717wtc95
1718put wglen 0 get wlen 0
1719for i ulong get wlen 0
1720put wgoal i get wbuf i
1721end
1722ret
1723end
1724if eq id 12
1725put wjob 0 1
1726put wjob 1 73
1727put wjob 2 1
1728put wjob 3 0
1729put wjob 4 1
1730wz
1731wtc96
1732put wplen 0 get wlen 0
1733for i ulong get wlen 0
1734put wpath i get wbuf i
1735end
1736wz
1737wtc97
1738put wglen 0 get wlen 0
1739for i ulong get wlen 0
1740put wgoal i get wbuf i
1741end
1742ret
1743end
1744end
1745text t0 "HTTP/1.1 200 OK\nConnection: close\nCache-Control: no-store\nX-Content-Type-Options: nosniff\nReferrer-Policy: no-referrer\nContent-Security-Policy: default-src 'none'; script-src 'sha256-bWTGATZgaaJeoGYh6ERYnQR4IwNh+uZuPc4WbOr70QM='; style-src 'unsafe-inline'; connect-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'\nContent-Type: text/html; charset=utf-8\nContent-Length: 15473\n\n"
1746text page "<!doctype html>\n<html lang=\"en\"><head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"><title>Omega · Your model</title>\n<style>\n:root{color-scheme:dark;font:16px/1.55 system-ui,sans-serif;color:#e7edef;background:#101719}*{box-sizing:border-box}body{margin:0}main{max-width:860px;margin:auto;padding:44px 24px}header{display:flex;justify-content:space-between;gap:20px;align-items:center}.mark{letter-spacing:.2em;color:#b8ddc9;font-weight:700;font-size:13px}.badge{border:1px solid #3e5850;border-radius:30px;padding:5px 13px;font-size:13px;color:#b8ddc9}h1{font-size:clamp(30px,6vw,45px);line-height:1.15;margin:34px 0 14px;font-weight:600;letter-spacing:-.035em}p{color:#aab9bc;margin:0 0 22px}.panel{background:#172124;border:1px solid #304044;border-radius:16px;padding:24px;margin-top:24px}label{display:block;font-weight:600;margin-bottom:9px}select,textarea,button{font:inherit}select{background:#101719;color:#e7edef;border:1px solid #4a6268;border-radius:8px;padding:8px 12px;margin-bottom:20px}textarea{width:100%;min-height:150px;resize:vertical;background:#101719;color:#eef5f4;border:1px solid #4a6268;border-radius:10px;padding:15px}textarea:focus,select:focus,button:focus-visible{outline:2px solid #a4dbbc;outline-offset:3px}.hint{font-size:13px;margin-top:8px}.actions{display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin-top:18px}button{cursor:pointer;border:0;border-radius:9px;padding:10px 17px;font-weight:600;background:#b8ddc9;color:#14231a}button:disabled{opacity:.5;cursor:wait}.secondary{background:transparent;color:#c0d5dc;border:1px solid #486169;font-size:13px;padding:7px 12px}.examples{display:flex;flex-wrap:wrap;gap:8px;margin-top:14px}.output-title{display:flex;justify-content:space-between;align-items:center;gap:12px}h2{font-size:17px;margin:0}pre{white-space:pre-wrap;overflow-wrap:anywhere;min-height:70px;line-height:1.6;font-size:14px;margin:18px 0 0;color:#d0eadc}#status{font-size:14px;color:#b8cccf}#status.error{color:#ffb5a9}footer{margin-top:24px;font-size:13px;color:#9aafb4}button:hover{filter:brightness(1.08)}@media(max-width:500px){main{padding:26px 16px}.panel{padding:18px}}\n</style></head><body><main>\n<header><span class=\"mark\">OMEGA</span><span class=\"badge\">Round 40 · Fast model</span></header>\n<h1>Give your model a coding job.</h1>\n<p>Watch your model read a practice file, repair it, and check the result. Start with an example, then try changing its code.</p>\n<section class=\"panel\" aria-labelledby=\"practice-title\"><div class=\"output-title\"><h2 id=\"practice-title\">Practice with tools</h2><span class=\"badge\">Real compiler checks</span></div>\n<p class=\"hint\">Choose a job. The model will work on a temporary copy and show each step.</p>\n<label for=\"job\">Practice job</label><select id=\"job\"></select>\n<p id=\"goal\"></p><label for=\"source\">Starting code</label><textarea id=\"source\" maxlength=\"600\" spellcheck=\"false\" style=\"min-height:220px;font-family:monospace;font-size:14px\"></textarea>\n<p class=\"hint\">You can change the numbers or try an arithmetic spelling mistake. Keep the same program shape and starting input. Larger programs are not supported here yet.</p>\n<div class=\"actions\"><button id=\"repair\" type=\"button\">Run the job</button><button id=\"resetjob\" class=\"secondary\" type=\"button\">Reset example</button><button id=\"canceljob\" class=\"secondary\" type=\"button\" hidden>Stop</button></div>\n<p id=\"jobstatus\" role=\"status\" aria-live=\"polite\" style=\"margin:16px 0 0\">Choose a job and press Run.</p>\n<ol id=\"steps\" style=\"padding-left:22px\"></ol>\n<div id=\"jobresult\" hidden><h2>Current code</h2><pre id=\"fixed\"></pre><div class=\"actions\"><button id=\"downloadcode\" class=\"secondary\" type=\"button\">Download code</button><button id=\"downloadreport\" class=\"secondary\" type=\"button\">Save run report</button></div></div>\n</section>\n<h2 style=\"margin-top:32px\">Ask for a single response</h2>\n<form id=\"ask\" class=\"panel\"><label for=\"mode\">What would you like to try?</label>\n<select id=\"mode\"><option value=\"task\">An Omega task</option><option value=\"raw\">Continue text / exact prompt</option></select>\n<label for=\"prompt\">Your request</label><textarea id=\"prompt\" maxlength=\"4000\" required placeholder=\"Write Omega that returns the larger of 24 and 27.\"></textarea>\n<p class=\"hint\">Keep it short. Each request starts fresh, without previous messages.</p>\n<div class=\"examples\"><button type=\"button\" class=\"secondary\" data-example=\"larger\">Compare two numbers</button><button type=\"button\" class=\"secondary\" data-example=\"tool\">Try a tool response</button></div>\n<div class=\"actions\"><button id=\"run\" type=\"submit\">Ask the model</button><button id=\"stop\" class=\"secondary\" type=\"button\" hidden>Stop</button><span id=\"status\" role=\"status\" aria-live=\"polite\">Ready when you are.</span></div></form>\n<section class=\"panel\" aria-label=\"Model response\"><div class=\"output-title\"><h2>Model response</h2><button type=\"button\" id=\"copy\" class=\"secondary\" disabled>Copy</button></div><pre id=\"output\" tabindex=\"0\">Its response will appear here.</pre></section>\n<footer>This small model is trained for specific Omega tasks, not general conversation. Practice jobs can change only their temporary exercise file. A single response is displayed without running its tool requests. Download code or a report to keep a result.</footer>\n</main><script>\nconst $=id=>document.getElementById(id);\nlet controller=null;\nconst examples={larger:{mode:'task',text:'Write Omega that returns the larger of 24 and 27.'},tool:{mode:'raw',text:'Task: Fix the error in this file and confirm its goal.\\nFile: jobs/item76666.om\\nGoal: calc starts with x and adds 4 exactly 3 times in a for loop. main calls calc with 70.\\nState: unread\\nAnswer:\\n'}};\ndocument.querySelectorAll('[data-example]').forEach(b=>b.addEventListener('click',()=>{const e=examples[b.dataset.example];$('mode').value=e.mode;$('prompt').value=e.text;$('prompt').focus();}));\nfunction status(text,error=false){$('status').textContent=text;$('status').className=error?'error':'';}\n$('stop').addEventListener('click',()=>controller?.abort());\n$('ask').addEventListener('submit',async e=>{\n e.preventDefault();if(controller)return;\n const input=$('prompt').value;if(!input.trim())return;\n const prompt=$('mode').value==='task'?'Task: '+input.trim()+'\\nAnswer:\\n':input;\n if(new TextEncoder().encode(prompt).length>4000){status('Please shorten your request.',true);return;}\n controller=new AbortController();const started=performance.now();let timer=setTimeout(()=>controller?.abort(),45000);\n $('run').disabled=true;$('stop').hidden=false;$('copy').disabled=true;$('output').textContent='';status('Waiting for the model…');\n try{\n const response=await fetch('/generate',{method:'POST',headers:{'Content-Type':'text/plain;charset=UTF-8','X-Omega-UI':'1'},body:prompt,signal:controller.signal});\n if(!response.ok)throw new Error((await response.text()).trim()||'The request could not be completed.');\n const reader=response.body.getReader(),decoder=new TextDecoder();let first=true;\n while(true){const {value,done}=await reader.read();if(done)break;$('output').textContent+=decoder.decode(value,{stream:true});if(first){status('Receiving the response…');first=false;}}\n $('output').textContent+=decoder.decode();status('Finished in '+Math.round(performance.now()-started)+' ms.');\n if(!$('output').textContent)$('output').textContent='The model finished without any text. Try one of the examples.';\n }catch(error){status(error.name==='AbortError'?'Stopped. Any response shown may be incomplete.':error.message,true);}\n finally{clearTimeout(timer);controller=null;$('run').disabled=false;$('stop').hidden=true;$('copy').disabled=!$('output').textContent;}\n});\n$('copy').addEventListener('click',async()=>{\n const text=$('output').textContent;\n try{if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(text);}else{const area=document.createElement('textarea');area.value=text;area.style.position='fixed';area.style.opacity='0';document.body.appendChild(area);area.select();const ok=document.execCommand('copy');area.remove();if(!ok)throw new Error('copy');}status('Response copied.');}catch{status('Select the response text to copy it.',true);}\n});\n\nconst practiceJobs=[{\"id\":\"A\",\"label\":\"Loop: wrong repeat count\",\"goal\":\"Start with 70. Add 4 exactly 3 times.\",\"source\":\"fn calc x int to int\\ns = x\\nfor i ulong 2\\ns = add s int 4\\nend\\nret s\\nend\\nfn main to int\\nret calc int 70\\nend\\n\",\"missing\":false},{\"id\":\"B\",\"label\":\"Loop: wrong addition\",\"goal\":\"Start with 74. Add 3 exactly 3 times.\",\"source\":\"fn calc x int to int\\ns = x\\nfor i ulong 3\\ns = add s int 6\\nend\\nret s\\nend\\nfn main to int\\nret calc int 74\\nend\\n\",\"missing\":false},{\"id\":\"C\",\"label\":\"Addition: wrong number\",\"goal\":\"Add 5 to 73.\",\"source\":\"fn calc x int to int\\nret add x int 6\\nend\\nfn main to int\\nret calc int 73\\nend\\n\",\"missing\":false},{\"id\":\"D\",\"label\":\"Multiplication: wrong number\",\"goal\":\"Multiply 72 by 1.\",\"source\":\"fn calc x int to int\\nret mul x int 3\\nend\\nfn main to int\\nret calc int 72\\nend\\n\",\"missing\":false},{\"id\":\"E\",\"label\":\"Loop: spelling error\",\"goal\":\"Start with 72. Add 1 exactly 6 times.\",\"source\":\"fn calc x int to int\\ns = x\\nfor i ulong 6\\ns = plus s int 1\\nend\\nret s\\nend\\nfn main to int\\nret calc int 72\\nend\\n\",\"missing\":false},{\"id\":\"F\",\"label\":\"Loop: already correct\",\"goal\":\"Start with 70. Add 2 exactly 4 times.\",\"source\":\"fn calc x int to int\\ns = x\\nfor i ulong 4\\ns = add s int 2\\nend\\nret s\\nend\\nfn main to int\\nret calc int 70\\nend\\n\",\"missing\":false},{\"id\":\"G\",\"label\":\"Loop: missing file\",\"goal\":\"Start with 71. Add 5 exactly 3 times.\",\"source\":\"\",\"missing\":true},{\"id\":\"H\",\"label\":\"Addition: spelling error\",\"goal\":\"Add 5 to 73.\",\"source\":\"fn calc x int to int\\nret plus x int 5\\nend\\nfn main to int\\nret calc int 73\\nend\\n\",\"missing\":false},{\"id\":\"I\",\"label\":\"Addition: already correct\",\"goal\":\"Add 1 to 70.\",\"source\":\"fn calc x int to int\\nret add x int 1\\nend\\nfn main to int\\nret calc int 70\\nend\\n\",\"missing\":false},{\"id\":\"J\",\"label\":\"Addition: missing file\",\"goal\":\"Add 1 to 72.\",\"source\":\"\",\"missing\":true},{\"id\":\"K\",\"label\":\"Multiplication: spelling error\",\"goal\":\"Multiply 71 by 1.\",\"source\":\"fn calc x int to int\\nret times x int 1\\nend\\nfn main to int\\nret calc int 71\\nend\\n\",\"missing\":false},{\"id\":\"L\",\"label\":\"Multiplication: already correct\",\"goal\":\"Multiply 74 by 1.\",\"source\":\"fn calc x int to int\\nret mul x int 1\\nend\\nfn main to int\\nret calc int 74\\nend\\n\",\"missing\":false},{\"id\":\"M\",\"label\":\"Multiplication: missing file\",\"goal\":\"Multiply 73 by 1.\",\"source\":\"\",\"missing\":true}];\nlet jobController=null,runReport=null,finishedSource='';\npracticeJobs.forEach((j,i)=>{const option=document.createElement('option');option.value=i;option.textContent=j.label;$('job').appendChild(option);});\nfunction loadJob(){if(jobController)return;const j=practiceJobs[+$('job').value];$('goal').textContent=j.goal+ (j.missing?' The practice file is deliberately missing.':'');$('source').value=j.source;$('source').disabled=j.missing;$('jobresult').hidden=true;$('steps').replaceChildren();$('jobstatus').textContent='Choose a job and press Run.';}\n$('job').addEventListener('change',loadJob);$('resetjob').addEventListener('click',loadJob);loadJob();\n$('canceljob').addEventListener('click',()=>jobController?.abort());\nfunction jobStep(text){const li=document.createElement('li');li.textContent=text;li.style.marginBottom='8px';$('steps').appendChild(li);}\nfunction receiveEvent(event){\n runReport.events.push(event);\n if(event.type==='action'){\n try{const action=JSON.parse(event.text);if(action.tool==='read_file')jobStep('Model asks to read the practice file.');else if(action.tool==='omega_check')jobStep('Model asks to compile and test the program.');else if(action.tool==='replace_text')jobStep('Model proposes replacing “'+action.old+'” with “'+action.new+'”.');else jobStep('Model requested an unsupported action.');}\n catch{jobStep('Model says: '+event.text);}\n }else if(event.type==='observation'){jobStep(event.text);}\n else if(event.type==='test'){jobStep('Check with input '+event.input+': expected '+event.expected+', got '+event.actual+'. '+(event.expected===event.actual?'Passed.':'Failed.'));}\n else if(event.type==='source'){finishedSource=event.text;$('fixed').textContent=event.text;$('jobresult').hidden=false;}\n else if(event.type==='done'){\n runReport.result=event;finishedSource=event.source;$('fixed').textContent=event.source||'No practice file was created.';$('jobresult').hidden=false;$('downloadcode').disabled=!event.source;\n $('jobstatus').textContent=event.message;$('jobstatus').style.color=event.passed?'#b8ddc9':'#ffd5a2';\n }\n}\n$('repair').addEventListener('click',async()=>{\n if(jobController)return;\n const j=practiceJobs[+$('job').value];let source=$('source').value.replace(/\\r\\n?/g,'\\n');if(source&&!source.endsWith('\\n'))source+='\\n';\n if(new TextEncoder().encode(source).length>600){$('jobstatus').textContent='Please shorten the program to 600 bytes or less.';return;}\n jobController=new AbortController();const timer=setTimeout(()=>jobController?.abort(),90000);\n runReport={model:'Omega round40',job:j.label,goal:j.goal,startedAt:new Date().toISOString(),original:source,events:[]};finishedSource='';\n $('steps').replaceChildren();$('jobresult').hidden=true;$('jobstatus').textContent='The model is starting the job…';$('jobstatus').style.color='';\n $('repair').disabled=true;$('resetjob').disabled=true;$('job').disabled=true;$('source').disabled=true;$('canceljob').hidden=false;\n try{\n const response=await fetch('/repair',{method:'POST',headers:{'Content-Type':'text/plain;charset=UTF-8','X-Omega-UI':'1'},body:j.id+'\\n'+source,signal:jobController.signal});\n if(!response.ok)throw new Error((await response.text()).trim()||'The job could not start.');\n const reader=response.body.getReader(),decoder=new TextDecoder();let pending='';\n while(true){const {value,done}=await reader.read();if(done){pending+=decoder.decode();break;}pending+=decoder.decode(value,{stream:true});let newline;while((newline=pending.indexOf('\\n'))>=0){const line=pending.slice(0,newline);pending=pending.slice(newline+1);if(line)receiveEvent(JSON.parse(line));}}\n if(pending.trim())throw new Error('The job ended with an incomplete report.');\n if(!runReport.result)throw new Error('The job stopped before a verified result arrived.');\n }catch(error){runReport.error=error.name==='AbortError'?'Stopped. Any work shown may be incomplete.':error.message;$('jobstatus').textContent=runReport.error;$('jobstatus').style.color='#ffb5a9';$('jobresult').hidden=false;$('fixed').textContent=finishedSource||source||'No source available.';$('downloadcode').disabled=!finishedSource;}\n finally{clearTimeout(timer);jobController=null;$('repair').disabled=false;$('resetjob').disabled=false;$('job').disabled=false;$('source').disabled=j.missing;$('canceljob').hidden=true;}\n});\nfunction download(name,text,type){const url=URL.createObjectURL(new Blob([text],{type}));const a=document.createElement('a');a.href=url;a.download=name;document.body.appendChild(a);a.click();a.remove();setTimeout(()=>URL.revokeObjectURL(url),1000);}\n$('downloadcode').addEventListener('click',()=>download('practice-result.om',finishedSource,'text/plain'));\n$('downloadreport').addEventListener('click',()=>{if(runReport)download('omega-run-report.json',JSON.stringify(runReport,null,2)+'\\n','application/json');});\n\n</script></body></html>\n"
1747fn respondpage to bool
1748p = ulong 0
1749for i ulong len t0
1750c = get t0 i
1751if eq c 10
1752put hbuf p 13
1753p = add p 1
1754end
1755put hbuf p c
1756p = add p 1
1757end
1758for i ulong len page
1759put hbuf p get page i
1760p = add p 1
1761end
1762ret hsend p
1763end
1764text t1 "HTTP/1.1 400 Bad Request\nConnection: close\nCache-Control: no-store\nX-Content-Type-Options: nosniff\nReferrer-Policy: no-referrer\nContent-Security-Policy: default-src 'none'; script-src 'sha256-bWTGATZgaaJeoGYh6ERYnQR4IwNh+uZuPc4WbOr70QM='; style-src 'unsafe-inline'; connect-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'\nContent-Type: text/plain; charset=utf-8\nContent-Length: 55\n\nPlease send a short, nonempty request using this page.\n"
1765fn respond400 to bool
1766p = ulong 0
1767for i ulong len t1
1768c = get t1 i
1769if eq c 10
1770put hbuf p 13
1771p = add p 1
1772end
1773put hbuf p c
1774p = add p 1
1775end
1776put hbuf sub p 2 10
1777p = sub p 1
1778ret hsend p
1779end
1780text t2 "HTTP/1.1 404 Not Found\nConnection: close\nCache-Control: no-store\nX-Content-Type-Options: nosniff\nReferrer-Policy: no-referrer\nContent-Security-Policy: default-src 'none'; script-src 'sha256-bWTGATZgaaJeoGYh6ERYnQR4IwNh+uZuPc4WbOr70QM='; style-src 'unsafe-inline'; connect-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'\nContent-Type: text/plain; charset=utf-8\nContent-Length: 16\n\nPage not found.\n"
1781fn respond404 to bool
1782p = ulong 0
1783for i ulong len t2
1784c = get t2 i
1785if eq c 10
1786put hbuf p 13
1787p = add p 1
1788end
1789put hbuf p c
1790p = add p 1
1791end
1792put hbuf sub p 2 10
1793p = sub p 1
1794ret hsend p
1795end
1796text t3 "HTTP/1.1 422 Unprocessable Content\nConnection: close\nCache-Control: no-store\nX-Content-Type-Options: nosniff\nReferrer-Policy: no-referrer\nContent-Security-Policy: default-src 'none'; script-src 'sha256-bWTGATZgaaJeoGYh6ERYnQR4IwNh+uZuPc4WbOr70QM='; style-src 'unsafe-inline'; connect-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'\nContent-Type: text/plain; charset=utf-8\nContent-Length: 73\n\nThis request is too long for the model. Please shorten it and try again.\n"
1797fn respond422 to bool
1798p = ulong 0
1799for i ulong len t3
1800c = get t3 i
1801if eq c 10
1802put hbuf p 13
1803p = add p 1
1804end
1805put hbuf p c
1806p = add p 1
1807end
1808put hbuf sub p 2 10
1809p = sub p 1
1810ret hsend p
1811end
1812text t4 "HTTP/1.1 502 Bad Gateway\nConnection: close\nCache-Control: no-store\nX-Content-Type-Options: nosniff\nReferrer-Policy: no-referrer\nContent-Security-Policy: default-src 'none'; script-src 'sha256-bWTGATZgaaJeoGYh6ERYnQR4IwNh+uZuPc4WbOr70QM='; style-src 'unsafe-inline'; connect-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'\nContent-Type: text/plain; charset=utf-8\nContent-Length: 54\n\nThe model response was interrupted. Please try again.\n"
1813fn respond502 to bool
1814p = ulong 0
1815for i ulong len t4
1816c = get t4 i
1817if eq c 10
1818put hbuf p 13
1819p = add p 1
1820end
1821put hbuf p c
1822p = add p 1
1823end
1824put hbuf sub p 2 10
1825p = sub p 1
1826ret hsend p
1827end
1828text t5 "HTTP/1.1 503 Service Unavailable\nConnection: close\nCache-Control: no-store\nX-Content-Type-Options: nosniff\nReferrer-Policy: no-referrer\nContent-Security-Policy: default-src 'none'; script-src 'sha256-bWTGATZgaaJeoGYh6ERYnQR4IwNh+uZuPc4WbOr70QM='; style-src 'unsafe-inline'; connect-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'\nContent-Type: text/plain; charset=utf-8\nContent-Length: 60\n\nThe model service is unavailable. Please try again shortly.\n"
1829fn respond503 to bool
1830p = ulong 0
1831for i ulong len t5
1832c = get t5 i
1833if eq c 10
1834put hbuf p 13
1835p = add p 1
1836end
1837put hbuf p c
1838p = add p 1
1839end
1840put hbuf sub p 2 10
1841p = sub p 1
1842ret hsend p
1843end
1844text t6 "HTTP/1.1 200 OK\nConnection: close\nCache-Control: no-store\nX-Content-Type-Options: nosniff\nReferrer-Policy: no-referrer\nContent-Security-Policy: default-src 'none'; script-src 'sha256-bWTGATZgaaJeoGYh6ERYnQR4IwNh+uZuPc4WbOr70QM='; style-src 'unsafe-inline'; connect-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'\nContent-Type: text/plain; charset=utf-8\nTransfer-Encoding: chunked\nX-Accel-Buffering: no\n\n"
1845fn streamhead to bool
1846p = ulong 0
1847for i ulong len t6
1848c = get t6 i
1849if eq c 10
1850put hbuf p 13
1851p = add p 1
1852end
1853put hbuf p c
1854p = add p 1
1855end
1856ret hsend p
1857end
1858text t7 "0\n\n"
1859fn streamend to bool
1860p = ulong 0
1861for i ulong len t7
1862c = get t7 i
1863if eq c 10
1864put hbuf p 13
1865p = add p 1
1866end
1867put hbuf p c
1868p = add p 1
1869end
1870ret hsend p
1871end
1872text m0 "GET / HTTP/1.1"
1873fn isroot a ulong b ulong to bool
1874if ne sub b a len m0
1875ret false
1876end
1877for i ulong len m0
1878if ne get hreq add a i get m0 i
1879ret false
1880end
1881end
1882ret true
1883end
1884text m1 "POST /generate HTTP/1.1"
1885fn isgen a ulong b ulong to bool
1886if ne sub b a len m1
1887ret false
1888end
1889for i ulong len m1
1890if ne get hreq add a i get m1 i
1891ret false
1892end
1893end
1894ret true
1895end
1896text m2 "POST /repair HTTP/1.1"
1897fn isrepair a ulong b ulong to bool
1898if ne sub b a len m2
1899ret false
1900end
1901for i ulong len m2
1902if ne get hreq add a i get m2 i
1903ret false
1904end
1905end
1906ret true
1907end
1908text m3 "content-length:"
1909fn iscl a ulong b ulong to bool
1910if lt sub b a len m3
1911ret false
1912end
1913for i ulong len m3
1914if ne get hreq add a i get m3 i
1915ret false
1916end
1917end
1918ret true
1919end
1920text m4 "transfer-encoding:"
1921fn iste a ulong b ulong to bool
1922if lt sub b a len m4
1923ret false
1924end
1925for i ulong len m4
1926if ne get hreq add a i get m4 i
1927ret false
1928end
1929end
1930ret true
1931end
1932text m5 "x-omega-ui: 1"
1933fn isguard a ulong b ulong to bool
1934if ne sub b a len m5
1935ret false
1936end
1937for i ulong len m5
1938if ne get hreq add a i get m5 i
1939ret false
1940end
1941end
1942ret true
1943end
1944text m6 "host:"
1945fn ishost a ulong b ulong to bool
1946if lt sub b a len m6
1947ret false
1948end
1949for i ulong len m6
1950if ne get hreq add a i get m6 i
1951ret false
1952end
1953end
1954ret true
1955end
1956text m7 "host: 127.0.0.1:18173"
1957fn host0 a ulong b ulong to bool
1958if ne sub b a len m7
1959ret false
1960end
1961for i ulong len m7
1962if ne get hreq add a i get m7 i
1963ret false
1964end
1965end
1966ret true
1967end
1968text m8 "host: localhost:18173"
1969fn host1 a ulong b ulong to bool
1970if ne sub b a len m8
1971ret false
1972end
1973for i ulong len m8
1974if ne get hreq add a i get m8 i
1975ret false
1976end
1977end
1978ret true
1979end
1980text m9 "host: 127.0.0.1:18174"
1981fn host2 a ulong b ulong to bool
1982if ne sub b a len m9
1983ret false
1984end
1985for i ulong len m9
1986if ne get hreq add a i get m9 i
1987ret false
1988end
1989end
1990ret true
1991end
1992text m10 "host: localhost:18174"
1993fn host3 a ulong b ulong to bool
1994if ne sub b a len m10
1995ret false
1996end
1997for i ulong len m10
1998if ne get hreq add a i get m10 i
1999ret false
2000end
2001end
2002ret true
2003end
2004fn goodhost a ulong b ulong to bool
2005ret or or host0 a b host1 a b or host2 a b host3 a b
2006end
2007fn wconsumec0 at ulong to ulong
2008if not wmc98 at
2009ret 10000
2010end
2011ret add at len z0
2012end
2013
2014fn wmc1 at ulong to bool
2015if gt add at len z1 get wslen 0
2016ret false
2017end
2018for i ulong len z1
2019if ne get wsrc add at i get z1 i
2020ret false
2021end
2022end
2023ret true
2024end
2025
2026fn wconsumec2 at ulong to ulong
2027if not wmc1 at
2028ret 10000
2029end
2030ret add at len z1
2031end
2032
2033fn wconsumec3 at ulong to ulong
2034if not wmc99 at
2035ret 10000
2036end
2037ret add at len z2
2038end
2039
2040fn wmc4 at ulong to bool
2041if gt add at len z3 get wslen 0
2042ret false
2043end
2044for i ulong len z3
2045if ne get wsrc add at i get z3 i
2046ret false
2047end
2048end
2049ret true
2050end
2051
2052fn wconsumec5 at ulong to ulong
2053if not wmc11 at
2054ret 10000
2055end
2056ret add at len z4
2057end
2058
2059fn wconsumec6 at ulong to ulong
2060if not wmc100 at
2061ret 10000
2062end
2063ret add at len z5
2064end
2065
2066fn wconsumec7 at ulong to ulong
2067if not wmc101 at
2068ret 10000
2069end
2070ret add at len z6
2071end
2072
2073fn wconsumec8 at ulong to ulong
2074if not wmc102 at
2075ret 10000
2076end
2077ret add at len z7
2078end
2079
2080fn wmc9 at ulong to bool
2081if gt add at len z8 get wslen 0
2082ret false
2083end
2084for i ulong len z8
2085if ne get wsrc add at i get z8 i
2086ret false
2087end
2088end
2089ret true
2090end
2091
2092fn wmc10 at ulong to bool
2093if gt add at len z9 get wslen 0
2094ret false
2095end
2096for i ulong len z9
2097if ne get wsrc add at i get z9 i
2098ret false
2099end
2100end
2101ret true
2102end
2103
2104fn wmc11 at ulong to bool
2105if gt add at len z4 get wslen 0
2106ret false
2107end
2108for i ulong len z4
2109if ne get wsrc add at i get z4 i
2110ret false
2111end
2112end
2113ret true
2114end
2115
2116fn wconsumec12 at ulong to ulong
2117if not wmc103 at
2118ret 10000
2119end
2120ret add at len z10
2121end
2122
2123fn wconsumec13 at ulong to ulong
2124if not wmc104 at
2125ret 10000
2126end
2127ret add at len z11
2128end
2129
2130fn wconsumec14 at ulong to ulong
2131if not wmc105 at
2132ret 10000
2133end
2134ret add at len z12
2135end
2136
2137fn wconsumec15 at ulong to ulong
2138if not wmc106 at
2139ret 10000
2140end
2141ret add at len z13
2142end
2143
2144fn wtc16 to void
2145for i ulong len wbase
2146wb get wbase i
2147end
2148end
2149
2150fn wtc17 to void
2151for i ulong len wcomp
2152wb get wcomp i
2153end
2154end
2155
2156fn wtc18 to void
2157for i ulong len wexec
2158wb get wexec i
2159end
2160end
2161
2162fn woc19 to void
2163put wolen 0 len z14
2164for i ulong len z14
2165put wobs i get z14 i
2166end
2167end
2168
2169fn woc20 to void
2170put wolen 0 len z15
2171for i ulong len z15
2172put wobs i get z15 i
2173end
2174end
2175
2176fn woc21 to void
2177put wolen 0 len z16
2178for i ulong len z16
2179put wobs i get z16 i
2180end
2181end
2182
2183fn woc22 to void
2184put wolen 0 len z17
2185for i ulong len z17
2186put wobs i get z17 i
2187end
2188end
2189
2190fn woc23 to void
2191put wolen 0 len z18
2192for i ulong len z18
2193put wobs i get z18 i
2194end
2195end
2196
2197fn woc24 to void
2198put wolen 0 len z19
2199for i ulong len z19
2200put wobs i get z19 i
2201end
2202end
2203
2204fn wtc25 to void
2205for i ulong len z20
2206wb get z20 i
2207end
2208end
2209
2210fn wtc26 to void
2211for i ulong len z21
2212wb get z21 i
2213end
2214end
2215
2216fn wtc27 to void
2217for i ulong len z22
2218wb get z22 i
2219end
2220end
2221
2222fn wtc28 to void
2223for i ulong len z23
2224wb get z23 i
2225end
2226end
2227
2228fn woc29 to void
2229put wolen 0 len z24
2230for i ulong len z24
2231put wobs i get z24 i
2232end
2233end
2234
2235fn wtc30 to void
2236for i ulong len z25
2237wb get z25 i
2238end
2239end
2240
2241fn wtc31 to void
2242for i ulong len z26
2243wb get z26 i
2244end
2245end
2246
2247fn wtc32 to void
2248for i ulong len z27
2249wb get z27 i
2250end
2251end
2252
2253fn wtc33 to void
2254for i ulong len z28
2255wb get z28 i
2256end
2257end
2258
2259fn woc34 to void
2260put wolen 0 len z29
2261for i ulong len z29
2262put wobs i get z29 i
2263end
2264end
2265
2266fn wtokenc35 to bool
2267if ne get wtkn 0 len z30
2268ret false
2269end
2270for i ulong len z30
2271if ne get wtok i get z30 i
2272ret false
2273end
2274end
2275ret true
2276end
2277
2278fn wtokenc36 to bool
2279if ne get wtkn 0 len z31
2280ret false
2281end
2282for i ulong len z31
2283if ne get wtok i get z31 i
2284ret false
2285end
2286end
2287ret true
2288end
2289
2290fn wtokenc37 to bool
2291if ne get wtkn 0 len z32
2292ret false
2293end
2294for i ulong len z32
2295if ne get wtok i get z32 i
2296ret false
2297end
2298end
2299ret true
2300end
2301
2302fn wtokenc38 to bool
2303if ne get wtkn 0 len z33
2304ret false
2305end
2306for i ulong len z33
2307if ne get wtok i get z33 i
2308ret false
2309end
2310end
2311ret true
2312end
2313
2314fn wfieldc39 slot ulong to bool
2315if ne get wflen slot len z34
2316ret false
2317end
2318for i ulong len z34
2319if ne get wfld add mul slot 128 i get z34 i
2320ret false
2321end
2322end
2323ret true
2324end
2325
2326fn wtc40 to void
2327for i ulong len z35
2328wb get z35 i
2329end
2330end
2331
2332fn wtc41 to void
2333for i ulong len z36
2334wb get z36 i
2335end
2336end
2337
2338fn wtc42 to void
2339for i ulong len z37
2340wb get z37 i
2341end
2342end
2343
2344fn wtc43 to void
2345for i ulong len z38
2346wb get z38 i
2347end
2348end
2349
2350fn wtc44 to void
2351for i ulong len z39
2352wb get z39 i
2353end
2354end
2355
2356fn wtc45 to void
2357for i ulong len z40
2358wb get z40 i
2359end
2360end
2361
2362fn wtc46 to void
2363for i ulong len z41
2364wb get z41 i
2365end
2366end
2367
2368fn wtc47 to void
2369for i ulong len z42
2370wb get z42 i
2371end
2372end
2373
2374fn wtc48 to void
2375for i ulong len z43
2376wb get z43 i
2377end
2378end
2379
2380fn wtc49 to void
2381for i ulong len z44
2382wb get z44 i
2383end
2384end
2385
2386fn wtc50 to void
2387for i ulong len z45
2388wb get z45 i
2389end
2390end
2391
2392fn wtc51 to void
2393for i ulong len z46
2394wb get z46 i
2395end
2396end
2397
2398fn wfieldc52 slot ulong to bool
2399if ne get wflen slot len z47
2400ret false
2401end
2402for i ulong len z47
2403if ne get wfld add mul slot 128 i get z47 i
2404ret false
2405end
2406end
2407ret true
2408end
2409
2410fn woc53 to void
2411put wolen 0 len z48
2412for i ulong len z48
2413put wobs i get z48 i
2414end
2415end
2416
2417fn woc54 to void
2418put wolen 0 len z49
2419for i ulong len z49
2420put wobs i get z49 i
2421end
2422end
2423
2424fn weventc55 mode ulong to bool
2425wz
2426wtc107
2427wtc108
2428wtc109
2429wj mode
2430wtc28
2431ret wemit
2432end
2433
2434fn wfieldc56 slot ulong to bool
2435if ne get wflen slot len z51
2436ret false
2437end
2438for i ulong len z51
2439if ne get wfld add mul slot 128 i get z51 i
2440ret false
2441end
2442end
2443ret true
2444end
2445
2446fn woc57 to void
2447put wolen 0 len z52
2448for i ulong len z52
2449put wobs i get z52 i
2450end
2451end
2452
2453fn weventc58 mode ulong to bool
2454wz
2455wtc107
2456wtc110
2457wtc109
2458wj mode
2459wtc28
2460ret wemit
2461end
2462
2463fn weventc59 mode ulong to bool
2464wz
2465wtc107
2466wtc111
2467wtc109
2468wj mode
2469wtc28
2470ret wemit
2471end
2472
2473fn wfinishc60 ok bool to void
2474wz
2475wtc112
2476if ok
2477wtc113
2478else
2479wtc114
2480end
2481wtc115
2482wtc116
2483wtc117
2484wj 1
2485wtc28
2486r = wemit
2487r = streamend
2488end
2489
2490note Match exact, host-free line grammar before the compiler is invoked.
2491
2492fn weventc61 mode ulong to bool
2493wz
2494wtc107
2495wtc118
2496wtc109
2497wj mode
2498wtc28
2499ret wemit
2500end
2501
2502fn wanswerc62 to bool
2503if ne get walen 0 len z29
2504ret false
2505end
2506for i ulong len z29
2507if ne get wans i get z29 i
2508ret false
2509end
2510end
2511ret true
2512end
2513
2514fn wfinishc63 ok bool to void
2515wz
2516wtc112
2517if ok
2518wtc113
2519else
2520wtc114
2521end
2522wtc115
2523wtc119
2524wtc117
2525wj 1
2526wtc28
2527r = wemit
2528r = streamend
2529end
2530
2531note Match exact, host-free line grammar before the compiler is invoked.
2532
2533fn wfinishc64 ok bool to void
2534wz
2535wtc112
2536if ok
2537wtc113
2538else
2539wtc114
2540end
2541wtc115
2542wtc120
2543wtc117
2544wj 1
2545wtc28
2546r = wemit
2547r = streamend
2548end
2549
2550note Match exact, host-free line grammar before the compiler is invoked.
2551
2552fn wanswerc65 to bool
2553if ne get walen 0 len z48
2554ret false
2555end
2556for i ulong len z48
2557if ne get wans i get z48 i
2558ret false
2559end
2560end
2561ret true
2562end
2563
2564fn wfinishc66 ok bool to void
2565wz
2566wtc112
2567if ok
2568wtc113
2569else
2570wtc114
2571end
2572wtc115
2573wtc121
2574wtc117
2575wj 1
2576wtc28
2577r = wemit
2578r = streamend
2579end
2580
2581note Match exact, host-free line grammar before the compiler is invoked.
2582
2583fn wfinishc67 ok bool to void
2584wz
2585wtc112
2586if ok
2587wtc113
2588else
2589wtc114
2590end
2591wtc115
2592wtc122
2593wtc117
2594wj 1
2595wtc28
2596r = wemit
2597r = streamend
2598end
2599
2600note Match exact, host-free line grammar before the compiler is invoked.
2601
2602fn wfinishc68 ok bool to void
2603wz
2604wtc112
2605if ok
2606wtc113
2607else
2608wtc114
2609end
2610wtc115
2611wtc123
2612wtc117
2613wj 1
2614wtc28
2615r = wemit
2616r = streamend
2617end
2618
2619note Match exact, host-free line grammar before the compiler is invoked.
2620
2621fn wfinishc69 ok bool to void
2622wz
2623wtc112
2624if ok
2625wtc113
2626else
2627wtc114
2628end
2629wtc115
2630wtc124
2631wtc117
2632wj 1
2633wtc28
2634r = wemit
2635r = streamend
2636end
2637
2638note Match exact, host-free line grammar before the compiler is invoked.
2639
2640fn wfinishc70 ok bool to void
2641wz
2642wtc112
2643if ok
2644wtc113
2645else
2646wtc114
2647end
2648wtc115
2649wtc125
2650wtc117
2651wj 1
2652wtc28
2653r = wemit
2654r = streamend
2655end
2656
2657note Match exact, host-free line grammar before the compiler is invoked.
2658
2659fn wfinishc71 ok bool to void
2660wz
2661wtc112
2662if ok
2663wtc113
2664else
2665wtc114
2666end
2667wtc115
2668wtc126
2669wtc117
2670wj 1
2671wtc28
2672r = wemit
2673r = streamend
2674end
2675
2676note Match exact, host-free line grammar before the compiler is invoked.
2677
2678fn wfinishc72 ok bool to void
2679wz
2680wtc112
2681if ok
2682wtc113
2683else
2684wtc114
2685end
2686wtc115
2687wtc127
2688wtc117
2689wj 1
2690wtc28
2691r = wemit
2692r = streamend
2693end
2694
2695note Match exact, host-free line grammar before the compiler is invoked.
2696
2697fn wtc73 to void
2698for i ulong len z66
2699wb get z66 i
2700end
2701end
2702
2703fn wtc74 to void
2704for i ulong len z67
2705wb get z67 i
2706end
2707end
2708
2709fn wtc75 to void
2710for i ulong len z68
2711wb get z68 i
2712end
2713end
2714
2715fn wtc76 to void
2716for i ulong len z69
2717wb get z69 i
2718end
2719end
2720
2721fn wtc77 to void
2722for i ulong len z70
2723wb get z70 i
2724end
2725end
2726
2727fn wtc78 to void
2728for i ulong len z71
2729wb get z71 i
2730end
2731end
2732
2733fn wtc79 to void
2734for i ulong len z72
2735wb get z72 i
2736end
2737end
2738
2739fn wtc80 to void
2740for i ulong len z73
2741wb get z73 i
2742end
2743end
2744
2745fn wtc81 to void
2746for i ulong len z74
2747wb get z74 i
2748end
2749end
2750
2751fn wtc82 to void
2752for i ulong len z75
2753wb get z75 i
2754end
2755end
2756
2757fn wtc83 to void
2758for i ulong len z76
2759wb get z76 i
2760end
2761end
2762
2763fn wtc84 to void
2764for i ulong len z77
2765wb get z77 i
2766end
2767end
2768
2769fn wtc85 to void
2770for i ulong len z78
2771wb get z78 i
2772end
2773end
2774
2775fn wtc86 to void
2776for i ulong len z79
2777wb get z79 i
2778end
2779end
2780
2781fn wtc87 to void
2782for i ulong len z80
2783wb get z80 i
2784end
2785end
2786
2787fn wtc88 to void
2788for i ulong len z81
2789wb get z81 i
2790end
2791end
2792
2793fn wtc89 to void
2794for i ulong len z82
2795wb get z82 i
2796end
2797end
2798
2799fn wtc90 to void
2800for i ulong len z83
2801wb get z83 i
2802end
2803end
2804
2805fn wtc91 to void
2806for i ulong len z84
2807wb get z84 i
2808end
2809end
2810
2811fn wtc92 to void
2812for i ulong len z85
2813wb get z85 i
2814end
2815end
2816
2817fn wtc93 to void
2818for i ulong len z86
2819wb get z86 i
2820end
2821end
2822
2823fn wtc94 to void
2824for i ulong len z87
2825wb get z87 i
2826end
2827end
2828
2829fn wtc95 to void
2830for i ulong len z88
2831wb get z88 i
2832end
2833end
2834
2835fn wtc96 to void
2836for i ulong len z89
2837wb get z89 i
2838end
2839end
2840
2841fn wtc97 to void
2842for i ulong len z90
2843wb get z90 i
2844end
2845end
2846
2847fn wmc98 at ulong to bool
2848if gt add at len z0 get wslen 0
2849ret false
2850end
2851for i ulong len z0
2852if ne get wsrc add at i get z0 i
2853ret false
2854end
2855end
2856ret true
2857end
2858
2859fn wmc99 at ulong to bool
2860if gt add at len z2 get wslen 0
2861ret false
2862end
2863for i ulong len z2
2864if ne get wsrc add at i get z2 i
2865ret false
2866end
2867end
2868ret true
2869end
2870
2871fn wmc100 at ulong to bool
2872if gt add at len z5 get wslen 0
2873ret false
2874end
2875for i ulong len z5
2876if ne get wsrc add at i get z5 i
2877ret false
2878end
2879end
2880ret true
2881end
2882
2883fn wmc101 at ulong to bool
2884if gt add at len z6 get wslen 0
2885ret false
2886end
2887for i ulong len z6
2888if ne get wsrc add at i get z6 i
2889ret false
2890end
2891end
2892ret true
2893end
2894
2895fn wmc102 at ulong to bool
2896if gt add at len z7 get wslen 0
2897ret false
2898end
2899for i ulong len z7
2900if ne get wsrc add at i get z7 i
2901ret false
2902end
2903end
2904ret true
2905end
2906
2907fn wmc103 at ulong to bool
2908if gt add at len z10 get wslen 0
2909ret false
2910end
2911for i ulong len z10
2912if ne get wsrc add at i get z10 i
2913ret false
2914end
2915end
2916ret true
2917end
2918
2919fn wmc104 at ulong to bool
2920if gt add at len z11 get wslen 0
2921ret false
2922end
2923for i ulong len z11
2924if ne get wsrc add at i get z11 i
2925ret false
2926end
2927end
2928ret true
2929end
2930
2931fn wmc105 at ulong to bool
2932if gt add at len z12 get wslen 0
2933ret false
2934end
2935for i ulong len z12
2936if ne get wsrc add at i get z12 i
2937ret false
2938end
2939end
2940ret true
2941end
2942
2943fn wmc106 at ulong to bool
2944if gt add at len z13 get wslen 0
2945ret false
2946end
2947for i ulong len z13
2948if ne get wsrc add at i get z13 i
2949ret false
2950end
2951end
2952ret true
2953end
2954
2955fn wtc107 to void
2956for i ulong len z91
2957wb get z91 i
2958end
2959end
2960
2961fn wtc108 to void
2962for i ulong len z50
2963wb get z50 i
2964end
2965end
2966
2967fn wtc109 to void
2968for i ulong len z92
2969wb get z92 i
2970end
2971end
2972
2973fn wtc110 to void
2974for i ulong len z53
2975wb get z53 i
2976end
2977end
2978
2979fn wtc111 to void
2980for i ulong len z54
2981wb get z54 i
2982end
2983end
2984
2985fn wtc112 to void
2986for i ulong len z93
2987wb get z93 i
2988end
2989end
2990
2991fn wtc113 to void
2992for i ulong len z94
2993wb get z94 i
2994end
2995end
2996
2997fn wtc114 to void
2998for i ulong len z95
2999wb get z95 i
3000end
3001end
3002
3003fn wtc115 to void
3004for i ulong len z96
3005wb get z96 i
3006end
3007end
3008
3009fn wtc116 to void
3010for i ulong len z55
3011wb get z55 i
3012end
3013end
3014
3015fn wtc117 to void
3016for i ulong len z97
3017wb get z97 i
3018end
3019end
3020
3021fn wtc118 to void
3022for i ulong len z56
3023wb get z56 i
3024end
3025end
3026
3027fn wtc119 to void
3028for i ulong len z57
3029wb get z57 i
3030end
3031end
3032
3033fn wtc120 to void
3034for i ulong len z58
3035wb get z58 i
3036end
3037end
3038
3039fn wtc121 to void
3040for i ulong len z59
3041wb get z59 i
3042end
3043end
3044
3045fn wtc122 to void
3046for i ulong len z60
3047wb get z60 i
3048end
3049end
3050
3051fn wtc123 to void
3052for i ulong len z61
3053wb get z61 i
3054end
3055end
3056
3057fn wtc124 to void
3058for i ulong len z62
3059wb get z62 i
3060end
3061end
3062
3063fn wtc125 to void
3064for i ulong len z63
3065wb get z63 i
3066end
3067end
3068
3069fn wtc126 to void
3070for i ulong len z64
3071wb get z64 i
3072end
3073end
3074
3075fn wtc127 to void
3076for i ulong len z65
3077wb get z65 i
3078end
3079end