octachrome / treason

A clone of the card game Coup written in Node.js
Other
138 stars 79 forks source link

Randomized AI choices by 10%. #12

Closed einsteinsfool closed 7 years ago

einsteinsfool commented 7 years ago

Before the commit, AI taking income means that he has assassin 100%. Other choices also reveals too much, imo. E.g. AI will never take income, exchange or take tax when it has an assassin or a captain. Now, 10% of times AI will make a different decision, to spice things up and perhaps confuse opponents.

I also made AI coup somebody asap, because imo it's a safer play. If you don't coup asap, someone might steal from you or kill you because you have more money. Before you wouldn't coup only if you could assassinate without bluffing. But then somebody might have contessa. So imo it's better to coup first to reduce chances of contessa and then assassinate.

But I might add another PR not to coup asap when you have captain or ambassador and when nobody can coup or assassinate you in that time. Or something more elaborate - I'll think about that.

Feel free to edit randomizeChoice to increase or decrease randomness.