Dominion Strategy Forum

Please login or register.

Login with username, password and session length
Pages: [1]

Author Topic: Learning AI?  (Read 8587 times)

0 Members and 1 Guest are viewing this topic.

sudgy

  • Cartographer
  • *****
  • Offline Offline
  • Posts: 3431
  • Shuffle iT Username: sudgy
  • It's pronounced "SOO-jee"
  • Respect: +2707
    • View Profile
Learning AI?
« on: January 24, 2013, 03:04:22 pm »
0

I've heard of this proposed for a few other games, so I was wondering if anybody has even had the idea for this.  Has anybody thought of making an AI for dominion that would learn better strategy just playing the game?  for instance, it would go for a bad strategy, realize it was bad, and not do it again.
Logged
If you're wondering what my avatar is, watch this.

Check out my logic puzzle blog!

   Quote from: sudgy on June 31, 2011, 11:47:46 pm

DG

  • Governor
  • *****
  • Offline Offline
  • Posts: 4074
  • Respect: +2624
    • View Profile
Re: Learning AI?
« Reply #1 on: January 24, 2013, 03:20:43 pm »
0

Logged

Ozle

  • Cartographer
  • *****
  • Offline Offline
  • Posts: 3625
  • Sorry, this text is personal.
  • Respect: +3360
    • View Profile
Re: Learning AI?
« Reply #2 on: January 24, 2013, 04:11:30 pm »
+7

Logged
Try the Ozle Google Map Challenge!
http://forum.dominionstrategy.com/index.php?topic=7466.0

Sullying players Enjoyment of Innovation since 2013 Apparently!

ftl

  • Mountebank
  • *****
  • Offline Offline
  • Posts: 2056
  • Shuffle iT Username: ftl
  • Respect: +1345
    • View Profile
Re: Learning AI?
« Reply #3 on: January 24, 2013, 11:02:41 pm »
0

Because of all the variety in dominion, this is a very, very hard problem.
Logged

sudgy

  • Cartographer
  • *****
  • Offline Offline
  • Posts: 3431
  • Shuffle iT Username: sudgy
  • It's pronounced "SOO-jee"
  • Respect: +2707
    • View Profile
Re: Learning AI?
« Reply #4 on: January 24, 2013, 11:41:12 pm »
0

Because of all the variety in dominion, this is a very, very hard problem.

I know that, I was just curious...
Logged
If you're wondering what my avatar is, watch this.

Check out my logic puzzle blog!

   Quote from: sudgy on June 31, 2011, 11:47:46 pm

DStu

  • Margrave
  • *****
  • Offline Offline
  • Posts: 2627
  • Respect: +1490
    • View Profile
Re: Learning AI?
« Reply #5 on: January 25, 2013, 02:25:47 am »
0

I think the problem is that you can't just let bot play somehow, tell it "that was bad, try something else" and expect that to work.  That may work if the possible things to try are very limited, and in an stable environment.  But even then it's not very efficient in how well it learns, maybe only in how fast this can be programmed.

But we are in neither of these situations, and that means you need some good model first.  We have quite good models on how to play BigMoney. On these you could quite easily put some learning to find out how to play them optimal (without considering the opponent), and maybe also which to play on which boards.
But that's also pretty uninteresting.

Also some of the other board types (combos, slogs), we either have the bots, or they could be implemented quite easily.  Here also you could maybe do some machine learning, but already the number of variables grow quite high (which type to play against which deck, what does the opponent do, support cards, how to play optimally given board/opponent)


But the point is, that is not what it is about.  The fun things are the engines, and we (at least I) have basically now idea on how to have 1 (or maybe 2-3) generic bots that on a random board, can decide if there is an engine in it or build it.  Not even in the form of "OK, here is the model with 20 free parameters per card in Dominion, now find some good values for these and then chances are good that you have some decent engine-bot".
And I think nobody is really interested in putting all the work in some machine-learning on what we have if in the end this bot can't play engines.


Edit: Also, I think the motivation to build a bit more with the bots would be a lot higher if there would be an API to let them play on goko;
« Last Edit: January 25, 2013, 02:29:54 am by DStu »
Logged

blueblimp

  • Margrave
  • *****
  • Offline Offline
  • Posts: 2849
  • Respect: +1559
    • View Profile
Re: Learning AI?
« Reply #6 on: January 25, 2013, 03:29:04 am »
0

This would be cool and is hard hard hard. I speculate PhD thesis-worthy hard, or harder.

The reason is the sheer amount of variety in Dominion, and somehow the learning AI should be able to smoothly integrate it all. As DStu points out, there are many kinds of games: combos, slogs, engines, etc. Tactics and strategy are both important, and fairly different. There is randomness, so brute-force search can't give the AI much help, yet tactics and endgame play rely on precise calculation. There is hidden information, since you don't know what's in your opponent's hand.

In addition to that, the magnitude of the task is huge because there are so many kingdom cards. Each one is going to need some degree of special-casing and many present unique challenges. For example, games dominated by Possession are dramatically different than normal games.

Edit: That all said, I'm pretty sure it's possible with today's technology to create a Dominion AI that outplays top humans. But it would be a TON of work and cleverness. It might be best to attempt it with a team instead of just one person.

Ultimately, I think the main barrier is that there simply isn't enough reward for the work required. In the case of games like Chess, Go, Poker, etc., that have received and/or are receiving research effort, they have been around for hundreds of years, are very popular, and have rules than are simpler than Dominion's.
« Last Edit: January 25, 2013, 03:36:03 am by blueblimp »
Logged

WanderingWinder

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 5275
  • ...doesn't really matter to me
  • Respect: +4386
    • View Profile
    • WanderingWinder YouTube Page
Re: Learning AI?
« Reply #7 on: January 25, 2013, 02:44:38 pm »
0

Trying to do it just learning like this, there's way too big a sample space - every board is a complex game in its own right; change one card and you're in a ditch; you could probably get this to work pretty well off of a fixed kingdom, for the whole pool, it will be exponentially more complex.

theTrueMikeBrown

  • Pawn
  • **
  • Offline Offline
  • Posts: 3
  • Respect: +2
    • View Profile
Re: Learning AI?
« Reply #8 on: March 16, 2013, 07:50:58 pm »
+1

I wrote a genetic algorithm that could learn how to play fairly well (better than a reasonable big money bot at least) on one given kingdom. It would take hundreds of games (about a minute or two) to come up with a good strategy (about 80% win rate against BM most of the time). Once you pit that bot against a big money bot on any other board it has to start from square one all over again.

My program had only cards from Dominion and Intrigue, and the results that it came up with were always fairly simple (no crazy combos, usually just BM+1 card) Sometimes it would come up with an entire deck draw engine, but nothing that a good player couldn't beat the pants off of.

I decided to let it run against random kingdoms to see if it could come up with a good general strategy. I let it run for weeks on a computer that I wasn't using. It never came up with anything. The problem is just way too complex. With all of the kingdom cards out there (in just the first two sets alone) the game is still too hard for a simple genetic algorithm to figure out. It would take some crazy computation to come up with a general strategy since the game is always compartmentalized by the number of possible cards in the game.

I still have the code (though I haven't looked at it in a few months) if anyone wants to take it farther, but I am done with it. It is way too hard.
Logged

popsofctown

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 5477
  • Respect: +2860
    • View Profile
Re: Learning AI?
« Reply #9 on: March 16, 2013, 08:36:48 pm »
0

You know, there's also the irreducible complexity issue.
Logged

dpt

  • Pawn
  • **
  • Offline Offline
  • Posts: 2
  • Respect: 0
    • View Profile
Re: Learning AI?
« Reply #10 on: March 19, 2013, 09:57:44 am »
0

Logged

PitzerMike

  • Young Witch
  • ****
  • Offline Offline
  • Posts: 131
  • Longtime Pearldiver
  • Respect: +110
    • View Profile
Re: Learning AI?
« Reply #11 on: May 06, 2013, 03:18:00 am »
0

You know, there's also the irreducible complexity issue.

I don't know, is there?
Logged

Schlippy

  • Conspirator
  • ****
  • Offline Offline
  • Posts: 203
  • Respect: +60
    • View Profile
Re: Learning AI?
« Reply #12 on: June 08, 2013, 07:29:04 am »
0

Why is it so complex? It would just be an implementation of an artificial neural network. Sure, it will take a few months to build a good database, but it should not be a problem of implementation.
I mean robots learn walking and flipping flapjacks "by themselves" with a relatively small amount of programming work involved, so why shouldn't it work for dominion? A Dominion game has a pretty low number of possible moves in a turn, because there are only 10 kingdom cards. It is not like Go where there are about 250 possible moves each turn which you have to evaluate. The number "real" of legal moves in Dominion is rather low most of the time, like in chess or in backgammon. "Real" means moves that actually make a difference. It doesn't make any difference if you play your Gold before your Silver or trash the first Copper in your hand instead of the second copper.
Logged
I do upload some Dominion videos on youtube now. :)

WanderingWinder

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 5275
  • ...doesn't really matter to me
  • Respect: +4386
    • View Profile
    • WanderingWinder YouTube Page
Re: Learning AI?
« Reply #13 on: June 08, 2013, 07:47:20 am »
+2

Why is it so complex? It would just be an implementation of an artificial neural network. Sure, it will take a few months to build a good database, but it should not be a problem of implementation.
I mean robots learn walking and flipping flapjacks "by themselves" with a relatively small amount of programming work involved, so why shouldn't it work for dominion? A Dominion game has a pretty low number of possible moves in a turn, because there are only 10 kingdom cards. It is not like Go where there are about 250 possible moves each turn which you have to evaluate. The number "real" of legal moves in Dominion is rather low most of the time, like in chess or in backgammon. "Real" means moves that actually make a difference. It doesn't make any difference if you play your Gold before your Silver or trash the first Copper in your hand instead of the second copper.
"There are only 10 possible kingdom cards" really implies an underestimation of the amount of complexity. There are all kinds of play decisions. I mean, okay, if you are playing just big money, maybe there aren't so many. But I have 4 actions - which order do I play them in? Sometimes it is obvious, a lot of times not quite, but the bigger issue is that the usually right rules most often have some exceptions, and this just kills you. Indeed, just whether or not to play a card to trigger a reshuffle can be pretty tricky.
Further, there are 10 kingdom cards, yes. But there are also 7 cards included in every game. And in a large percentage of games, there are other cards as well. So you are usually looking at 18ish different tings you could buy. Now, especially given that you often don't have the money to buy these, that's not so bad (it's a little simpler than most chess positions). But now I have two buys. Or three buys. Or seven buys. What do I do now? Not to mention ta the question of what to buy is dependent on *way* more than what is available, or what is available and what you can possibly do. What is in your deck? What is your opponent doing? What is going to be possible 5 turns from now?

But actually, the problem I think they're referring to is "Depends on the Kingdom". Yes, you can probably make an AI that learns one kingdom pretty well without *that* much work. But give it a new kingdom and it will be lost. Making one that can handle any kingdom is extraordinarily complex, and there are zany numbers of possible kingdoms.

ragingduckd

  • Saboteur
  • *****
  • Offline Offline
  • Posts: 1059
  • Respect: +3527
    • View Profile
Re: Learning AI?
« Reply #14 on: June 08, 2013, 03:02:13 pm »
0

It is not like Go where there are about 250 possible moves each turn which you have to evaluate. The number "real" of legal moves in Dominion is rather low most of the time, like in chess or in backgammon.

There are "only" about 10^120 possible chess games, but solving that game tree is intractable beyond our wildest computational dreams.  Chess engines work by looking only modest number of moves into the future and choosing the best-looking intermediate outcome.

The lynchpin is deciding whether an intermediate outcome looks good or not.  It's relatively easy in chess, because differences in material are so important... losing your queen almost always matters more than the position on the rest of the board.  Robots that learn to walk use similarly simple heuristics... falling down is bad.

Assessing intermediate outcomes is harder in go because position often trumps material.  You can come out ahead by letting some stones get captured in exchange for a positional advantage elsewhere on the board.  Assessing positional strength is harder than counting queens, knights, and pawns, and go AIs are correspondingly weaker than chess AIs.

For all the reasons WW describes, assessing intermediate outcomes in Dominion is outrageously difficult.  Without that piece of the algorithm, Dominion AI's don't stand a chance.
Logged
Salvager Extension | Isotropish Leaderboard | Game Data | Log Search & other toys | Salvager Bug Reports

Salvager not working for me at all today. ... Please help! I can't go back to playing without it like an animal!

ftl

  • Mountebank
  • *****
  • Offline Offline
  • Posts: 2056
  • Shuffle iT Username: ftl
  • Respect: +1345
    • View Profile
Re: Learning AI?
« Reply #15 on: June 08, 2013, 05:03:54 pm »
+1

I'd go the other way - I think you're understating the difficulty of Chess and Walking. They both seem easy because there've been countless, countless teams of people spending lots of time thinking and working on it for many years.

I would not be surprised that if you had a team of a few experienced programmers and/or Computer Science Ph.Ds spend a year or two working on it full-time, you would get a Dominion AI that plays as well as the best human players. But I don't think it's the sort of thing that a hobbyist would put together in their spare time over a couple of months.
« Last Edit: June 08, 2013, 05:10:35 pm by ftl »
Logged

DG

  • Governor
  • *****
  • Offline Offline
  • Posts: 4074
  • Respect: +2624
    • View Profile
Re: Learning AI?
« Reply #16 on: June 08, 2013, 06:04:49 pm »
0

Don't be fooled by the existing bots. They generally make linear decisions. So if they play a warehouse they make all the decisions for the warehouse and discard the bad cards, only to find they don't have a copper in hand with a moneylender. As soon as you go beyond linear decisions it becomes very difficult very quickly. Even something simple like deciding to play a mandarin or goons as a terminal action can have a lot of consequences that a human player can analyze but a bot cannot.

Some of the learning AIs can substitute trial and error for logical decision making. For these AIs there is a difficulty in separating out the decision criteria that will be measured in each trial. So for the goons vs mandarin example, exactly what criteria will you measure by when deciding which card to play in each trial game?
« Last Edit: June 08, 2013, 06:14:17 pm by DG »
Logged

ragingduckd

  • Saboteur
  • *****
  • Offline Offline
  • Posts: 1059
  • Respect: +3527
    • View Profile
Re: Learning AI?
« Reply #17 on: June 08, 2013, 08:05:27 pm »
+1

I'd go the other way - I think you're understating the difficulty of Chess and Walking. They both seem easy because there've been countless, countless teams of people spending lots of time thinking and working on it for many years.

I would not be surprised that if you had a team of a few experienced programmers and/or Computer Science Ph.Ds spend a year or two working on it full-time, you would get a Dominion AI that plays as well as the best human players. But I don't think it's the sort of thing that a hobbyist would put together in their spare time over a couple of months.

That's a reasonable-sounding story, but I don't think it's technically or historically accurate for chess.  To be fair, I don't actually know anything about teaching computers to walk. ;)

Chess AIs were winning games against GMs in the late 70s using essentially the same algorithms that they use today (and which were invented in the 1950s).  Chess just happens to lend itself to evaluation using algorithms that were natural for humans to invent and for computers to implement.

Far more effort has gone into more useful areas of AI with far less success, and the same is true for AI in other popular games.  Go can't be addressed nearly as effectively with minimax search and AB pruning, and it's not hard to guess that these algorithms wouldn't do much for a Dominion AI either.
Logged
Salvager Extension | Isotropish Leaderboard | Game Data | Log Search & other toys | Salvager Bug Reports

Salvager not working for me at all today. ... Please help! I can't go back to playing without it like an animal!

blueblimp

  • Margrave
  • *****
  • Offline Offline
  • Posts: 2849
  • Respect: +1559
    • View Profile
Re: Learning AI?
« Reply #18 on: June 08, 2013, 08:27:46 pm »
+3

Why is it so complex? It would just be an implementation of an artificial neural network.
Neural networks aren't magic bullets. They need careful selection of inputs & outputs and fine-tuning. They are also not at all guaranteed to work for any particular problem, and are just one component of a solution anyway even when they do work.
Logged

sudgy

  • Cartographer
  • *****
  • Offline Offline
  • Posts: 3431
  • Shuffle iT Username: sudgy
  • It's pronounced "SOO-jee"
  • Respect: +2707
    • View Profile
Re: Learning AI?
« Reply #19 on: June 13, 2013, 01:38:20 am »
+1

I've thought of something that miiiiiiiiiiiiiight work.  No promises, I'll try to program it and if it works say how it works.  Now, off I go to program the entire game first...
Logged
If you're wondering what my avatar is, watch this.

Check out my logic puzzle blog!

   Quote from: sudgy on June 31, 2011, 11:47:46 pm

ftl

  • Mountebank
  • *****
  • Offline Offline
  • Posts: 2056
  • Shuffle iT Username: ftl
  • Respect: +1345
    • View Profile
Re: Learning AI?
« Reply #20 on: June 13, 2013, 02:35:16 am »
0

Good luck! I tried at one point, but it was just so much work I never really made any progress.
Logged

Davio

  • 2012 Dutch Champion
  • *
  • Offline Offline
  • Posts: 4787
  • Respect: +3413
    • View Profile
Re: Learning AI?
« Reply #21 on: June 13, 2013, 06:25:12 am »
0

Doesn't the randomness of shuffling also make it a lot harder?
Every time you shuffle you're generating a new branch for our tree and in fact if you want to be exact you have to create a branch for every possible shuffle. You can cut back a bit by eliminating duplicates (Copper 1 is the same as Copper 2), but still, it gets to a very high number very fast.

So if we want to cut back on the number of branches, we have to do some pruning, but how do we do that? I guess the best way is to just create some random branches instead of a branch for every shuffle and evaluate the game state for each.

But how do we evaluate the game state? Counting VPs seems bad because of mega-turn engines. Average buying power then? Well, that's a bit shortsighted as we have to take our opponent and attacks into account. Attacks give us less buying power, but also limits that of our opponent.

And we can't even begin to try to do something with Goons or Monument, let alone Gardens.
Logged

BSG: Cagprezimal Adama
Mage Knight: Arythea

Warfreak2

  • Saboteur
  • *****
  • Offline Offline
  • Posts: 1149
  • KC->KC->[Scavenger, Scavenger, Lookout]
  • Respect: +1324
    • View Profile
    • Music what I do
Re: Learning AI?
« Reply #22 on: June 13, 2013, 07:20:46 am »
+1

This sounds like a job for a Monte-Carlo tree search algorithm.

Your positional evaluation function would be, play out a large number of games from this point, following your buy order and some simple play rules, and count the proportion of them that you win. A similar thing has been very effective for Go AIs.
Logged
If the only engine on the board is Procession->Conspirator, I will play it.

sudgy

  • Cartographer
  • *****
  • Offline Offline
  • Posts: 3431
  • Shuffle iT Username: sudgy
  • It's pronounced "SOO-jee"
  • Respect: +2707
    • View Profile
Re: Learning AI?
« Reply #23 on: June 13, 2013, 12:25:55 pm »
+1

I'm doing it in a COMPLETELY different way than you would think.  I will say, at the beginning it will always do random things.

But how do we evaluate the game state? Counting VPs seems bad because of mega-turn engines. Average buying power then? Well, that's a bit shortsighted as we have to take our opponent and attacks into account. Attacks give us less buying power, but also limits that of our opponent.

I have an idea for this, but this will be the hardest thing to do.
Logged
If you're wondering what my avatar is, watch this.

Check out my logic puzzle blog!

   Quote from: sudgy on June 31, 2011, 11:47:46 pm

sudgy

  • Cartographer
  • *****
  • Offline Offline
  • Posts: 3431
  • Shuffle iT Username: sudgy
  • It's pronounced "SOO-jee"
  • Respect: +2707
    • View Profile
Re: Learning AI?
« Reply #24 on: June 20, 2013, 01:12:58 am »
+1

Yay, the Cellar now works correctly!  This will take a while...  (If you notice, the Cellar is the first card in the card lists...)

EDIT: Cards are seeming to be easier now, just finished Chapel.  Worst problem was probably that it said I "trahed" a card...  (Also, I'm not going to say when I finish with every single card)
« Last Edit: June 20, 2013, 01:33:39 am by sudgy »
Logged
If you're wondering what my avatar is, watch this.

Check out my logic puzzle blog!

   Quote from: sudgy on June 31, 2011, 11:47:46 pm
Pages: [1]
 

Page created in 0.054 seconds with 20 queries.