From 0d0206dd0a9a1bb53913a76b0ae6179bb627074e Mon Sep 17 00:00:00 2001 From: Nathan Vance Date: Wed, 11 Mar 2015 20:51:33 -0400 Subject: Implemented basic ai --- data.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'data.c') 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; -- cgit