правильно ли работает программа
#include <iostream>
#include<ctime>

using namespace std;


int main()
{
	const int  a = 9, b = 9;//ширина и длина поля (размеры массива)
	int i, j, kol = 0;  // kol - количество живых клеток, которые окружают данную клетку
	int** osn = new int* [a ];
	for ( i = 0; i < a; i++) osn[i] = new int[b + 1];// положение на следующем шаге
	int** pred = new int* [a];
	for ( i = 0; i < a; i++) pred[i] = new int[b + 1];//положение на предыдущем  шаге
	srand(time(NULL));
	for (i = 0; i < a; i++)
	{
		for (j = 0; j < b; j++) {
			osn[i][j] = rand() % 2;  // заполнение поля числами 0 или 1
		//	osn[i][j] = 1;
			cout << osn[i][j] << ' ';
		}
		cout << endl;
	}

	for (i = 0; i < a; i++)
	{
		for (j = 0; j < b; j++) {
			pred[i][j] = osn[i][j];
		}
	}
	/***********************************************/
	// внутри
	/**********************************************/
	for (i = 1; i < a - 1; i++)
	{
		for (j = 1; j < b - 1; j++) {
			kol = 0;
			for (int l = i - 1; l < i + 2; l++)
			{
				if (pred[l][j - 1] == 1)
				{
					kol += 1;
				}
				if (pred[l][j + 1] == 1)
				{
					kol += 1;
				}
			}
			if (pred[i - 1][j] == 1)
			{
				kol += 1;
			}
			if (pred[i + 1][j] == 1)
			{
				kol += 1;
			}
			if ((pred[i][j] == 0 && kol == 3)|| (pred[i][j] == 1 && (kol == 2 || kol == 3)))
			{
				osn[i][j] = 1;
			}
			else
			{
				osn[i][j] = 0;
			}
		}

	}
	/***********************************************/
		// граница
		/**********************************************/
	kol = 0;
	/**********************************************/
	//левый верхний
	/**********************************************/
	if (pred[a - 1][b - 1] == 1) kol += 1;//1
	if (pred[a - 1][0] == 1) kol += 1;//2
	if (pred[a - 1][1] == 1) kol += 1;//3
	if (pred[0][b - 1] == 1) kol += 1;//4
	if (pred[1][b - 1] == 1) kol += 1;//5
	if (pred[1][1] == 1) kol += 1;//6
	if (pred[0][1] == 1) kol += 1;//7
	if (pred[1][0] == 1) kol += 1;//8
	if ((pred[0][0] == 0 && kol == 3)|| (pred[0][0] == 1 && (kol == 3 || kol == 2)))
	{
		osn[0][0] = 1;
	}
	else
	{
		osn[0][0] = 0;
	}

	/**********************************************/
	//левый столбец
	/**********************************************/
	for (int i = 1; i < a - 1; i++)
	{
		kol = 0;
		for (int l = i - 1; l < i + 2; l++)
		{
				if (pred[l][b - 1] == 1)
				{
					kol += 1;
				}
				if (pred[l][1] == 1)
				{
					kol += 1;
			}

		}
		if (pred[i - 1][0] == 1)
		{
			kol += 1;
		}
		if (pred[i + 1][0] == 1)
		{
			kol += 1;
		}

	if ((pred[i][0] == 0 && kol == 3)|| (pred[i][0] == 1 && (kol == 3 || kol == 2)))
	{
		osn[i][0] = 1;
	}
	else
	{
		osn[i][0] = 0;
	}	
	}
	/**********************************************/
	//верхний правый
	/**********************************************/
	kol = 0;
	if (pred[0][0] == 1) kol += 1;//1
	if (pred[0][b - 2] == 1) kol += 1;//2
	if (pred[a - 1][b - 2] == 1) kol += 1;//3
	if (pred[a - 1][b - 1] == 1) kol += 1;//4
	if (pred[a - 1][0] == 1) kol += 1;//5
	if (pred[1][b - 2] == 1) kol += 1;//6
	if (pred[2][b - 1] == 1) kol += 1;//7
	if (pred[1][0] == 1) kol += 1;//8
	if ((pred[0][b - 1] == 0 && kol == 3)|| (pred[0][b - 1] == 1 && (kol == 3 || kol == 2)))
	{
		osn[0][b - 1] = 1;
	}
	else
	{
		osn[0][b - 1] = 0;
	}
	/**********************************************/
	//нижняя строка
	/**********************************************/
	for (int j = 1; j < b - 1; j++)
	{
		kol = 0;
		for (int l = j - 1; l < j + 2; l++)
		{
			{
				if (pred[0][l] == 1)
				{
					kol += 1;
				}
				if (pred[a - 2][l] == 1)
				{
					kol += 1;
				}
			}

		}
		if (pred[a - 1][j - 1] == 1)
		{
			kol += 1;
		}
		if (pred[a - 1][j + 1] == 1)
		{
			kol += 1;
		}

	if ((pred[a - 1][j] == 0 && kol == 3)|| (pred[a - 1][j] == 1 && (kol == 3 || kol == 2)))
	{
		osn[a - 1][j] = 1;
	}
	else
	{
		osn[a - 1][j] = 0;
	}	
	}
	/***********************************************/
	// правый нижний
	/**********************************************/
	kol = 0;
	if (pred[0][b - 2] == 1) kol += 1;//1
	if (pred[0][b - 1] == 1) kol += 1;//2
	if (pred[0][0] == 1) kol += 1;//3
	if (pred[a - 1][b - 2] == 1) kol += 1;//4
	if (pred[a - 1][0] == 1) kol += 1;//5
	if (pred[a - 2][b - 2] == 1) kol += 1;//6
	if (pred[a - 2][b - 1] == 1) kol += 1;//7
	if (pred[a - 2][0] == 1) kol += 1;//8
	if ((pred[a - 1][b - 1] == 0 && kol == 3)|| (pred[a - 1][b - 1] == 1 && (kol == 3 || kol == 2)))
	{
		osn[a - 1][b - 1] = 1;
	}
	else
	{
		osn[a - 1][b - 1] = 0;
	}
	/**********************************************/
	//правый столбец
	/**********************************************/
	for (int i = 1; i < a - 1; i++)
	{
		kol = 0;
		for (int l = i - 1; l < i + 2; l++)
		{
			{
				if (pred[l][b - 2] == 1)
				{
					kol += 1;
				}
				if (pred[l][0] == 1)
				{
					kol += 1;
				}
			}

		}
		if (pred[i - 1][b - 1] == 1)
		{
			kol += 1;
		}
		if (pred[i + 1][b - 1] == 1)
		{
			kol += 1;
		}

	if ((pred[i][b-1] == 0 && kol == 3)|| (pred[i][b - 1] == 1 && (kol == 3 || kol == 2)))
	{
		osn[i][b-1] = 1;
	}
	else
	{
		osn[i][b-1] = 0;
	}	

	}
	/***********************************************/
	// левый нижний
	/**********************************************/
	kol = 0;
	if (pred[0][b - 1] == 1) kol += 1;//1
	if (pred[0][0] == 1) kol += 1;//2
	if (pred[0][1] == 1) kol += 1;//3
	if (pred[a - 1][2] == 1) kol += 1;//4
	if (pred[a - 1][b - 1] == 1) kol += 1;//5
	if (pred[a - 2][b - 0] == 1) kol += 1;//6
	if (pred[a - 2][0] == 1) kol += 1;//7
	if (pred[a - 2][1] == 1) kol += 1;//8
	if ((pred[a - 1][0] == 0 && kol == 3)|| (pred[a - 1][0] == 1 && (kol == 3 || kol == 2)))
	{
		osn[a - 1][0] = 1;
	}
	else
	{
		osn[a - 1][0] = 0;
	}

	/**********************************************/
	//вверх
	/**********************************************/
	for (int j = 1; j < b - 1; j++)
	{
		kol = 0;
		for (int l = j - 1; l < j + 2; l++)
		{
			{
				if (pred[1][l] == 1)
				{
					kol += 1;
				}
				if (pred[a - 1][l] == 1)
				{
					kol += 1;
				}
			}

		}
		if (pred[0][j - 1] == 1)
		{
			kol += 1;
		}
		if (pred[0][j + 1] == 1)
		{
			kol += 1;
		}

	if ((pred[0][j] == 0 && kol == 3)|| (pred[0][j] == 1 && (kol == 3 || kol == 2)))
	{
		osn[0][j] = 1;
	}
	else
	{
		osn[0][j] = 0;
	}
	}
	//вывод результата
	cout << endl;
	for (i = 0; i < a; i++)
	{
		for (j = 0; j < b; j++) {
			cout << osn[i][j] << ' ';
			if (osn[i][j] != pred[i][j]) {
				//	cout << "yes";
			}
		}
		cout << endl;
	}
	for ( i = 0; i < a; ++i)
		delete[] osn[i];
	delete[] osn;
	for (i = 0; i < a; ++i)
		delete[] pred[i];
	delete[] pred;
}