diff options
author | Nathan Vance <nathav63@gmail.com> | 2015-02-28 23:21:31 -0500 |
---|---|---|
committer | Nathan Vance <nathav63@gmail.com> | 2015-02-28 23:21:31 -0500 |
commit | f0bbfee11a0418064a142101a952c3043dde7351 (patch) | |
tree | d5105137ea14d3574b2b16c96d8c320870e18dd9 /ai_weights_special.c | |
parent | Correctly toggles (diff) | |
download | 7w-f0bbfee11a0418064a142101a952c3043dde7351.tar.gz 7w-f0bbfee11a0418064a142101a952c3043dde7351.tar.bz2 7w-f0bbfee11a0418064a142101a952c3043dde7351.zip |
Started work on ai
Diffstat (limited to 'ai_weights_special.c')
-rw-r--r-- | ai_weights_special.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/ai_weights_special.c b/ai_weights_special.c new file mode 100644 index 0000000..32c13dd --- /dev/null +++ b/ai_weights_special.c @@ -0,0 +1,40 @@ +#include "7w.h" + +int* data_gettradables(int p); +int data_getdir(int dir, int p); +int data_getgold(int p); + +//dir 0 is east, 1 is west +int weight_tradingpost(int dir, int player) +{ + int weight = 0; + int *trade = data_gettradables(data_getdir(dir, player)); + int *prod = data_gettradables(player); + int i; + for(i = 0; i < CLOTH; i++) { + if(trade[i] && !prod[i]) weight++; + } + return weight; +} + +int weight_marketplace(int player) +{ + int weight = 0; + int i, j; + int *prod = data_gettradables(player); + int *trade; + for(i = 0; i < 2; i++) { + trade = data_gettradables(data_getdir(i, player)); + for(j = CLOTH; j <= PAPER; j++) { + if(trade[j] && !prod[j]) weight++; + } + } + return weight; +} + +int weight_gold(int gold, int player) +{ + return gold - data_getgold(player); +} + + |