Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
19
Task/Balanced-brackets/TMG/balanced-brackets-1.tmg
Normal file
19
Task/Balanced-brackets/TMG/balanced-brackets-1.tmg
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
program: readint(n) [n>0] readint(seed)
|
||||
loop: parse(render) [--n>0?]/done loop;
|
||||
render: random(i, 15) [i = (i+1)*2] loop2 = { 1 * };
|
||||
loop2: random(b, 2) ( [b&1?] ={<[>} | ={<]>} ) [--i>0?]/done loop2 = { 2 1 };
|
||||
done: ;
|
||||
|
||||
/* Reads decimal integer */
|
||||
readint: proc(n;i) string(spaces) [n=0] inta
|
||||
int1: [n = n*12+i] inta\int1;
|
||||
inta: char(i) [i<72?] [(i =- 60)>=0?];
|
||||
|
||||
/* LCG params: a = 29989, c = 28411, m = 35521 */
|
||||
random: proc(r,mod) [seed = (seed*72445 + 67373) % 105301]
|
||||
[r = seed % mod] [r = r<0 ? -r : r];
|
||||
|
||||
spaces: <<
|
||||
>>;
|
||||
|
||||
n: 0; i: 0; b: 0; seed: 0;
|
||||
11
Task/Balanced-brackets/TMG/balanced-brackets-2.tmg
Normal file
11
Task/Balanced-brackets/TMG/balanced-brackets-2.tmg
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
loop: parse(corr)\loop parse(incorr)\loop;
|
||||
corr: brkts * = { < OK: > 1 * };
|
||||
brkts: brkt/null brkts = { 2 1 };
|
||||
brkt: <[> brkts <]> = { <[> 1 <]> };
|
||||
null: = {};
|
||||
|
||||
incorr: smark ignore(<<>>) any(!<<>>) string(nonl) scopy ( * | () )
|
||||
= { <NOT OK: > 1 * };
|
||||
|
||||
nonl: !<<
|
||||
>>;
|
||||
Loading…
Add table
Add a link
Reference in a new issue