Solve View

Hello, Parity!

Print “Hello, World!”.

Bytes of the solution must alternate from even to odd, starting with even. That is, ord(s[0])%2==0, ord(s[1])%2==1, and so on.

Judge

(async function*(context: Context): Challenge {
    yield (await context.run()).assertEquals("Hello, World!").setName("Helllo, World! output");
    const obeysParity = new TextEncoder().encode(context.code).every((byte, i) => byte % 2 === i % 2);
    yield context.registerTestCase(new TestCase("Parity", obeysParity ? "Pass":"Fail", {"Diff": {"expected": new TextEncoder().encode(context.code).map((byte, i) => i % 2).join(""), "output": new TextEncoder().encode(context.code).map((byte, i) => byte % 2).join("")}}));
    return context.noFailures();
})

Example Code

 eval	('bcb' [2/2] + 'bob' [2/2] + 'nan' [2-2] + 'bsb' [2/2] + 'bob' [2/2] + 'lal' [2-2] + 'beb' [2/2] + '.a.' [2-2] + 'lal' [2-2] + 'bob' [2/2] + 'bgb' [2/2] + '(a(' [2-2] + '"a"' [2-2] + 'HaH' [2-2] + 'beb' [2/2] + 'lal' [2-2] + 'lal' [2-2] + 'bob' [2/2] + ',a,' [2-2] + ' a ' [2-2] + 'bWb' [2/2] + 'bob' [2/2] + 'rar' [2-2] + 'lal' [2-2] + 'dad' [2-2] + 'b!b' [2/2] + '"a"' [2-2] + 'b)b' [2/2] )

Comments