rspeer/dominiate — pull request #70 by DStu-dominion (2012-01-25 19:20:56+00:00)
Title: Don't buy anything if that causes you to lose

I still don't have gotten this git-thing correctly. The last 3 commits are about the "don't buy anything if it kills you"-condition. The first commit from 2011/12/8 is non-sense and about something else, I don't know how I undo it here.
Afais the "don't kill yourself" works correctly. It's directly hard-coded in the game-mechanic, so not implemented in the AI. Every buy that will let the AI lose is not proposed to the AI, so it can not chose something that will kill it. It looks forward through the whole buy-phase, so if you win with say Province+Duchy, but will lose with Province or Duchy, it can buy them both and win. Geronimoo's simulator didn't do this the last time I tested ;)
The problem with this is that at the moment, this only cares for the buyphase, so you can still lose by workshopping the wrong card.