diff options
| author | nsfisis <54318333+nsfisis@users.noreply.github.com> | 2022-04-01 21:00:53 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-01 21:00:53 +0900 |
| commit | 2e1d53370fb2653353ac567bcc5d7c0a4131b86a (patch) | |
| tree | e101e6f95a0208c33183cfa8d31521463fea407d /riddle.php | |
| parent | 5a3823bd20706576187c6eec88df707969e15ebb (diff) | |
| download | PHPerKaigi2022-tokens-2e1d53370fb2653353ac567bcc5d7c0a4131b86a.tar.gz PHPerKaigi2022-tokens-2e1d53370fb2653353ac567bcc5d7c0a4131b86a.tar.zst PHPerKaigi2022-tokens-2e1d53370fb2653353ac567bcc5d7c0a4131b86a.zip | |
Add brainf_ck.php / riddle.php
Diffstat (limited to 'riddle.php')
| -rw-r--r-- | riddle.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/riddle.php b/riddle.php new file mode 100644 index 0000000..c9baa8b --- /dev/null +++ b/riddle.php @@ -0,0 +1,34 @@ +<?php + +/********************************************************* + * This program displays a PHPer token. * + * Guess 'N'. * + * * + * Hints: * + * - N itself has no special meaning, e.g., 42, 8128, * + * it is selected at random. * + * - Each element of $token represents a single letter. * + * - One letter consists of 5x5 cells. * + * - Remember, the output is a complete PHPer token. * + * * + * License: * + * https://creativecommons.org/publicdomain/zero/1.0/ * + *********************************************************/ +const N = 0 /* Change it to your answer. */; +assert(0 <= N && N <= 0b11111_11111_11111_11111_11111); + +$token = [ + 0x14B499C, + 0x0BE34CC, 0x01C9C69, + 0x0ECA069, 0x01C2449, 0x0FDB166, 0x01C9C69, + 0x01C1C66, 0x0FC1C47, 0x01C1C66, + 0x10C5858, 0x1E4E3B8, 0x1A2F2F8, +]; +foreach ($token as $x) { + $x = $x ^ N; + + $x = sprintf('%025b', $x); + $x = str_replace(search: ['0', '1'], replace: [' ', '#'], subject: $x); + $x = implode("\n", str_split($x, length: 5)); + echo "{$x}\n\n"; +} |
