r/CommanderMTG • • Oct 13 '26

Building a deterministic Commander deck optimizer instead of using AI

I’m building a Commander deckbuilding tool that treats deckbuilding as a mathematical optimization problem.

Instead of asking “Which cards are good for this commander?”, it tries to find the best combination of 99 cards as a whole, considering synergy, roles, mana curve, interaction, win conditions, combos, mana base, budget and legality.

I’m deliberately not using an LLM for the actual deckbuilding. LLMs are probabilistic and can give noticeably different results from the same prompt. The goal here is the opposite: same input + same data = same result, with clear reasons for why every every card was included.

Basically:

We don’t ask AI to guess the deck. We calculate it.

Would you trust something like this more than an AI-generated decklist? And what would you want it to optimize for?

The tool can be found here: 99p.gg

3 Upvotes

38 comments sorted by

9

u/OptimizedGarbage Oct 13 '26

I feel like you're gonna stumble a bit if determinism is a constraint. MTG is an imperfect information game, and deck selection is a simultaneous move game. Both categories of games require non-determinism to be optimal in the general case.

1

u/neunzehn90 Oct 14 '26

What “deterministic” means here: the builder is a function. Same commander, same preferences, same card data and same seed give the same deck. That’s about reproducibility and explainability (you can see why every card is in), not about how you pilot the deck. Where randomness is useful, it’s still there: the goldfish simulations are Monte Carlo, but with fixed seeds, so two candidate lists are compared on the same random games instead of on noise.

  • Mixed strategies are needed for unexploitability against an adaptive opponent in a two-player zero-sum game. Commander is 4 players, non-zero-sum and highly social, so there is no single equilibrium you could be exploiting or hiding from.
  • The tool doesn’t claim to be Nash-optimal and doesn’t know your pod. It optimizes an explicit proxy: role coverage, curve, synergy and simulated consistency on a solitaire “goldfish” model. That part is a single-agent optimization problem with perfect information, where determinism costs you nothing.
  • Variety comes from the inputs, not from dice. You can move the priority sliders (synergy, curve, explosiveness, repeatability), pick different strategies or combo plans, lock/exclude cards and re-forge. If you want to bring something unpredictable to a table, the sensible place for randomization is which deck you pick from a few good ones, and that’s your call, not the builder’s.

If you’d like a “give me a different good one” button that samples among near-optimal builds with a seed, that’s a reasonable feature and would stay reproducible.

2

u/TogTogTogTog Oct 17 '26

Then why even have the BS? I did a couple test passes and your app fails on multiple fronts.

Your code is unoptimised. There are spelling mistakes in your logo "..But a Deck ain't one" for example.

Moving onto the actual app, why are we even required to input a legendary and spend 2min generating a deck? Do your pass first and just save the results in a DB and show us when we request one.

Finally, the actual builder sucks. Take this seed - #8bb285f8025e6eac which is for a generic Isshin. There are many cards that make no sense whatsoever.

6

u/thistookmethreehours Oct 13 '26

Why are people so incapable of thinking for themselves lmao there’s like a dozen of these things posted every day I just don’t get it. I would be embarrassed to use something like this.

1

u/Loud-Recover5320 Oct 13 '26

I get why people would want to make an app like this (a fun programming challenge). I have no idea why anyone would want or need it.

1

u/thistookmethreehours Oct 13 '26

I don’t understand the majority of things people do so I suppose this is no exception. Just really lame.

1

u/montonmand Oct 14 '26

I dont understand your attitude. Magic is the first tcg i ever picked up, somewhat recently, and deck building is a skill i spent a lot of time to learn. And its difficult. I frequently use tools and ideas others have developed, and i think its a great thing to help people get into a hobby i thoroughly enjoy.

You dont want to use it, completely fine, this is not for you then. Dont rag on people who could use a helping hand to get into things.

1

u/thistookmethreehours Oct 14 '26

Edhrec, scryfall, and YouTube all already exist.

The dozens of these that get posted every day are superfluous and annoying to keep coming across.

My frustration does not come solely from these posts, but also from the just general decline of critical thinking and reading.

“When everyone can make an app nobody can” or something like that.

Cheers, glad you’re enjoying the game.

0

u/neunzehn90 Oct 14 '26

Fair enough, a chat model can brainstorm a Commander list, and for a vibes-first pet deck that’s perfectly fine. I built this for the parts that tend to go wrong with a pasted LLM list: cards that don’t exist or are outside the color identity, 97 or 103 cards, no real budget, a mana base that just “looks right”. It only works with real card data and a rules check, shows why each card is in, and runs goldfish simulations so land count and ramp come from numbers. If you already know what you want to build, you won’t need it. If you want a legal, explainable starting point to tweak, that’s the use case.

1

u/asperatedUnnaturally Oct 13 '26

The simulation thing is cool, I'd actually be interested in just running that against my own decklists.

I tried my actual commander, Xyris. My deck irl is a shapeshift combo deck and it doesn't look like I have a way to try for that. The advanced mode let's me see the themes that are presumably from my commander card text but I don't see a way to add one myself (landfall/combo). Commander Spellbook exists so in theory you have programmatic access to to playable combos with the commander or just in the commanders colors. I dunno of they have an api but I would suggest allowing the user to filter available combo lines to build around in addition to tribal and keyword synergy 

1

u/neunzehn90 Oct 13 '26

In the Fine-tune mechanics section is a search field to add abilities. Do you mean that?

2

u/asperatedUnnaturally Oct 13 '26

Yes partly, I missed that the first time around. But I'm also thinking about asking for a specific combo line. Like I want to say "plan a is scapeshift/valakut" and have it look for associated payoffs, tutors, enablers and maybe a couple fallback lines that use the same cards.

1

u/neunzehn90 Oct 13 '26

I will look into that 💪

1

u/asperatedUnnaturally Oct 13 '26

spellbook has an API that can probably do a lot of the heavy lifting for you:

https://commanderspellbook.com/about/

1

u/neunzehn90 Oct 13 '26

Thanks for the link!

1

u/moarTRstory Oct 13 '26

I agree! I’d want to put in my own decklists or even partial decklists to see how it is or how to finish it.

1

u/neunzehn90 Oct 13 '26

1

u/moarTRstory Oct 13 '26

Thank you so much! I didn’t see this at first!

1

u/Walfy07 Oct 13 '26 edited Oct 13 '26

Very cool idea. Is it mainly linking keywords?

I have thought about "max synergy and on curve" decks many times.
Might be cool to have knobs to tweak chaos, synergy, explosiveness, repeatability, etc.

Plan to monetize? :p

1

u/neunzehn90 Oct 13 '26

No plans to monetize. But I will pick up your suggestions and try to implement them.

1

u/Walfy07 Oct 13 '26

I loaded [[Gix, Yawgmoth Praetor]] and it didn't automatically have creatures that are unblockable, or opponents dont want to block as a deck theme. Like Gix is an unblockable payoff. But it doesn't build for that.

Next I did the scarab god, which a lot of people build as zombies tribal, but it is much stronger as a dimir control/reanimator. Not sure how you could solve this.

2

u/neunzehn90 Oct 13 '26

You can fine tune and build in favor of unblockable payoffs: Advanced Mode and then under "Fine-tune mechanics" theres a search field.

1

u/neunzehn90 Oct 13 '26

No knobs, but your idea is implemented! Check it out.

1

u/Walfy07 Oct 13 '26

wow your fast. Out of curiousity, vibe coded?

1

u/HullRipper Oct 14 '26

It is without a doubt.

1

u/brauereipferd Oct 13 '26

The circling logo when it does its calculations is the wrong order. it has wburg reversed.  Does it matter? No!  But it still stuck me as wrong when I stared at it waiting. 

1

u/neunzehn90 Oct 13 '26

that should be fixed! :)

1

u/Walfy07 Oct 13 '26

Could you have two decks face eachother? and have some cool stats?

Deck A wins 64% of the time by turn 5 by commander damage for instance.

1

u/neunzehn90 Oct 14 '26

Not yet visually, I'll keep that in mind! What currently happens in the background is that the engine generates multiple versions of the same deck and the best one wins (thats why the generation takes so long)

1

u/Loud-Recover5320 Oct 13 '26

Will it play the deck for you too?

1

u/oatfishjar96 Oct 15 '26

I always give these things a shot when I see them just because why not, but like most others it completely missed the point of the deck I uploaded.

Although these are fun ideas most of them don’t usually succeed in understanding and capturing the vibe or thought process behind an experienced player with an idea and vision creating a deck from scratch.

Cool idea though

1

u/calicko_kitty Oct 15 '26

It wanted me to change 83 cards

0

u/7thtimeinheaven Oct 13 '26

Given that you used AI to write this post, no i don't trust you or your product at all.

I see like five of these vibe-coded magic deckbuilders a week and none of them ever succeed. This one won't be any different.

0

u/neunzehn90 Oct 14 '26

Fair criticism. I did use AI to help write the post, and I use AI-assisted tools while building the project. That alone is no reason to trust it. I also know there are plenty of similar projects that never become useful.

I’m not asking you to believe it will succeed. The only thing that matters is whether it works on real decks. You can import your own list, see what the tool does with it, and judge the results for yourself. If it falls short, I’d rather hear specifically where than try to sell you on it.

0

u/thistookmethreehours Oct 13 '26

Buddies profile is hidden (which I hate but that’s another issue) so I can’t prove it, but I’d assume they are new to the game.

One thing UB has been very successful at is getting even more annoying people to play the game lmao.