import { Main, randirect } from "./common.tsx";
import { render } from "preact-render-to-string";

// 0 will be hidden (but it will be obvious that that is a thing, i don't think
// it will be hard to find)
// redirect to what!??!?!?!?!?!??!?!

export type Riddle = { riddle: string; answer: string };
// TODO: vet
export const riddles: Riddle[] = [
    {
        riddle: btoa(
            btoa(
                `HIGH IN THE AREA THERE IS FOUND A PLACE OF PEACE AND TRANQUILITY. YOU APPROACH. YOU DO NOT REMEMBER WHO YOU ARE. YOU DO NOT REMEMBER WHAT IS THAT IT IS THAT IT WOULD BE FOR YOU TO REMEMBER. YOU ARRIVE. IT ALL COMES RUSHING BACK THROUGH YOU. YOU DO NOT REMEMBER. ${btoa(
                    btoa(
                        "YOU SEE BLANKNESS MIND NUMBING BLANKNESS BLANK BLANK THERE IS NAUGHT NAUGHT."
                    )
                )} .... SHE TELLS YOU THE LAST NUMBER IS ONE. YOU KNOW THAT BEFORE THAT THERE MUST BE ${btoa(
                    btoa(
                        btoa(
                            "HALF. THERE MUST BE HALF. SCORE. THERE MUST BE. HALF SCORE."
                        )
                    )
                )} A DEEP, SELF-PROCLAIMED WHOLESOME ENERGY OVERTAKES YOU. YOU SENSE THAT, EVEN BEFORE THAT, THERE MUST BE SOMETHING NICE. WHAT IS LEFT IS ${btoa(
                    btoa(btoa(btoa(btoa(btoa(btoa("bad luck"))))))
                )}`
            )
        ),
        // forgot 42 oof
        answer: "0041369101",
    },
    {
        riddle: "With today's megadigigraphics, many games have three of these",
        answer: "d",
    },
    { riddle: "A man in half-life", answer: "g" },
    { riddle: "I'm a number that comes after nine. What am I?", answer: "a" },
    {
        riddle: "I'm sot of shy, so I'm not in this one. It was just a lot of pessue, and I'm not getting paid at all so",
        answer: "r",
    },
    {
        riddle: "Jerry seinfeld liked these, at least at some point",
        answer: "b",
    },
    {
        riddle: "I'm the sound a long series of Os makes (like in Joooooooooooooooooohn)",
        answer: "u",
    },
    {
        riddle: "Formerly twitter, currently suffering an elongated death",
        answer: "x",
    },
    {
        riddle: "I'm a rareish letter you relish writing in Coq's proof mode",
        answer: "q",
    },
    { riddle: "I'm, like, a super popular letter", answer: "e" },
    {
        riddle: "Were I uppercase, you could make me into sunglasses or teeth (or both at the same time!)",
        answer: "b",
    },
    {
        riddle: "I'm the name of the identity function in the SKI combinator calculus",
        answer: "i",
    },
    {
        riddle: "You can put like a boat on it. Also, you can it the it",
        answer: "c",
    },
    {
        riddle: "I'm a vowel that describes how to pronounce itself. I'm also the sound you'll make when you figure it out",
        answer: "o",
    },
    { riddle: "OMG THIS IS SO GROSS WHY IS THERE A POTTY WORD", answer: "p" },
    {
        riddle: "How the type of undefined is usually displayed in haskell",
        answer: "a",
    },
    {
        riddle: "Arguably, the real main character of Vriska. Okay, I'm keeping that typo, but I really meant Homestuck. Don't overthink this one",
        answer: "u",
    },
    {
        riddle: "I'm a super cool combinator that, unfortunately, has been subsumed in google (and wikipedia!) by some weird capitalism thing",
        answer: "y",
    },
    {
        riddle: "What was the sixth letter of my username again?",
        answer: "r",
    },
    {
        riddle: "I'm Z. Oops. Definitely wasn't supposed to just outright say that. My bad.",
        answer: "z",
    },
    {
        riddle: "The first letter of the last name of my favorite Homestuck troll",
        answer: "p",
    },
];

export const answer = riddles.map(r => r.answer).join("");

console.log(answer);
// assert in ohio be like XD
if (answer.length != 30) throw `dude ${answer.length}`;

console.log(
    render(
        <Main>
            <a
                href={randirect(
                    ...riddles
                        .slice(1)
                        .map(
                            (_, i) =>
                                `https://static.pyrope.net/ftct/${i + 1}.txt`
                        )
                )}
                class="get-clue"
            >
                get a random clue to try!
            </a>
            <a
                href="https://static.pyrope.net/ftct/attempt.html"
                class="attempt"
            >
                see if you have the right answer
            </a>
        </Main>
    )
);
