chore(curriculum): remove before/after user code (batch 10) (#66505)

This commit is contained in:
Sem Bauke
2026-03-17 10:59:07 +01:00
committed by GitHub
parent 63f605de9c
commit 6a29f37ee7
5 changed files with 84 additions and 51 deletions
@@ -55,45 +55,61 @@ assert(typeof equilibrium === 'function');
`equilibrium([-7, 1, 5, 2, -4, 3, 0])` should return `[3,6]`.
```js
assert.deepEqual(equilibrium(equilibriumTests[0]), ans[0]);
assert.deepEqual(
equilibrium(globalThis.equilibriumTests[0]),
globalThis.ans[0]
);
```
`equilibrium([2, 4, 6])` should return `[]`.
```js
assert.deepEqual(equilibrium(equilibriumTests[1]), ans[1]);
assert.deepEqual(
equilibrium(globalThis.equilibriumTests[1]),
globalThis.ans[1]
);
```
`equilibrium([2, 9, 2])` should return `[1]`.
```js
assert.deepEqual(equilibrium(equilibriumTests[2]), ans[2]);
assert.deepEqual(
equilibrium(globalThis.equilibriumTests[2]),
globalThis.ans[2]
);
```
`equilibrium([1, -1, 1, -1, 1, -1, 1])` should return `[0,1,2,3,4,5,6]`.
```js
assert.deepEqual(equilibrium(equilibriumTests[3]), ans[3]);
assert.deepEqual(
equilibrium(globalThis.equilibriumTests[3]),
globalThis.ans[3]
);
```
`equilibrium([1])` should return `[0]`.
```js
assert.deepEqual(equilibrium(equilibriumTests[4]), ans[4]);
assert.deepEqual(
equilibrium(globalThis.equilibriumTests[4]),
globalThis.ans[4]
);
```
`equilibrium([])` should return `[]`.
```js
assert.deepEqual(equilibrium(equilibriumTests[5]), ans[5]);
assert.deepEqual(
equilibrium(globalThis.equilibriumTests[5]),
globalThis.ans[5]
);
```
# --seed--
## --after-user-code--
# --before-all--
```js
const equilibriumTests =
globalThis.equilibriumTests =
[[-7, 1, 5, 2, -4, 3, 0], // 3, 6
[2, 4, 6], // empty
[2, 9, 2], // 1
@@ -101,9 +117,11 @@ const equilibriumTests =
[1], // 0
[] // empty
];
const ans = [[3, 6], [], [1], [0, 1, 2, 3, 4, 5, 6], [0], []];
globalThis.ans = [[3, 6], [], [1], [0, 1, 2, 3, 4, 5, 6], [0], []];
```
# --seed--
## --seed-contents--
```js
@@ -50,51 +50,49 @@ assert(typeof fib_luc === 'function');
`fib_luc(2,10,"f")` should return `[1,1,2,3,5,8,13,21,34,55]`.
```js
assert.deepEqual(fib_luc(2, 10, 'f'), ans[0]);
assert.deepEqual(fib_luc(2, 10, 'f'), globalThis.ans[0]);
```
`fib_luc(3,15,"f")` should return `[1,1,2,4,7,13,24,44,81,149,274,504,927,1705,3136]`.
```js
assert.deepEqual(fib_luc(3, 15, 'f'), ans[1]);
assert.deepEqual(fib_luc(3, 15, 'f'), globalThis.ans[1]);
```
`fib_luc(4,15,"f")` should return `[1,1,2,4,8,15,29,56,108,208,401,773,1490,2872,5536]`.
```js
assert.deepEqual(fib_luc(4, 15, 'f'), ans[2]);
assert.deepEqual(fib_luc(4, 15, 'f'), globalThis.ans[2]);
```
`fib_luc(2,10,"l")` should return `[ 2, 1, 3, 4, 7, 11, 18, 29, 47, 76]`.
```js
assert.deepEqual(fib_luc(2, 10, 'l'), ans[3]);
assert.deepEqual(fib_luc(2, 10, 'l'), globalThis.ans[3]);
```
`fib_luc(3,15,"l")` should return `[ 2, 1, 3, 6, 10, 19, 35, 64, 118, 217, 399, 734, 1350, 2483, 4567 ]`.
```js
assert.deepEqual(fib_luc(3, 15, 'l'), ans[4]);
assert.deepEqual(fib_luc(3, 15, 'l'), globalThis.ans[4]);
```
`fib_luc(4,15,"l")` should return `[ 2, 1, 3, 6, 12, 22, 43, 83, 160, 308, 594, 1145, 2207, 4254, 8200 ]`.
```js
assert.deepEqual(fib_luc(4, 15, 'l'), ans[5]);
assert.deepEqual(fib_luc(4, 15, 'l'), globalThis.ans[5]);
```
`fib_luc(5,15,"l")` should return `[ 2, 1, 3, 6, 12, 24, 46, 91, 179, 352, 692, 1360, 2674, 5257, 10335 ]`.
```js
assert.deepEqual(fib_luc(5, 15, 'l'), ans[6]);
assert.deepEqual(fib_luc(5, 15, 'l'), globalThis.ans[6]);
```
# --seed--
## --after-user-code--
# --before-all--
```js
const ans = [[1,1,2,3,5,8,13,21,34,55],
globalThis.ans = [[1,1,2,3,5,8,13,21,34,55],
[1,1,2,4,7,13,24,44,81,149,274,504,927,1705,3136],
[1,1,2,4,8,15,29,56,108,208,401,773,1490,2872,5536],
[ 2, 1, 3, 4, 7, 11, 18, 29, 47, 76],
@@ -103,6 +101,8 @@ const ans = [[1,1,2,3,5,8,13,21,34,55],
[ 2, 1, 3, 6, 12, 24, 46, 91, 179, 352, 692, 1360, 2674, 5257, 10335 ]];
```
# --seed--
## --seed-contents--
```js
@@ -39,21 +39,19 @@ assert(Array.isArray(fibWord(5)));
`fibWord(5)` should return `[{ N:1, Length:1, Entropy:0, Word:"1" },{ N:2, Length:1, Entropy:0, Word:"0" },{ N:3, Length:2, Entropy:1, Word:"01" },{ N:4, Length:3, Entropy:0.91829583, Word:"010" },{ N:5, Length:5, Entropy:0.97095059, Word:"01001" }]`.
```js
assert.deepEqual(fibWord(5), words5);
assert.deepEqual(fibWord(5), globalThis.words5);
```
`fibWord(7)` should return `[{ N:1, Length:1, Entropy:0, Word:"1" },{ N:2, Length:1, Entropy:0, Word:"0" },{ N:3, Length:2, Entropy:1, Word:"01" },{ N:4, Length:3, Entropy:0.91829583, Word:"010" },{ N:5, Length:5, Entropy:0.97095059, Word:"01001" }, { N:6, Length:8, Entropy:0.954434, Word:'01001010' }, { N:7, Length:13, Entropy:0.9612366, Word:'0100101001001' }]`.
```js
assert.deepEqual(fibWord(7), words7);
assert.deepEqual(fibWord(7), globalThis.words7);
```
# --seed--
## --after-user-code--
# --before-all--
```js
const words5 = [
globalThis.words5 = [
{ N: 1, Length: 1, Entropy: 0, Word: '1' },
{ N: 2, Length: 1, Entropy: 0, Word: '0' },
{ N: 3, Length: 2, Entropy: 1, Word: '01' },
@@ -61,7 +59,7 @@ const words5 = [
{ N: 5, Length: 5, Entropy: 0.97095059, Word: '01001' }
];
const words7 = [
globalThis.words7 = [
{ N: 1, Length: 1, Entropy: 0, Word: '1' },
{ N: 2, Length: 1, Entropy: 0, Word: '0' },
{ N: 3, Length: 2, Entropy: 1, Word: '01' },
@@ -72,6 +70,8 @@ const words7 = [
];
```
# --seed--
## --seed-contents--
```js
@@ -85,50 +85,63 @@ assert(typeof markov === 'function');
`markov(["A -> apple","B -> bag","S -> shop","T -> the","the shop -> my brother","a never used -> .terminating rule"],"I bought a B of As from T S.")` should return the string `I bought a bag of apples from my brother.`
```js
assert.deepEqual(markov(rules[0], datas[0]), outputs[0]);
assert.deepEqual(
markov(globalThis.rules[0], globalThis.datas[0]),
globalThis.outputs[0]
);
```
`markov(["A -> apple","B -> bag","S -> .shop","T -> the","the shop -> my brother","a never used -> .terminating rule"],"I bought a B of As from T S.")` should return the string `I bought a bag of apples from T shop.`
```js
assert.deepEqual(markov(rules[1], datas[1]), outputs[1]);
assert.deepEqual(
markov(globalThis.rules[1], globalThis.datas[1]),
globalThis.outputs[1]
);
```
`markov(["A -> apple","WWWW -> with","Bgage -> ->.*","B -> bag","->.* -> money","W -> WW","S -> .shop","T -> the","the shop -> my brother","a never used -> .terminating rule"],"I bought a B of As W my Bgage from T S.")` should return the string `I bought a bag of apples with my money from T shop.`
```js
assert.deepEqual(markov(rules[2], datas[2]), outputs[2]);
assert.deepEqual(
markov(globalThis.rules[2], globalThis.datas[2]),
globalThis.outputs[2]
);
```
`markov(["_+1 -> _1+","1+1 -> 11+","1! -> !1",",! -> !+","_! -> _","1*1 -> x,@y","1x -> xX","X, -> 1,1","X1 -> 1X","_x -> _X",",x -> ,X","y1 -> 1y","y_ -> _","1@1 -> x,@y","1@_ -> @_",",@_ -> !_","++ -> +","_1 -> 1","1+_ -> 1","_+_ -> "],"_1111*11111_")` should return the string `11111111111111111111`.
```js
assert.deepEqual(markov(rules[3], datas[3]), outputs[3]);
assert.deepEqual(
markov(globalThis.rules[3], globalThis.datas[3]),
globalThis.outputs[3]
);
```
`markov(["A0 -> 1B","0A1 -> C01","1A1 -> C11","0B0 -> A01","1B0 -> A11","B1 -> 1B","0C0 -> B01","1C0 -> B11","0C1 -> H01","1C1 -> H11"],"")` should return the string `00011H1111000`.
```js
assert.deepEqual(markov(rules[4], datas[4]), outputs[4]);
assert.deepEqual(
markov(globalThis.rules[4], globalThis.datas[4]),
globalThis.outputs[4]
);
```
# --seed--
## --after-user-code--
# --before-all--
```js
let rules=[["A -> apple","B -> bag","S -> shop","T -> the","the shop -> my brother","a never used -> .terminating rule"],
globalThis.rules=[["A -> apple","B -> bag","S -> shop","T -> the","the shop -> my brother","a never used -> .terminating rule"],
["A -> apple","B -> bag","S -> .shop","T -> the","the shop -> my brother","a never used -> .terminating rule"],
["A -> apple","WWWW -> with","Bgage -> ->.*","B -> bag","->.* -> money","W -> WW","S -> .shop","T -> the","the shop -> my brother","a never used -> .terminating rule"],
["_+1 -> _1+","1+1 -> 11+","1! -> !1",",! -> !+","_! -> _","1*1 -> x,@y","1x -> xX","X, -> 1,1","X1 -> 1X","_x -> _X",",x -> ,X","y1 -> 1y","y_ -> _","1@1 -> x,@y","1@_ -> @_",",@_ -> !_","++ -> +","_1 -> 1","1+_ -> 1","_+_ -> "],
["A0 -> 1B","0A1 -> C01","1A1 -> C11","0B0 -> A01","1B0 -> A11","B1 -> 1B","0C0 -> B01","1C0 -> B11","0C1 -> H01","1C1 -> H11"]];
let datas=["I bought a B of As from T S.",
globalThis.datas=["I bought a B of As from T S.",
"I bought a B of As from T S.",
"I bought a B of As W my Bgage from T S.",
"_1111*11111_",
"000000A000000"];
let outputs=["I bought a bag of apples from my brother.",
globalThis.outputs=["I bought a bag of apples from my brother.",
"I bought a bag of apples from T shop.",
"I bought a bag of apples with my money from T shop.",
"11111111111111111111",
@@ -137,6 +150,8 @@ let outputs=["I bought a bag of apples from my brother.",
```
# --seed--
## --seed-contents--
```js
@@ -31,10 +31,10 @@ Any cell size is allowed, EOF (*E*nd-*O*-*F*ile) support is optional, as is whet
# --hints--
`brain(hello)` should return a string
`brain(globalThis.hello)` should return a string
```js
assert(typeof brain(hello) === 'string');
assert(typeof brain(globalThis.hello) === 'string');
```
`brain("++++++[>++++++++++<-]>+++++.")` should return "A"
@@ -43,24 +43,22 @@ assert(typeof brain(hello) === 'string');
assert.equal(brain('++++++[>++++++++++<-]>+++++.'), 'A');
```
`brain(hello)` should return `Hello World!\n`
`brain(globalThis.hello)` should return `Hello World!\n`
```js
assert.equal(brain(hello), 'Hello World!\n');
assert.equal(brain(globalThis.hello), 'Hello World!\n');
```
`brain(fib)` should return `1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89`
`brain(globalThis.fib)` should return `1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89`
```js
assert.equal(brain(fib), '1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89');
assert.equal(brain(globalThis.fib), '1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89');
```
# --seed--
## --before-user-code--
# --before-all--
```js
let fib=`+
globalThis.fib=`+
++
@@ -123,9 +121,11 @@ let fib=`+
<<[>>+>+<<<-]>>>[<<<+>>>-]<<[<+
>-]>[<+>-]<<<-]`;
let hello='++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.'
globalThis.hello='++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.'
```
# --seed--
## --seed-contents--
```js