From d5ad87d9156f027bab8fe7fc0e792bf8ab413367 Mon Sep 17 00:00:00 2001 From: Mainak Debnath <55401423+mainak-debnath@users.noreply.github.com> Date: Fri, 22 Jan 2021 07:56:06 +0530 Subject: [PATCH] fix(learn): put test cases under --seed-- and remove them from the solution (#40755) * fix: put test cases under --seed-- * fix: put test cases under --seed-- --- .../execute-a-markov-algorithm.md | 40 +++++++++++-------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/curriculum/challenges/english/10-coding-interview-prep/rosetta-code/execute-a-markov-algorithm.md b/curriculum/challenges/english/10-coding-interview-prep/rosetta-code/execute-a-markov-algorithm.md index 098c899cc8..3b1953376a 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/rosetta-code/execute-a-markov-algorithm.md +++ b/curriculum/challenges/english/10-coding-interview-prep/rosetta-code/execute-a-markov-algorithm.md @@ -212,6 +212,29 @@ assert.deepEqual(markov(rules[4], tests[4]), outputs[4]); # --seed-- +## --after-user-code-- + +```js + +let 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 tests=["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.", + "I bought a bag of apples from T shop.", + "I bought a bag of apples with my money from T shop.", + "11111111111111111111", + "00011H1111000"] + +``` + + ## --seed-contents-- ```js @@ -250,21 +273,4 @@ function markov(rules,test) { } return test; } - -// tail: -let 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 tests=["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.", - "I bought a bag of apples from T shop.", - "I bought a bag of apples with my money from T shop.", - "11111111111111111111", - "00011H1111000"]; ```