PraktikumOthello/players/playerlib.cc

34 lines
672 B
C++
Raw Normal View History

2015-03-07 17:18:50 +01:00
#include <stdio.h>
#include <stdlib.h>
#include "playerlib.h"
char enemyc = 0, ownc = 0;
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;
}