How I Would Teach AI To Play Competitive Yu-Gi-Oh

Inspired by Peter Whidden

The Perfect Master Duel AI Is Able To: ​

  • Play without mechanical errors

  • Identify a Meta for a given Time-Period

  • Pick and Refine a Deck for that Specific Meta

"The goal of competitive Yu-Gi-Oh is to win."

I love card games, especially two-player card games. They are the very definition of "if you lose, that's on you". There are no teammates to blame your loss on, no rewards for obscene K:Ds, and only winning or losing counts.

Recently I watched Peter Whidden's "Training an AI to Play Pokemon With Reinforcement Learning", where he allowed an AI to stumble about in Pokemon Red, and miraculously, it managed to get past Brock and start heading into Mt. Moon. That video really made me think a lot; what if I could apply the same ideas and teach an AI to play Yu-Gi-Oh?

I Want To Win

"I'm not a professional chef anymore, I'm a home cook now."

- Marco Pierre White

My goal is to lay out the foundations for a possible Yu-Gi-Oh AI that can play in the Duelist Cup. I'm a long way from my competitive days, and these days most of my fire is consumed making AI art. Traditionally, I have always made it to Stage 2 of Master Duel's Duelist Cup, but always, always flake out.

Part of wanting an AI to learn competitive Yu-Gi-Oh is to both retread some old lessons I know, and should apply, and to apply new concepts to old card game theories, which has remained in the early 2000s of Magic the Gathering at best. I will be combining what I know about card game theory and try and get an AI to learn all of it. Perhaps some day, at the end of the road someone will pick up the task of making the actual AI using these theories.

What Is The End-Goal Of A Perfect Master Duel AI?

The perfect Master Duel AI should be able to:

  • Play without mechanical errors

I define mechanical errors as errors that are "unforced". The most classic would be playing into an [Infinite Impermanence] column. I think reaching that state an AI can safely say that they are > World Championship Runner-Up material.

Note I differentiate this from "forced" errors, where a series of opponent's plays force you to make suboptimal moves. The classic example would be playing under [Maxx C]. Do you build a smaller board, or go full combo and hope for the best? Most people would go for a smaller board with less summon chains, so an opponent does not build too much {card advantage}, causing a "forced" error. Other examples might be playing through [Niburu, the Primal Planet] or around [Mirror Force].

Naturally, an advanced AI should be able to play around these "forced" errors, but that is very much a higher-level skill.

  • Identify a Meta for a given Time-Period

This is more nebulous and probably involves the training of an entirely separate model from the play model. I define {meta} as the most-likely makeup of decks by probability of appearance in the Duelist Cup.

For example, an AI should know that Purrely is currently the most dominating deck in the Duelist Cup, with a staggering >20% representation. It will take this probability into consideration when picking/building a deck.

This should not be hard, "Master Duel is playing a past meta." We KNOW that Kashtira does NOT dominate the meta post-ban of Fenrir. We KNOW that RAC-ISTS will start winning every tournament and start creeping up to the meta once Sinful Spoils releases.

What is hard is applying that knowledge.

  • Pick and Refine a Deck for that Specific Meta

Ideally, the AI will pick the deck that has the best winrate against the largest number of competitors, allowing it to consistently achieve a high winrate. I call this picking the "highroll" deck.

Note that I didn't say that I wanted the AI to reach 80% winrate, much less even brag about it. My take on 80% winrate decks is that they do not survive the Duelist Cup with their winrate intact. [1] Realistically, a high level AI would be winning 54~56% of their matches against equally high skilled opponents with similarly powered decks.

The AI should be able to pick the "highroll" deck and make modifications to it before the event.

I wanted to say it should be able to make modifications to it DURING the event as many are apt to do, but if you have perfectly identified the meta, you should have prepared for it beforehand already. If your deck does not have an answer to an unaffected [Purrely Noire], you are going to autolose about 10~20% of your matches. That is a swing that you simply cannot take.

Last Step

When I lay out the three goals of a perfect Master Duel AI, I realize that these are three non-overlapping yet overlaying skills.

In order to play without mechanical errors, you need to know what is your opponent's most probable next move. You can only do that by knowing what decks your opponent is playing (i.e identifying the meta).

If you identify a meta correctly, your deck will be composed of cards that "beat" that specific meta. You are clear about the odds of drawing outs from your deck and perfectly calculate your own odds to win.

Only you able to refine your deck to the point that there are very little "bad outs" or "bad hands" against a variety of situations. This is what causes the magic of "he always has it!" that happens in the YGO anime and Stage 2 duels. Over a long period of refinement, you have a deck that consistently beats human opponents.

When all three goals are complete, you will have the perfect Master Duel AI in your hands.

Author-kun

HouseDelaroux.com

—-

[1] You can tell that I am still salty about that (((Relinquished Deck with 80% winrate))) video where the player links off Relinquished to make Halqifibrax.

Previous
Previous

Scribbles On Comedy

Next
Next

THE MONTH IN AI (OCTOBER 23')