2023-08-21 23:05:02 -04:00
|
|
|
import { answer, Riddle, riddles } from "../../html/find-the-code-together.tsx";
|
2023-08-21 22:00:07 -04:00
|
|
|
|
|
|
|
const render_riddle = ({ riddle, id }: { riddle: string; id: number }) => (
|
2023-08-21 23:05:02 -04:00
|
|
|
`${
|
|
|
|
id == 0
|
|
|
|
? "The answer to this riddle is 10 digits (0-9)."
|
|
|
|
: "All riddles (sans one) have a one letter answer (a-z)."
|
|
|
|
}
|
2023-08-21 22:00:07 -04:00
|
|
|
This is riddle #${id} ${id == 0 ? "(nice job finding this one!)" : ""}
|
|
|
|
${riddle}`
|
|
|
|
);
|
|
|
|
|
|
|
|
const encoder = new TextEncoder();
|
|
|
|
|
|
|
|
async function write_riddle(riddle: Riddle, id: number) {
|
|
|
|
const file = await Deno.open(`/home/mbk/Aims/cohost/static/ftct/${id}.txt`, {
|
|
|
|
write: true,
|
|
|
|
create: true,
|
2023-08-21 23:59:15 -04:00
|
|
|
truncate: true,
|
2023-08-21 22:00:07 -04:00
|
|
|
});
|
|
|
|
file.write(encoder.encode(render_riddle({ ...riddle, id })));
|
|
|
|
file.close();
|
|
|
|
}
|
|
|
|
|
|
|
|
riddles.map(write_riddle);
|
2023-08-21 23:05:02 -04:00
|
|
|
|
|
|
|
const winners: string[] = [];
|
|
|
|
|
|
|
|
const file = await Deno.open(
|
|
|
|
`/home/mbk/Aims/cohost/static/ftct/${answer}.html`,
|
|
|
|
{
|
|
|
|
write: true,
|
|
|
|
create: true,
|
|
|
|
},
|
|
|
|
);
|
|
|
|
file.write(encoder.encode(`
|
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<title>you did it!!!!</title>
|
|
|
|
<style>
|
|
|
|
body {
|
|
|
|
margin: 0 auto;
|
2023-08-29 19:52:50 -04:00
|
|
|
width: min(500px, 96vw);
|
2023-08-21 23:05:02 -04:00
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<h1>Congratulations!!!!</h1>
|
|
|
|
<p>You (plural, I hope) have done well to find this.
|
|
|
|
<p>I have prepared two rewards for everyone who has found this, alone or working together
|
|
|
|
<ol>
|
|
|
|
<li>if you'd like, you can join <a href="https://pyrope.net/mcai">my discord
|
|
|
|
server i created to say "man, computers are incredible" every day</a>, and post
|
|
|
|
proof that you helped find the code (or at least interesting fake proof) in the
|
2023-08-28 17:43:40 -04:00
|
|
|
#ftct channel (you should get access to it pretty quickly (ping @mehbark and ask me if i agree)), and
|
2023-08-21 23:05:02 -04:00
|
|
|
your name will be added to the list below
|
|
|
|
|
2023-08-21 23:17:59 -04:00
|
|
|
<li>you get to be the first ones to see my cohost git repository! here it is: <a
|
|
|
|
href="https://git.pyrope.net/mbk/cohost">https://git.pyrope.net/mbk/cohost</a> i
|
|
|
|
know this is sort of lame, but there's over 2300 lines of typescript JSX, a lot
|
|
|
|
of comments showing my thought processes, and a (decent) git history for you to
|
2023-08-21 23:34:26 -04:00
|
|
|
look through so i hope you'll enjoy it. you probably like cohost, right?
|
2023-08-21 23:05:02 -04:00
|
|
|
</ol>
|
|
|
|
|
|
|
|
winners:
|
|
|
|
<ul>
|
|
|
|
<!-- i'm doing the winners by hand so don't try to be clever -->
|
|
|
|
${winners.map((w) => `<li>${w}`).join("\n")}
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
`));
|