aboutsummaryrefslogtreecommitdiff
path: root/data.c
diff options
context:
space:
mode:
authorNathan Vance <nathav63@gmail.com>2015-03-11 20:51:33 -0400
committerNathan Vance <nathav63@gmail.com>2015-03-11 20:51:33 -0400
commit0d0206dd0a9a1bb53913a76b0ae6179bb627074e (patch)
tree35948bee50afb58efe124a34d3f609f721773f50 /data.c
parentStarted work on ai (diff)
download7w-0d0206dd0a9a1bb53913a76b0ae6179bb627074e.tar.gz
7w-0d0206dd0a9a1bb53913a76b0ae6179bb627074e.tar.bz2
7w-0d0206dd0a9a1bb53913a76b0ae6179bb627074e.zip
Implemented basic ai
Diffstat (limited to 'data.c')
-rw-r--r--data.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/data.c b/data.c
index 2763cb8..67e9f48 100644
--- a/data.c
+++ b/data.c
@@ -132,9 +132,19 @@ int data_getdir(int dir, int p)
return p;
}
+int data_getnext(int p)
+{
+ if(era == 0 || era == 2) return data_getwest(p);
+ return data_geteast(p);
+}
+
int* data_gethand(int p)
{
- return hands[(p+turn)%numplayers];
+ int *ret = get_intarray(7);
+ int i;
+ for(i = 0; i < 7; i++)
+ ret[i] = hands[(p+turn)%numplayers][i];
+ return ret;
}
int data_numcards(int p)
@@ -208,7 +218,7 @@ int data_numplayers()
void data_discard(int p, int card)
{
int i;
- int *hand = data_gethand(p);
+ int *hand = hands[(p+turn)%numplayers];
for(i = 0; hand[i] != card; i++);
for(; i < 6; i++) hand[i] = hand[i+1];
hand[6] = -1;
bgstack15