0

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;
}
2
Contributors
2
Replies
11
Views
2 Years
Discussion Span
Last Post by arashe
0

it doesnt do any thing
if you enter 3 and then 5 it must be somthing like
WWW
BW0
in the middle
in need help for counterleft() to change the value in line 51,52

Edited by arashe

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.