aboutsummaryrefslogtreecommitdiff
path: root/ai_weights_special.c
blob: 116842132e1d36394eb63a4361bede4c5d990644 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#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[GOLD+1];
 arraycpy(data_gettradables(player), prod, GOLD+1);
 int trade[GOLD+1];
 for(i = 0; i < 2; i++) {
  arraycpy(data_gettradables(data_getdir(i, player)), trade, GOLD+1);
  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);
}


bgstack15