diff options
author | Nathan Vance <nathav63@gmail.com> | 2015-03-11 20:51:33 -0400 |
---|---|---|
committer | Nathan Vance <nathav63@gmail.com> | 2015-03-11 20:51:33 -0400 |
commit | 0d0206dd0a9a1bb53913a76b0ae6179bb627074e (patch) | |
tree | 35948bee50afb58efe124a34d3f609f721773f50 /data.c | |
parent | Started work on ai (diff) | |
download | 7w-0d0206dd0a9a1bb53913a76b0ae6179bb627074e.tar.gz 7w-0d0206dd0a9a1bb53913a76b0ae6179bb627074e.tar.bz2 7w-0d0206dd0a9a1bb53913a76b0ae6179bb627074e.zip |
Implemented basic ai
Diffstat (limited to 'data.c')
-rw-r--r-- | data.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -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; |