Re: [Pio-temporary] Ideas for AI playing development cards

 Re: [Pio-temporary] Ideas for AI playing development cards From: Roland Clobus - 2005-10-19 19:35:02 ```On Sunday 02 October 2005 22:21, Brian Wellington wrote: > On Sat, 1 Oct 2005, Roland Clobus wrote: It's now a few weeks later, but I haven't stopped thinking about this, I was working on the MinGW port. > > Year of Plenty: > > Current: will be played anytime the bank has at least 2 resources. If > > the bank does not contain anything the AI likes, it will request the > > resources for a road, and if the bank is too empty, it will just pick > > something at random. > > > > Proposed: the bank must have at least 2 resources. If the bank does > > not contain anyting the AI likes, determine whether it is possible to > > get enough resources to perform a maritime trade to get the resource > > the AI needs (in the next turn). If not, determine whether the AI is > > allowed to place a road [*1] and the resources are in the bank, and > > request that. If all fails: don't play this card yet. > > I'm a bit confused by this logic. If the bank doesn't contain any > resources the AI wants, it doesn't matter whether the AI can get enugh > resources to be able to perform a maritime trade next turn, since there's > a good chance there still won't be any resources it wants, and it also > means the AI is more likely to have over 7 cards. You're right. The AI takes two risks with that scenario. > I wonder if it would be possible to figure out if the AI is 1-2 cards > short of a city/settlement/road it wants to build, and only play the card > in that case. New proposal: the bank must have at least 2 resources. Determine whether the AI needs one or two cards to buy something, and the resources are in the bank. If not, determine whether the AI is allowed to place a road [*1] and the resources are in the bank, and request that. If all fails: don't play this card yet. > > Monopoly: > > Current: will be played when the other players have at least six > > resources cards in total. If the AI doesn't need anything in > > particular, it will pick the resource that all players have the most > > of. > > > > Proposed: will be played when the other players have at least six > > resources cards in total. If the AI doesn't need anything in > > particular, don't play it yet. > > Agreed, although I wonder if the AI should take into account the number of > cards. For example, if the AI wants a lumber, and will only get 1 lumber > by playing monopoly, but could get 10 brick, taking the brick would be a > much better idea, since it could do a 4:1 (or better) trade and still come > out way ahead. I think the minimum number of resources cards in the hands of the other players was added to prevent the monopoly card to be played too early. If the AI would gain only one card, would it be worth it to play the card? (I think only when it will result in the final victory point) Because the AI can see how many resources are still in the bank, it can make an accurate guess of the profits of playing the card. If the AI wants a specific resource, it could alternatively try to get it from maritime trade, after playing the Monopoly card for the abundant resource (but it must be sure that it gets enough cards to perform the trade and to buy something). > > Gold: > > Current: when the AI does want something, get it. Otherwise, start > > emptying the bank starting from the first resource. > > > > Proposed: when the AI does want something, get it. Otherwise, start > > emptying the bank starting from the resource that has the best > > maritime trade ratio. > > Unlike the dev cards, gold can't be deferred until later, so there might > be situations where the AI doesn't want anything because it can, for > example, already build a settlement. It might be worth it to figure out > what the AI will do first, and if its first action is to buy something, > re-evaluate what it would want after buying it, then choose that, falling > back to something like your suggestion afterwards. This might be too > complicated, though, and your idea would still help. Sounds like a good idea. It is more complicated though. Perhaps this can be changed in two steps. Roadbuilding: see task #120371. Regards, Roland Clobus ```

 [Pio-temporary] Ideas for AI playing development cards From: Roland Clobus - 2005-10-02 19:47:36 ```Hello all, There was a bug in the AI that prompted me to look a little closer at the AI code. I think the AI could make better decisions when to play a development card. The AI is called greedy, so it should get as much resources and build as fast as it can, but I think it could delay some actions when it will have no direct benefit. Year of Plenty: Current: will be played anytime the bank has at least 2 resources. If the bank does not contain anything the AI likes, it will request the resources for a road, and if the bank is too empty, it will just pick something at random. Proposed: the bank must have at least 2 resources. If the bank does not contain anyting the AI likes, determine whether it is possible to get enough resources to perform a maritime trade to get the resource the AI needs (in the next turn). If not, determine whether the AI is allowed to place a road [*1] and the resources are in the bank, and request that. If all fails: don't play this card yet. Monopoly: Current: will be played when the other players have at least six resources cards in total. If the AI doesn't need anything in particular, it will pick the resource that all players have the most of. Proposed: will be played when the other players have at least six resources cards in total. If the AI doesn't need anything in particular, don't play it yet. Road building: Current: play whenever two or more road segments are left. Proposed: play whenever two or more road segments are left, but not when road segments are not allowed to be built [*1] Gold: Current: when the AI does want something, get it. Otherwise, start emptying the bank starting from the first resource. Proposed: when the AI does want something, get it. Otherwise, start emptying the bank starting from the resource that has the best maritime trade ratio. Regards, Roland Clobus [*1] Sometimes the AI is not allowed to build a road. Otherwise it would just build roads, and skip building settlements (which require also brick and wood) ```
 Re: [Pio-temporary] Ideas for AI playing development cards From: Brian Wellington - 2005-10-02 20:21:18 ```On Sat, 1 Oct 2005, Roland Clobus wrote: > There was a bug in the AI that prompted me to look a little closer at > the AI code. > > I think the AI could make better decisions when to play a development > card. The AI is called greedy, so it should get as much resources and > build as fast as it can, but I think it could delay some actions when > it will have no direct benefit. This sounds like a good idea. > > Year of Plenty: > Current: will be played anytime the bank has at least 2 resources. If > the bank does not contain anything the AI likes, it will request the > resources for a road, and if the bank is too empty, it will just pick > something at random. > > Proposed: the bank must have at least 2 resources. If the bank does > not contain anyting the AI likes, determine whether it is possible to > get enough resources to perform a maritime trade to get the resource > the AI needs (in the next turn). If not, determine whether the AI is > allowed to place a road [*1] and the resources are in the bank, and > request that. If all fails: don't play this card yet. I'm a bit confused by this logic. If the bank doesn't contain any resources the AI wants, it doesn't matter whether the AI can get enugh resources to be able to perform a maritime trade next turn, since there's a good chance there still won't be any resources it wants, and it also means the AI is more likely to have over 7 cards. I wonder if it would be possible to figure out if the AI is 1-2 cards short of a city/settlement/road it wants to build, and only play the card in that case. > Monopoly: > Current: will be played when the other players have at least six > resources cards in total. If the AI doesn't need anything in > particular, it will pick the resource that all players have the most > of. > > Proposed: will be played when the other players have at least six > resources cards in total. If the AI doesn't need anything in > particular, don't play it yet. Agreed, although I wonder if the AI should take into account the number of cards. For example, if the AI wants a lumber, and will only get 1 lumber by playing monopoly, but could get 10 brick, taking the brick would be a much better idea, since it could do a 4:1 (or better) trade and still come out way ahead. I know I've played monopoly after a ton of cards of one type have been given out, just to use them for trading. > Road building: > Current: play whenever two or more road segments are left. > > Proposed: play whenever two or more road segments are left, but not > when road segments are not allowed to be built [*1] OK. > Gold: > Current: when the AI does want something, get it. Otherwise, start > emptying the bank starting from the first resource. > > Proposed: when the AI does want something, get it. Otherwise, start > emptying the bank starting from the resource that has the best > maritime trade ratio. Unlike the dev cards, gold can't be deferred until later, so there might be situations where the AI doesn't want anything because it can, for example, already build a settlement. It might be worth it to figure out what the AI will do first, and if its first action is to buy something, re-evaluate what it would want after buying it, then choose that, falling back to something like your suggestion afterwards. This might be too complicated, though, and your idea would still help. Brian ```
 Re: [Pio-temporary] Ideas for AI playing development cards From: Roland Clobus - 2005-10-19 19:35:02 ```On Sunday 02 October 2005 22:21, Brian Wellington wrote: > On Sat, 1 Oct 2005, Roland Clobus wrote: It's now a few weeks later, but I haven't stopped thinking about this, I was working on the MinGW port. > > Year of Plenty: > > Current: will be played anytime the bank has at least 2 resources. If > > the bank does not contain anything the AI likes, it will request the > > resources for a road, and if the bank is too empty, it will just pick > > something at random. > > > > Proposed: the bank must have at least 2 resources. If the bank does > > not contain anyting the AI likes, determine whether it is possible to > > get enough resources to perform a maritime trade to get the resource > > the AI needs (in the next turn). If not, determine whether the AI is > > allowed to place a road [*1] and the resources are in the bank, and > > request that. If all fails: don't play this card yet. > > I'm a bit confused by this logic. If the bank doesn't contain any > resources the AI wants, it doesn't matter whether the AI can get enugh > resources to be able to perform a maritime trade next turn, since there's > a good chance there still won't be any resources it wants, and it also > means the AI is more likely to have over 7 cards. You're right. The AI takes two risks with that scenario. > I wonder if it would be possible to figure out if the AI is 1-2 cards > short of a city/settlement/road it wants to build, and only play the card > in that case. New proposal: the bank must have at least 2 resources. Determine whether the AI needs one or two cards to buy something, and the resources are in the bank. If not, determine whether the AI is allowed to place a road [*1] and the resources are in the bank, and request that. If all fails: don't play this card yet. > > Monopoly: > > Current: will be played when the other players have at least six > > resources cards in total. If the AI doesn't need anything in > > particular, it will pick the resource that all players have the most > > of. > > > > Proposed: will be played when the other players have at least six > > resources cards in total. If the AI doesn't need anything in > > particular, don't play it yet. > > Agreed, although I wonder if the AI should take into account the number of > cards. For example, if the AI wants a lumber, and will only get 1 lumber > by playing monopoly, but could get 10 brick, taking the brick would be a > much better idea, since it could do a 4:1 (or better) trade and still come > out way ahead. I think the minimum number of resources cards in the hands of the other players was added to prevent the monopoly card to be played too early. If the AI would gain only one card, would it be worth it to play the card? (I think only when it will result in the final victory point) Because the AI can see how many resources are still in the bank, it can make an accurate guess of the profits of playing the card. If the AI wants a specific resource, it could alternatively try to get it from maritime trade, after playing the Monopoly card for the abundant resource (but it must be sure that it gets enough cards to perform the trade and to buy something). > > Gold: > > Current: when the AI does want something, get it. Otherwise, start > > emptying the bank starting from the first resource. > > > > Proposed: when the AI does want something, get it. Otherwise, start > > emptying the bank starting from the resource that has the best > > maritime trade ratio. > > Unlike the dev cards, gold can't be deferred until later, so there might > be situations where the AI doesn't want anything because it can, for > example, already build a settlement. It might be worth it to figure out > what the AI will do first, and if its first action is to buy something, > re-evaluate what it would want after buying it, then choose that, falling > back to something like your suggestion afterwards. This might be too > complicated, though, and your idea would still help. Sounds like a good idea. It is more complicated though. Perhaps this can be changed in two steps. Roadbuilding: see task #120371. Regards, Roland Clobus ```