Broken shift key
Oh no! I have a coding interview and my keyboard’s shift key is stuck down! The characters I can use are [a-zA-Z~!@#$%^&*(){}|+?"<>:_\r\n ]
(I can type lowercase with the caps lock key). It’s hard to write code without an equal sign, but my interviewer will be really impressed when I find a way!
Print the first 20 tribonacci numbers. The tribonacci numbers are defined by T(0) = T(1) = 0, T(2) = 1, and T(i+3) = T(i+2) + T(i+1) + T(i).
Judge
(async function*(context: Context): Challenge { const didYouTryToCheat = /[^a-zA-Z~!@#$%^&*(){}|+?"<>:_\r\n ]/.exec(context.code); yield context.registerTestCase(new TestCase("Shift key is stuck", didYouTryToCheat ? "Fail" : "Pass", {"Text": "You can't type '" + didYouTryToCheat?.[0] + "' with the shift key stuck down"})); const someRandomSequenceToMakeTheChallengeInteresting = [ 0, 0, 1, 1, 2, 4, 7, 13, 24, 44, 81, 149, 274, 504, 927, 1705, 3136, 5768, 10609, 19513]; yield (await context.run(undefined)).assertEquals(someRandomSequenceToMakeTheChallengeInteresting.join("\n")); return context.noFailures(); })
Example Code
eval(unescape("%"+~(+~{}+~{}+~{}+~{}+~{}+~{}+~{})+~(+~{}+~{})+"%"+~(+~{}+~{}+~{}+~{})+"d"+"%"+~(+~{}+~{}+~{}+~{}+~{}+~{}+~{})+~(+~{}+~{}+~{})+"%"+~(+~{}+~{}+~{}+~{})+"d"+"%"+~(+~{}+~{}+~{}+~{})+~(+~{})+"%"+~(+~{})+"a"+"%"+~(+~{}+~{}+~{}+~{}+~{}+~{}+~{})+~(+~{}+~{}+~{}+~{})+"%"+~(+~{}+~{}+~{}+~{})+"d"+"%"+~(+~{}+~{}+~{}+~{})+~(+~{}+~{})+"%"+~(+~{})+"a"+"%"+~(+~{}+~{}+~{}+~{}+~{}+~{}+~{})+~(+~{}+~{}+~{}+~{}+~{}+~{}+~{})+"%"+~(+~{}+~{}+~{}+~{}+~{}+~{}+~{})+"f"+"%"+~(+~{}+~{}+~{}+~{}+~{}+~{}+~{}+~{})+~(+~{}+~{}+~{})+"%"+~(+~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