Fix: finding moves doesn't end at the end of row/col

This commit is contained in:
Trolli Schmittlauch 2015-03-11 16:00:43 +01:00
parent a9399ddf06
commit ff7d0ffa7a

View file

@ -67,10 +67,10 @@ fillMovesList(cell (*field)[fieldWidth], movesList *moves, size_t row, size_t co
int int
findHorizontalForwardMoves(cell (*field)[fieldWidth], movesList *moves) { findHorizontalForwardMoves(cell (*field)[fieldWidth], movesList *moves) {
//Anzahl eigener/gegnerischer Steine
unsigned int ownCount = 0, enemyCount = 0;
for (size_t row = 0;row < fieldHeight; ++row) for (size_t row = 0;row < fieldHeight; ++row)
{ {
//Anzahl eigener/gegnerischer Steine
unsigned int ownCount = 0, enemyCount = 0;
for (size_t col = 0;col < fieldWidth; ++col) for (size_t col = 0;col < fieldWidth; ++col)
{ {
fillMovesList(field, moves, row, col, &ownCount, &enemyCount); fillMovesList(field, moves, row, col, &ownCount, &enemyCount);
@ -81,10 +81,10 @@ findHorizontalForwardMoves(cell (*field)[fieldWidth], movesList *moves) {
int int
findHorizontalBackwardMoves(cell (*field)[fieldWidth], movesList *moves) { findHorizontalBackwardMoves(cell (*field)[fieldWidth], movesList *moves) {
//Anzahl eigener/gegnerischer Steine
unsigned int ownCount = 0, enemyCount = 0;
for (int row = 7; row >= 0; --row) for (int row = 7; row >= 0; --row)
{ {
//Anzahl eigener/gegnerischer Steine
unsigned int ownCount = 0, enemyCount = 0;
for (int col = 7; col >= 0; --col) for (int col = 7; col >= 0; --col)
{ {
fillMovesList(field, moves, row, col, &ownCount, &enemyCount); fillMovesList(field, moves, row, col, &ownCount, &enemyCount);
@ -95,10 +95,10 @@ findHorizontalBackwardMoves(cell (*field)[fieldWidth], movesList *moves) {
int int
findVerticalForwardMoves(cell (*field)[fieldWidth], movesList *moves) { findVerticalForwardMoves(cell (*field)[fieldWidth], movesList *moves) {
//Anzahl eigener/gegnerischer Steine
unsigned int ownCount = 0, enemyCount = 0;
for (size_t col = 0;col < fieldHeight; ++col) for (size_t col = 0;col < fieldHeight; ++col)
{ {
//Anzahl eigener/gegnerischer Steine
unsigned int ownCount = 0, enemyCount = 0;
for (size_t row = 0;row < fieldWidth; ++row) for (size_t row = 0;row < fieldWidth; ++row)
{ {
fillMovesList(field, moves, row, col, &ownCount, &enemyCount); fillMovesList(field, moves, row, col, &ownCount, &enemyCount);
@ -109,10 +109,10 @@ findVerticalForwardMoves(cell (*field)[fieldWidth], movesList *moves) {
int int
findVerticalBackwardMoves(cell (*field)[fieldWidth], movesList *moves) { findVerticalBackwardMoves(cell (*field)[fieldWidth], movesList *moves) {
//Anzahl eigener/gegnerischer Steine
unsigned int ownCount = 0, enemyCount = 0;
for (int col = 7; col >= 0; --col) for (int col = 7; col >= 0; --col)
{ {
//Anzahl eigener/gegnerischer Steine
unsigned int ownCount = 0, enemyCount = 0;
for (int row = 7; row >= 0; --row) for (int row = 7; row >= 0; --row)
{ {
fillMovesList(field, moves, row, col, &ownCount, &enemyCount); fillMovesList(field, moves, row, col, &ownCount, &enemyCount);