2015-03-07 17:18:50 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "playerlib.h"
|
|
|
|
|
2015-03-08 19:16:27 +01:00
|
|
|
char enemyc = 0;
|
|
|
|
|
2015-03-08 18:40:31 +01:00
|
|
|
char
|
|
|
|
getEnemyChar(char c) {
|
|
|
|
char enemyc;
|
|
|
|
switch(c)
|
|
|
|
{
|
|
|
|
case 'X':
|
|
|
|
enemyc='O'; break;
|
|
|
|
case 'O':
|
|
|
|
enemyc='X'; break;
|
|
|
|
}
|
|
|
|
return enemyc;
|
2015-03-10 13:54:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
readStateBuffer(char *stateBuffer, struct cell (*gameField)[fieldWidth]) {
|
|
|
|
for(size_t row=0; row< fieldHeight; ++row)
|
|
|
|
{
|
|
|
|
for(size_t col=0; col< fieldWidth; ++col)
|
|
|
|
{
|
|
|
|
int index = row*fieldHeight+col+1;
|
|
|
|
gameField[row][col].content = stateBuffer[index];
|
|
|
|
//printf("gameField %lu %lu =stateBuffer %d = %c\n", row, col, index, gameField[row][col].content);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|