Jump to content
Sign in to follow this  
Starlight Warrior

Duel Links Deck Simulator: Possible Idea?

Recommended Posts

Okay, bear with me on this: I've been rewatching a lot of old-school YGO lately.  Kaiba has an immensely useful tool at his disposal, one I think the entire dueling community could benefit from: A deck simulator.  He inputs the data he wants analyzed, let's the thing go, and learns whether or not his deck and strategies are viable, all in a much shorter amount of time than by play-testing the deck himself.

 

Now, Kaiba was written as a genius on almost unprecedented levels, but I don't think the idea of a deck simulator is all that far-fetched.  What if we could create one and use the Duel Links card database as a sort of testing ground?  At the very least, it would save time in the play-testing department, and could later be expanded to IRL duels.  Right now, though, it should focus exclusively on Duel Links because of the smaller card pool and the "speed duel" format used in the game.  I'm sure such a program could also be used to maximize Duel Assessment points.

 

I would like to begin working on one myself, but as I have virtually no programming knowledge, the best I can do is with some clever tricks in a spreadsheet program (I once adopted and drastically improved a DPS calculator in a now defunct MMO).  I'm not sure it will be very effective, though.  Best case scenario, it ends up being a very complicated, but crude, prototype.  However, smarter people than I (of which there are many on these boards alone, I'm sure) can use the general principles and the databases to build actual programs that do the job better.

Comments on the idea?  Ideas of your own?  Stuff I should watch for, or things I should include in the program?  Do you think it's a good idea or a bad one?  Do you think it's even possible?  I honestly have no idea if it is, but I want to try.

Share this post


Link to post
Share on other sites
+Gojira    1706

This is not actually very difficult to do for an individual deck, but it cannot be made to test multiple kinds of decks without modification

Share this post


Link to post
Share on other sites
On 4/16/2017 at 3:54 PM, Brosi said:

You should definitely check ACP's matchup simulator.

 

Ooooo, where can I find that?

Share this post


Link to post
Share on other sites
On 4/16/2017 at 3:54 PM, Brosi said:

You should definitely check ACP's matchup simulator.

 

Wait, you're not talking about the Lackey thing, are you?

EDIT: For clarification, Kaiba's simulator would tell him the win rate of his deck vs. whatever card, strategy, or deck he was analyzing.  For example, when Kaiba was working out strategies to defeat The Winged Dragon of Ra, he simply input his deck and the true effects of Ra (remember, he was a reincarnation and thus able to read it completely), and the computer ran every possibility until it finally told him he only had a 13% chance of winning.  I'm trying to accomplish the same thing: Something that will run every possible duel and then tell you the odds of victory.

Edited by Starlight Warrior

Share this post


Link to post
Share on other sites
mark    3105

I think he's talking about

 

 

which isn't close to what you're looking for

 

I do remember @mmf using a program where you would put in variables like how many cards of X and Y you play, and calculate how often you win, not sure how it worked exactly but I think in the end it's a simplification anyway

 

I mean you need to make some simplifications first, such as:

 

If X and Y happens, you win around 70% of the time

If Z happens, you lose unless if you draw a specific out

 

etc, then you can calculate this and use simulators to calculate the odds of these scenario's happening, but you need to know the scenario's first. it's not like you can make some kind of chess simulator for yugioh without an entire TEAM of people who know what they're doing, working on it

 

There are just way too many variables to do this, I guess if you had Konami's "AI program", then improved it to the point where it reaches human play, you could run it vs the most used decks and see which ones come out of top, but yeah you don't have acces to their programs obviously 

Share this post


Link to post
Share on other sites

EDIT: I'm looking for that program you mentioned, but could you link me to it if you can find it before me?  Would really appreciate having a look at it.

 

Not really looking for a chess simulator or a next move analyzer or anything like that, but I think that gave me an idea of how to explain what I'm looking for.

Did you ever see that movie "Next" with Nicolas Cage?  Not a great movie, but I digress.  He could see two minutes into the future, but then he figured out that he could see even further if he had already resolved to use his ability again within two minutes of the first use, and so on.

Basically, what I'm looking to create, or at least build a foundation for, is something that will play every possible duel between two specific deck lists, then tell you how many of those resulted in Deck A's victory or defeat, (draws are incredibly unlikely, but they should be counted too).  When I'm on the Duel field, I can analyze the situation just fine on my own, I don't need a computer's help with that.  I just want to be able to build a deck and find out exactly how many victories it has against another deck.

 

I don't believe for a second that there are infinite possible moves in YGO, and certainly not between two specific 20-card deck lists.  Let me explain what I mean: There are not an infinite number of moves in Tic-Tac-Toe.  There are 255,168 possible games that can be played.  Player 1 wins 131,184 of those games, which is just over 51.4% of possible games.  Now, I'll admit that 3T isn't nearly as complex a game as YGO, even with the Speed Duel rules in place, but it still illustrates my point quite well.  Infinite possibilities don't actually exist in games with restrictions like how much space you have, how often you can do things, WHEN you can do things, how many resources you have to use and how you're allowed to use them, etc.  Even chess has a finite number of moves, even though nobody's been able to pin down the exact number yet.

 

You're probably right in that it would take a team of people who know what they're doing to come up with something like this, though.  Even so, I want to try.

Edited by Starlight Warrior

Share this post


Link to post
Share on other sites
mark    3105

A variant of this that I've thought about, that is done more manually, is the following:

Assume we have 2 decks.

 

Categorize situations that often come up, and predict how often player A wins and how often player B wins. With some decks, this is rather easy. For example when testing Turbo Tea Burn vs a Beatdown deck, all you have to do is predict the damage output from the Beatdown deck (say, their monsters have 1800 ATK on average, and he has X% chance of opening 1 in his first 5/6, Y% chance of opening his 2nd in his first 6/7, etc). So for example, you can say:

 

Turn 1 you take -1800 damage

Turn 2 you take -3600 damage

Turn 3 you take - 5400 damage

 

Because you assume your opponent summons a monster and attacks each turn. Now, sometimes they'll monster brick, but you can calculate how often that happens pretty easily. So now what you do, is you decide how much of this damage you can "block". For example, if you play Cobra Jar, that's guaranteed to block 2 attacks. If you play Big Shield Gardna, that blocks 1 attack, but if it's their only monster you'll likely be able to put it into defense again, and it'll block another attack, unless if they open E-Con/Windstorm, or something like that.

 

So basically you can make the optimal deck based on this information. For example, you'll realize that Cobra Jar is better than GK Curse, because Cobra Jar blocks 2 attacks, while GK Curse barely blocks any attack at all. You'll see that Cocoon is optimal "if" your opponents deck doesn't have much outs against it, and if their outs are stuff like E-Con, you can play Flash Assailant instead. 

 

Now, you also calculate your damage output. Big Shield Gardna deals 800 damage because we assume the opponents monsters have 1800 ATK. If they have to attack it twice - and they don't open E-Con/an out - then it deals 1600 damage. Either that, or they'll stall and draw into their outs, but then you draw more burncards and you win anyway.

 

So it would be possible to go through all these scenario's and come up with a "perfect" turbo burn deck, although it takes a lot of work and you'd need to know the entire meta and all techs people play. For example if people play Equip spells, high attack monsters or monster removal, this strategy becomes worse. But this is one of the easiest examples I can think of.

 

I think you can also do this with "regular" decks. There aren't that many options. For example let's take the Dino Kingdom mirrormatch, because that used to be popular. Assume that both players play around 10 monsters, and 10 battle modifiers (E-Con/Mirror Wall/Windstorm). 

 

If your opponent opens monster + S/T, and you attack into it with a monster, and they activate Mirror Wall/Reinforcements/Metalmorph, you now lose if they attack with another monster next turn - unless if you have E-Con/Windstorm to protect. This is why I liked Embodiment of Apophis so much: you could attack into face-down S/T's (which is good, because you +1 every time you destroy a monster by battle), without risk of dying if you they had a Mirror Wall etc. Because you'd just flip Apophis in their turn to block damage. (In the Dino mirror, the ATK/DEF stats of Apophis are too low to be relevant, so maybe this isn't the best example, but against other decks this would be a good card to play simply because of the reason you don't automatically lose when you attack and they "have it".)

 

If one of the 2 runs out of monsters, or out of S/T's, while the other does not, the person who has both monsters and S/T's will always win - unless if the other player draws into good cards (or, if he has 1900 ATK monsters while you draw 1800 ATK monsters).

 

So the more complex it gets, the harder it will be, but it's not hard to see that stuff like Flash Assailant outright destroyed the mirror. Why? Because "if you draw Flash Assailant + another monster, you summon the other monster first", and "Flash Assailant doesn't lose to any monster in their deck, and also doesn't lose to E-Con/Windstorm", especially if you combine this with Trap Jammer. Trap Jammer is better than something like Nobleman of Extermination in this match-up, because if they have 3 backrow, you can block their Mirror Wall (since Flash Assailant doesn't care about E-Con/Windstorm), but with Extermination you'd only have a 1 in 3 shot (and even then, they can chain it and you still have to wait till it's gone). 

 

Now, I understand that this doesn't answer your question. And I also understand there are infinite more decks, and the new decks are more complex than the others, but I think this is a good starting point of analyzing match-ups. Then, when we have all this data, such as:

"Opening 1 monster + attacking into their monster = X% chance of winning

Opening 0 monsters = Y% chance of winning"

 

etc.

 

Not only can you calculate the optimal play (attacking into monster+face-down yes or no? and into monster + 2 face-downs? and 3? Does it matter if you have E-Con/Windstorm so you can block an attack next turn? Does it matter if you have another monster in hand so you can afford to trade 1 for Mirror wall?). You can also calculate how good your deck will be vs the other deck, and how changes will affect this (such as, if you go -2 weak monsters +2 Flash Assailant, your monsters are now always stronger which should result into you winning way more often because the stalemates and crashes don't happen anymore). So you just have to make simplifications, go through each scenario, predict the outcome, and then calculate the odds of this happening. Then you have to do it for each deck, preferably you also use the information that Duel Links provides you (such as, most played card during KC Cup was Mirror Wall, most played deck was Relinquished Switcheroo, etc. All that information is useful). 

 

You also don't want to find the deck with the theoretical best match-up against all possible decks. You want to find the deck that is best vs what people currently play. For example, maybe a strategy with Harpies Hunting Ground isn't optimal because everyone "should" main 3 Twister, and now your Harpies and Birdface are weak monsters. But, if in reality, people main 1 Twister on average, then I'd be playing Harpies Hunting Ground regardless, even if it's not the "best deck possible". I'll only adapt when others adapt. There's no point in trying to finding the best deck, because a deck is only good relative to the decks it plays against. A "bad" deck can be a good meta-call and still be the best deck "at that moment". A good example is Weevil stallburn with Whistle: Theoretically this can never be the best deck, because if everyone mains 1 copy of Grasshopper, they can easily beat this deck. But in reality, no one plays Grasshopper. So in reality, it could be the best deck to play in a certain format. 

 

Hope this helps a bit, even though I don't answer your question at all. It's just something that's been on my mind for a while and that I want to try out, but I can't currently since the meta is way too diverse and I don't have a clear idea of the meta yet. I know what people play, but it seems like literally everyone I play plays an "unique" kind of deck + techs, and everyone is continuously switching things up, so it's hard to implement this "system" right now. 

Share this post


Link to post
Share on other sites

Well, it's definitely a good way to look at strategy.

 

I didn't really want to use the term "brute force," but I guess that's what I'm trying to accomplish here.  Just make something that can brute force it's way through every possible duel between two decks and then just let it loose.  But we don't even have something that can do that with chess, do we?

Share this post


Link to post
Share on other sites
mark    3105

Yes, there are chess computers that can beat every human being.

Share this post


Link to post
Share on other sites
mark    3105

Although I'm not sure if they go through every possible situation, or that they use strategies that people "teach" the computer (this used to be the case). Computers have also defeated humans in Go, which is apparently more complex than chess, but the game mechanics are still simple - there are just infinite possibilities of how a game can go.

Share this post


Link to post
Share on other sites

Nah, not infinite.  Even Go isn't infinite, and I'm pretty sure it has WAY more possibilities than chess despite not knowing anything about the game.  There's only a finite number of board states for chess, Go, and other such games, and those can be arranged into one hell of an array of possible games, but there's no way they're infinite without drastically modifying the rules and then somehow breaking physics.

 

The number's just too big to count to in a reasonable amount of time, and too big for the human mind to calculate without technological help.

 

I was actually about to ask if these computers possessed the data of all possible games and simply used that to determine their next moves by calculating which ones had the highest win rates and draw rates, and just going with that.  If you're not sure, though, that's okay.  I really appreciate all of your insight, mark.  It's given me a LOT to think about.  If you have anything else, by all means, please share it with me.

EDIT: Wikipedia seems to suggest that computers do not currently have the capability I was going to ask about, and it seems they've stopped building on the old brute force methods.

Edited by Starlight Warrior

Share this post


Link to post
Share on other sites
mark    3105

Not technically infinite, I should've been more clear, but like more possible combinations than atoms in the universe iirc

Share this post


Link to post
Share on other sites
16 hours ago, mark said:

Not technically infinite, I should've been more clear, but like more possible combinations than atoms in the universe iirc

 

That sounds about right.  I remember seeing some people asking about that in particular.

 

So, my current course of action is going to be to complete the card database and then see if I can work out some of those simplifications you were talking about.  That definitely seems like the best starting point.

Share this post


Link to post
Share on other sites
turceal    29

I always feel like the answer to this could be solved by leveraging existing technologies. There must be a way to get 2 AI on say ygopro to play against each other and then record the results. then you would only need to run a number of simulations to gain confidence while controlling for different decks and builds. In the proposed scenario you could also keep logs of winning matches and compare stats like cards in opening hand vs win rate.

Share this post


Link to post
Share on other sites
mark    3105

Problem is AI sucks, and I don't think it can improve itself either. It doesn't go through each possible combination, is just does what people tell them to I think? So yes, if you were to put all the "perfect technical play" information into 2 AI's - maybe it could be done if you run it a lot of times, but we do not have access to their systems.

Share this post


Link to post
Share on other sites

Maybe someone could get IBM to teach Watson how to duel.

Share this post


Link to post
Share on other sites

I hope nobody minds if I resurrect this topic.  I've been thinking a lot about this simulator idea of mine for several months now, and recently started looking into some math regarding deck shuffling- specifically how many different ways a deck of cards can be arranged, and the math used to determine that number quickly.  And holy CRAP, even a 20 card deck with six trios and a single pair has a TON of unique arrangements- assuming, of course, that "unique" means that all copies of a card are interchangeable with each other.  I also learned what factorials are and that exclamation points are used to represent them in math... formulas?  Equations?  Are those the same thing?  I dunno, I didn't think about that until just now.

 

Should probably note here for those unfamiliar that a factorial (n!) works like this: Say you want the factorial of 5, so 5!, you'd write it out longways like this: 5x4x3x2x1.  You start with "n", in this case 5, and multiply it by every whole number between "n" and 1.  So 3! would be 3x2x1.  7! would be 7x6x5x4x3x2x1.  20! would be... well, you get the idea.

 

Anyway, in a 20 card deck comprised of a single pair and six trios- three copies each of six different cards- the formula would look like this: 20! / (3!6 / 2!).  Basically, the exponent for each trio or pair factorial is equal to the number of trios/pairs present in the deck itself.  Anyway, this formula equals 104,291,066,880,000.  Over a hundred and four trillion combinations.

 

Now, try to imagine going through every possible duel between two decks composed of six trios and a pair.  The complex the cards and potential interactions, the more possible duels there are.

 

I'd need a damn quantum computer from the year 2276 just to make it calculate which deck has the most victories inside of a year, and that's assuming the human race survives that long and gets its shit together, and all of that is still probably a very GENEROUS estimate, and on top of all of that, I'm really no good at this kind of advanced math.  I'm literally going with what my instincts are telling me on that observation.

 

Even so, this seems like a challenge I'd have fun tackling.  I don't really know why, but thinking about it excites me.  At the same time, though, it is a bit daunting, because what I want to do is basically create a brute-force program that tells you which one of two decks has the most possible victories out of ALL POSSIBLE duels, and I recognize that this in itself could be problematic as there are duels that simply would never occur for obvious strategic reasons, so their presence in the data could taint the results.

I guess I just wanted to share what I've learned so far, and my proposed starting point for actual experiments: The starter decks for Yami Yugi and Seto Kaiba in Duel Links.  Their monsters are different, but they have the exact same Spells in their lineup.  There seems to be enough basic variety and strategic variance to make it worth while without breaking things right away.  At least, I hope.

Of course, I'm still attempting to design and build a testing environment in a freaking GOOGLE SPREADSHEET... this seems more and more ridiculous the more I think about it, but that just makes me want it more.  Humans, right?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×