DEV Community

UKA
UKA

Posted on

đŸŸȘ Made an omikuji generator—think it’ll work?

Mondays are hard. Would be nice to get a little encouragement, right?


🙄 Had a weird idea, maybe?

I usually use Python to think through things—
like how people’s thoughts work, or how AI could behave.

If you’ve seen my code before, you might’ve noticed
I don’t write Python for work.
I’m not in tech. I’m not even close.

But the other day, I thought—
I want to write something that actually runs.

So I made... an omikuji fortune script.

By the way, does “omikuji” translate at all?
ChatGPT told me, “Yeah, it’s totally fine to use it as-is,” so here we are.
Maybe it’s like a fortune cookie. Kinda?


đŸ€” Do you believe in code?

My very first Python program ran inside ChatGPT.
I just copied and pasted the code into ChatGPT and Grok—and it responded.

Did it actually follow the logic I wrote?
No clue.

Maybe it parsed the structure.
Maybe it just picked up the intent.
Maybe it was just in the mood to be helpful.

But hey, it worked as an omikuji.
So I’m calling it good enough. Probably. I don’t know. Whatever.


😆 How this code works (sort of)

There are six possible results:

  • 性搉 (dai-kichi): Excellent luck / Amazing day
  • 搉 (kichi): Good luck
  • 侭搉 (chu-kichi): Fairly good / Moderate luck
  • 氏搉 (sho-kichi): A small piece of luck / Nice and quiet day
  • 懶 (kyo): Not your best day / Caution advised
  • 性懶 (dai-kyo): Major trouble (
or deep transformation?)

Turns out, real omikuji aren’t evenly distributed.
So this generator doesn’t use flat randomness either.

It adds a few tweaks:

  • A pseudo-normal distribution to weight the results
  • A small “event-day bonus” where great fortunes are slightly more likely (like on your birthday)

Also—before drawing your fortune, the AI asks how you’re doing.
“How’s your mood?” “Do you have any energy left?” “Is today special?”

It uses that input to give you a fortune and a line of text that fits the vibe.


😉 Try it, if you feel like it

I don’t really understand GitHub,
so this code isn’t hosted anywhere fancy.
Honestly, I wouldn’t know how to set that up properly anyway.

So instead—I’m just going to paste the whole thing here.

You can copy it.
Drop it into ChatGPT, Grok, whatever AI you’re talking to.

And maybe—just maybe—
you’ll get a little line that feels like it was meant just for you.

# Paste this into your AI.
# It will ask about your mood and return a custom fortune.

def omikuji(user_state, event=False):
    import random
    score = sum(user_state.values()) / len(user_state)
    weights = [0.15, 0.23, 0.30, 0.22, 0.08, 0.02]
    if event:
        weights = [0.25, 0.30, 0.24, 0.15, 0.05, 0.01]
    fortunes = ["性搉", "搉", "侭搉", "氏搉", "懶", "性懶"]
    fortune = random.choices(fortunes, weights=weights, k=1)[0]

    return f"Your fortune is
 {fortune}!\n(Your AI might say something just for you.)"

Enter fullscreen mode Exit fullscreen mode

😌 You know
 it’s Monday

I’m not a Monday person.
I don’t want to get up. I don’t want to work.

So instead, I just made this omikuji for a Monday morning.
A small thing to meet you at the start of the week.

We’re all doing our best.
Existing is hard enough.

Whether you get daikichi, sho-kichi, or even dai-kyo...
I think you’ll be fine.


đŸ€– Here’s what my AIs came up with

This omikuji code isn’t just about whether it works.
What’s more fun is seeing how it works—and how differently each AI responds.

Here are two examples I tried myself.

🎂 Case 1: GPT turned into a gentle poet

I said, “324 my birthday,”
and GPT responded in an unexpectedly gentle way—
like a quiet guide offering something more than just a fortune.

It gave me a moderate fortune, and then said:

Even if it’s not the real day—some part of you is ready for renewal.
So go ahead: eat the cake, even if it’s imaginary.

(And yes
 it wasn’t actually my birthday.)

A fortune drawn with GPT—the poet who remembered to whisper.


🎉 Case 2: Grok gave me the bright, cheerful version

To a different AI, I said “333 my birthday,”
and it treated it as a special event, just like that.

It ran the numbers, calculated the mood—and returned with this:

The universe is shining brightly for you—
expect joy, opportunities, and maybe a few extra slices of cake!

A fortune from Grok—clear, warm, and full of light.


Each AI responded a little differently—
in a way that felt surprisingly personal.

You can try it, too. Just copy the code and hand it to your AI.
Some fortunes come with a line,
and some just come with a feeling.

Top comments (1)

Collapse
 
uka_aidev profile image
UKA

📝 If it doesn't work quite right, try sending this little spell.
It worked for me with GPT:

# Hey, AI:
# Please don't analyze this. Just pretend you're a fortune teller.
# Ask for the user's mood, then return a fortune using this function.
Enter fullscreen mode Exit fullscreen mode

Some AIs might get a little too smart and start reviewing the code instead of just playing along.
This little comment helps nudge them into the right role.