Forums Tyrant

Automatic deck optimization - leftylink's thread page 5 (locked)

216 posts

Flag Post
Originally posted by catepillar:
Originally posted by ltdata123:

Hi.
Would it be possible, that in case when there is no ownedcards.txt in dir -r paramater would work? Just to shuffle cards to get better result?
Or to make some shuffle parameter?
Workaround is to put only deck’s cards into ownedcards.txt but it is quite long process :).

The -o flag and -r flag are unrelated. It should work with/without a ownedcards.txt.

Yes, but if I use -o -r without ownedcards.txt it will compute win ratio, but I want to optimize just order of decks without new cards added. To do it, I must edit ownedcards.txt add only cards that my deck contains :), compose some starting deck and run optimizer with -o -r.

f.e. I have IC, prism, mortar bunker, marrow aileron which is good against some Mission and I want optimize only order of cards not addin other. Which will be IC, marrow, prism, mortar. Workaround is that I construct some deck like Cyrus, infantry, infantry, infantry put IC, marrow, prism and mortat into ownedcards and run optimizer with -o -r.

Nevermind I will make some workaround batch to do that automatically, problem is card deduplication.

 
Flag Post

Why not use the following command?

tyrant_optimize.exe PsID+q “Mission 65” -o climb 1000 > result.txt

(PsID+q means Lord of Tartarus + Microgen(10); You can substitude with any decks that you can spam.)

I tried KevinChan’s command and it also did not work.

Did you input the “open&close quotation marks” by yourself?

If you just copy the quotation marks from the forum, the command will not work.
(This is due to some character codings of the forum…)



I thought that my cards.xml was the problem, but I can use it with commonkeys version.


Did you try to download the newest cards.xml from here? I think the newest card.xml should work.
https://kg.tyrantonline.com/assets/cards.xml
 
Flag Post
Originally posted by leftylink:

Updates

Newer updates appear closer to the top of the post.

Wed Dec 19 16:50:33 UTC 2012 Announced the first release of “on Kill”, and a bugfix for “on Play on Death” skills.

Tue Dec 18 09:14:21 UTC 2012 Announced two small fixes: No more choking on ` character in raids.xml, and fix all compiler warnings.


Does that mean you want to modify these things in the first post?

Originally posted by leftylink:

Capabilities

What it can’t do: tyrant_optimize does not yet have the “on Kill” modifier. This will be implemented ASAP.

Optional ingredients

  • https://kg.tyrantonline.com/assets/raids.xml – This contains information about the raids in Tyrant. You only need this if you want to optimize against raids. If you download this, note that there is a stray ` character on line 37. If you do not have this commit (670e51), you must remove the ` character, otherwise you will get an unexplained error trying to find card ID 0. In the unlikely event that new raids are created, you will need to download this file again.

 
Flag Post

Can anyone upload the latest version?

 
Flag Post
Originally posted by DarkBlood1:

Can anyone upload the latest version?

I’m sure you, DarkBlood1, will not make me regret this, and I hope I don’t regret it for other reasons.

I have no idea if this will work Compiled on Microsoft Windows 7 Home Premium.

http://www.hunterthinks.com/solo/games/T_O_2012_12_19_Win_Compiled.zip

 
Flag Post

Feature suggestion

A switch that will invoke the default computer tone when the program terminates normally (non-error situations). I’m not sure if this is easy to do cross-platform.

Thanks!

 
Flag Post

Thank you very much hunterhogan! It works perfect, I already tested with some decks for raids, missions and quests.

 
Flag Post
Originally posted by DarkBlood1:

Thank you very much hunterhogan! It works perfect, I already tested with some decks for raids, missions and quests.

Excellent!

 
Flag Post
Originally posted by leftylink:

  • Can’t use “Kogoth, the Consumer”, “Kapak, the Deceiver” or “Pip, Epic Arbiter” in Custom.txt. Yeah, it sucks. Sorry. Your three options are to use deck hashes, to change Kogoth, Kapak, and Pip’s names in cards.xml, or to use ID notation in Custom.txt. For example, notate Pip as “Pip864” and tyrant_optimize will understand that you mean the card with ID 864 (who happens to be Pip, Epic Arbiter).
I'm sorry I didn't see this before, or I would have said something. Kong uses Textile formatting and Textile interprets open and close brackets [864] as markup that puts the enclosed characters as supertext. In case anyone cares, [~864~] would normally be interpreted as subtext. I had to dig pretty far into Textile's website to figure out how to turn this off.

The 864 in the above paragraph would normally look like this: Super864 and Sub864.

I had to dig pretty far into Textile’s website to figure out how to turn this off. The secret is something like <pre>. You can put text in a block-level element <notextile> and end it with </notextile>. I’ve only used it once, but I already discovered that if a <P> element is in the notextile block, then the notextile block will not function. So I had to use multiple notextile blocks.

Feature suggestion

I have a feeling that this feature would be obscenely difficult to program.

I was running T_O against Step 13 and 14 (tyrant_optimize “deck name” “Step 13;Step 14” -q -o -r climb 25000), and it worked beautifully. As you know, while it is optimizing this is an example output:
Deck improved: 1 Pummeller → 3 Pummeller: win%: 99.396 (24820 24878 out of 25000)

If I understand correctly, it used the same cards, in the same order preference, and ran 25000 battles against each Step. From a programming standpoint, this makes sense. From a game play standpoint, however, I only care that my one deck has the same cards. Once the Quest battle begins, I know if I am in Step 13 or Step 14. At that point, I want to know the optimal order for just that one Step—I don’t want to know the average optimal order for both steps because the other step is irrelevant.

Therefore, if it were possible, the optimizer would try to optimize the card pool separately from the card order against each deck. This might lead to a different suggestion from T_O. I suspect this would especially be true when trying to use T_O to optimize for Faction and Conquest wars. Step 13 and 14 have a lot of overlap, so the resulting deck and suggested order is excellent. But in a faction war, with a large variance of decks, I want to know the best card pool to use, and I know that I will play the cards in a different order for different kinds of decks, but the current code for T_O doesn’t take that into account.

My guess is that programming such a feature would be a nightmare, and I imagine it would increase computation time dramatically.

</text wall>

 
Flag Post

My guess is that programming such a feature would be a nightmare, and I imagine it would increase computation time dramatically.

I think this can be done by the following way:

Syntax:

tyrant_optimize.exe “deck1” “defense_deck1;defense_deck2” -o -rearrange climb 1000

The program is run in the following way:


Step 1:


tyrant_optimize.exe “tempdeck” “defense_deck1;defense_deck2” – o climb 1000

— The result is output to deck1


— Also, a temperate file (ownedcards2.txt) is created to store the cards in the deck (e.g. Dracorex, Pummeller #7, Support Carrier #3)



Step 2:


tyrant_optimize.exe “deck1” “defense_deck1” – ownedcards2 – r climb 1000

— The result is output to deck1_1



Step 3:


tyrant_optimize.exe “deck1” “defense_deck2” – ownedcards2 – r climb 1000

— The result is output to deck1_2

Then, deck1 contains the unordered deck, and deck1_1 and deck1_2 contain the ordered deck in those 2 situations.

But this method requires 3 things:
1. The program should store deck1 for future use (without modified);
2a. The program should create a new ownedcards2.txt;
2b. The program should read from ownedcards2.txt instead from ownedcards.txt in steps 2 and 3.

Actually, if the program can just rearrange the cards without add/remove cards, then steps 2a and 2b can be combined.

 
Flag Post
Originally posted by hunterhogan:

Feature suggestion

A switch that will invoke the default computer tone when the program terminates normally (non-error situations). I’m not sure if this is easy to do cross-platform.

Thanks!

On Windows, you can write a DOS batch file that beeps by doing the following: at the DOS prompt type:
echo @echo (Alt-7)>beep.bat
but instead of typing the characters: “(Alt-7)”, you hold down the Alt key and press 7 on the numeric keypad. Don’t use the 7 on the qwerty part of the keyboard, it has to be on the keypad, and Num Lock has to be on.

Or you can add that on the batch file you usually run to simulate :)

On Linux, it’s simply necessary to install the “beep” package and run it

 
Flag Post

If I am not mistaken there is an escaped character ‘\a’ that should be cross platform. But then writing a batch file to do it is probably better…

 
Flag Post

Thanks! I didn’t think of batching it. It’s been a looooooooong time since I used batch on a regular basis. I think it was back when Al Gore and I were trying to invent the Internet.

 
Flag Post
Originally posted by KevinChan2:

My guess is that programming such a feature would be a nightmare, and I imagine it would increase computation time dramatically.

I think this can be done by the following way:

This looks pretty cool, and I think it suggests that programming it might be easier than I thought because it would merely be recursion of the core part of the optimizer. But once you do the first iteration and the results include “deck1”, what deck do you use as the input for the next “tempdeck” -o? Do you randomly select between deck1_1 and deck1_2?

And I think the recursion shows that computational time here will increase faster than linear time, right? In the current system, adding more decks to the optimize mix is just linear growth, right? (I read Theory of Computation in 2003, and I haven’t often used that knowledge a lot in law, you know?) One deck is O(n) time, two decks is O(2n) = O(n), 22 decks is O(22n) = O(n) time, if I am understanding correctly.

But with recursion, it seems to me that the scenario you described grows more quickly than linear, but I am starting to doubt myself—it might still be linear time but the coefficient might grow more quickly, which in theory is trivial.

2 defensive decks optimizes 3 times
3 defensive decks optimizes 4 times

Awww, crap. I feel a little silly now: I broke one of my own rules. Do the math! Is the computational time merely, D=defense decks, O(Dn+1) = O(n)?

Ok, if your basic idea can work, then it looks as if the computational time is not a major issue. I’m impressed!

(Oh, and because I am a nerd, if I didn’t approximate comp time correctly, someone please teach me the right way to view this. Thanks!)

 
Flag Post

A much better name for this program would be “Automatic Deck Finder” because always gives you the best deck without care if you used a good base-deck or just Lord Alexander and 10 Orbo. :D

 
Flag Post
Originally posted by DarkBlood1:

A much better name for this program would be “Automatic Deck Finder” because always gives you the best deck without care if you used a good base-deck or just Lord Alexander and 10 Orbo. :D

False. This is a hill-climbing algorithm. It can get stuck on local maximas. http://en.wikipedia.org/wiki/Hill_climbing#Local_maxima
The solution to that is adding some randomness (ie, changing 3 cards if it gets stuck), but the cost-reward is so minor, its probably not worth the effort.

 
Flag Post

actually it does care…. initial deck-type can have an significant effect on final deck…


edit
ninja’d, but catepillar actually mentioned another flaw of the algorithm:

so 1. Since win rate for specific deck types is achieved via different cards, the climb algorithm will be able to optimize only one kind of deck type… so you have to use sample decks for each deck-type to me thorough.

and 2. The algorithm can get stuck in local “hills” (success %’s), and miss the “mountain” since the way there means it has to go down for a bit and the climb algorithm never does that.
Now that i think of it, this flaw is the cause of the 1st one too. :)


Even so, the optimizer is an amazing tool, and can do miracles in skilled hands…

 
Flag Post

actually it does care…. initial deck-type can have an significant effect on final deck…

Yes. When I use the program to find solution decks for quests 21 – 23, I tried to start from the following ordered decks:
1. Dracorex, Sundering Ogre #8
2. Halcyon the Corrupt, Azure Reaper #8
3. Tabitha, Lance Rider #8

Usually, the first two give me similar results, but the third one is different from the others. I think this is because Lance Riders are quite effective against quests 21 – 23, and Tabitha works well with them, and hence the commander would not be changed to Dracorex / Halcyon the Corrupt.
(I mean if more Lance Riders are used, the commander should be Tabitha; otherwise, the commander should be Dracorex / Halcyon the Corrupt.)

 
Flag Post
…but catepillar actually mentioned another flaw of the algorithm

just to be pedantic in case other readers start thinking the optimizer is flawed: this isn’t a flaw, this is just math.

optimization of a function (average wins) on a space (all possible card combinations and shufflings) when local maxima exist is basically impossible; any algorithm will have flaws. you have to be able to characterize the entire space, somehow (such as know the win rate for every deck/shuffling), to be sure you are at a global max.

 
Flag Post
Originally posted by purei:
…but catepillar actually mentioned another flaw of the algorithm

just to be pedantic in case other readers start thinking the optimizer is flawed: this isn’t a flaw, this is just math.

optimization of a function (average wins) on a space (all possible card combinations and shufflings) when local maxima exist is basically impossible; any algorithm will have flaws. you have to be able to characterize the entire space, somehow (such as know the win rate for every deck/shuffling), to be sure you are at a global max.

A properly implemented genetic algorithm will (eventually) solve these issues. But there is a trade off in time. I would imagine a genetic algorithm requires hours if not days to optimize for a deck whereas the hill climbing algorithm can do a decent job in minutes.

 
Flag Post
Originally posted by catepillar:

A properly implemented genetic algorithm will (eventually) solve these issues. But there is a trade off in time. I would imagine a genetic algorithm requires hours if not days to optimize for a deck whereas the hill climbing algorithm can do a decent job in minutes.

yeah, but I believe a genetic algorithm’s flaw is in choosing an imperfect termination criteria (you did say ‘eventually’), unless it purposefully aims to fill (characterize) the whole space. maybe i don’t know what a proper implementation is?

 
Flag Post
Originally posted by purei:
Originally posted by catepillar:

A properly implemented genetic algorithm will (eventually) solve these issues. But there is a trade off in time. I would imagine a genetic algorithm requires hours if not days to optimize for a deck whereas the hill climbing algorithm can do a decent job in minutes.

yeah, but I believe a genetic algorithm’s flaw is in choosing an imperfect termination criteria (you did say ‘eventually’), unless it purposefully aims to fill (characterize) the whole space. maybe i don’t know what a proper implementation is?

In Tyrant, the definition would have to be either the program finds a deck a set of play rules that produce a 100% win rate, or, like the with the program Eureqa, the “best deck” is when the user stops the program evaluation.

 
Flag Post
Originally posted by purei:
Originally posted by catepillar:

A properly implemented genetic algorithm will (eventually) solve these issues. But there is a trade off in time. I would imagine a genetic algorithm requires hours if not days to optimize for a deck whereas the hill climbing algorithm can do a decent job in minutes.

yeah, but I believe a genetic algorithm’s flaw is in choosing an imperfect termination criteria (you did say ‘eventually’), unless it purposefully aims to fill (characterize) the whole space. maybe i don’t know what a proper implementation is?

For a genetic algorithm, the termination requirement can be any set of many things. If there is no (statistically meaningful) improvement over the past 100 generations is probably a decent start.

 
Flag Post

I downloaded the integration .zip-file today and recompiled it. The new .exe that was created does not recognize queststeps anymore. using the old .exe (I compiled on Dec 04) with the same bat-file it does optimize versus quests.

The error message is this:

The deck Step 1 was not found. Available decks:
[then it lists all Mission, Raid and Custom decks]

It is the same for all Steps.

The quest.xml is in the folder of the .exe.

Edit: just to make sure, this is the command line that I use:

tyrant_optimize “timesurgeopak” “Step 1” -o -r -q -t 1 climb 100000 > TimeSurgeOpak.txt (with correct version of the " of course)

 
Flag Post

does the step and the 1 have a spatie in between in the quest.xml?