I need an algorithm that check some arrays and if the condition was true * all of them at -1
// Otello.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
static int bazi[8][8] = { 0 };
int turn = 1;
int len = 0, wei = 0;
void namayesh()
{
for (int i = 0; i < 8; i++)
{
for (int j = 0; j < 8; j++)
{
if (bazi[i][j] == 1)
{
cout << "W" << "\t";
}
else if (bazi[i][j] == -1)
{
cout << "B" << "\t";
}
else
{
cout << bazi[i][j] << "\t";
}
}
cout << endl << endl;
}
}
void adadgiri()
{
cin >> len >> wei;
if (bazi[len][wei] == 0)
{
bazi[len][wei] = turn;
}
else
{
cin >> len >> wei;
bazi[len][wei] = turn;
}
turn *= -1;
}
int counterleft(int cl) // need help for this part ????????
{
//// cl == counterleft
if (bazi[cl][wei] == 1) return(bazi[cl][wei] *= -1 );
else if (bazi[cl][wei] == -1) return(counterleft(bazi[cl-1][wei]));
}
int _tmain(int argc, _TCHAR* argv[])
{
int cl = len-1;
bazi[3][3] = 1;
bazi[3][4] = -1;
bazi[4][3] = -1;
bazi[4][4] = 1;
for (int i = 0; i < 8; i++)
{
for (int j = 0; j < 8; j++)
{
namayesh();
adadgiri();
counterleft(cl);
}
}
return 0;
}