Page 1 of 1

Improvements to Puerto Rico Evolver / DNA switching

PostPosted: Wed Sep 19, 2012 9:33 am
by ChrisGibbs
One of the main criticisms that can be levelled at Puerto Rico Evolver is the inflexibility of strategies - each player can switch tactics according to whether it's early / middle / late in the game, but they don't really look around to see what other players are doing. I recently realised that each player could just have an extra set of DNA (with the same length and parameters as the current one) to use as an "alternate" strategy when the conditions are right. This gets better and better the more I think about it, and is capable of expressing at least the following more complex strategies:

- For a building strategy depending on Guild Hall (or shipping depending on customs house etc), change strategy if someone else pinches it before you.
- If at some point in the game the player has X amount of cash more than anyone else, change to say a building strategy whilst others are poor, and change back when condition is no longer met.
- If a certain amount of VPs ahead, then change to say a shipping strategy to try and finish the game as soon as possible.

The main focus for the possible condition tests is ones which look around to see what others are doing, yet are simple enough to not affect CPU usage / overall evolver speed and thus evolution over millions of games remains fast. This should result in AI players that are far better able to adapt to changing conditions.

Programming it should be fairly straightforward as the main and alternate DNA will have identical format, with the switch test being executed say once per round and then swapping the DNA over if the condition is met.

DNA Structure

My proposed structure for the DNA for the switch test would be something along these lines:

[switch limit per game, with 0 = no limit] [condition one] [(optional) and/or] [(optional) condition two]

E.g. "1bS" would be a test that can see if guild hall has been taken, and if condition is ever met, the strategy can only be switched once during the game (so that the player ends up using the alternate DNA until the end of the game once switched).

Evolution of the expanded DNA

The only possibly tricky part is coding the evolution process. Possible ideas include randomly switching the main and alternate DNA around, as well as merging with opposite strands. Naturally the switch test should also be a part of the evolution process, with it randomly coming from either parent, with possible random mutation.

Porting the improvements into Tropic Euro / backward compatibility

Once the Excel work is done, some brand new sets of players can be evolved which are able to recognise the switch test. These would then be incorporated into Tropic Euro as a separate difficulty player, probably called "CPU Max". Doing a Java port of the switch test above can be done with hardly any effort once the Excel work is complete.

The improvements to the Puerto Rico Evolver should allow for existing old-style DNA to be used as well, so that the best player testers can test all of the current best players against new switching-DNA players. This should be pretty simple to implement, with probably just a check to see if the switch test and alternate DNA columns are blank or not.

Are you an Excel programmer?

This feature can be developed almost independently of the other features on the Tropic Euro roadmap. If you would like to help with these proposed improvements to the Puerto Rico Evolver then please email - I will probably get round to doing this eventually if there are no offers, but if anyone would like to help then that would be really appreciated.

Re: Improvements to Puerto Rico Evolver / DNA switching

PostPosted: Tue Feb 17, 2015 8:09 am
by ChrisGibbs
Also note that user durron597 has come up with some excellent suggestions for improving the AI, please see that thread as well.