From cb11d841ecea5c55df6a73bff33eaac7cf477861 Mon Sep 17 00:00:00 2001 From: Nathan Vance Date: Thu, 12 Mar 2015 12:41:29 -0400 Subject: Now cannot buy two of the same card --- ai.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ai.c') diff --git a/ai.c b/ai.c index 7bb9f86..1eb8c11 100644 --- a/ai.c +++ b/ai.c @@ -15,6 +15,7 @@ int weight_buildcard(int era, int card, int player); int weight_buildwonder(int player); int* cards_getproduction(int era, int card); int* cards_getcost(int era, int card); +int data_hasbuiltname(int p, int era, int card); int* ai_bestcard(int *hand, int player) //return card { @@ -23,7 +24,7 @@ int* ai_bestcard(int *hand, int player) //return card int card = 0; for(i = 0; hand[i] != -1 && i < 7; i++) { temp = weight_buildcard(data_getera(), hand[i], player); - if(! data_canafford(player, data_getera(), hand[i])) + if(! data_canafford(player, data_getera(), hand[i]) || data_hasbuiltname(player, data_getera(), hand[i])) temp = 0; if(temp > max) { max = temp; -- cgit