hi
i have a 2 dimensional array where im trying to create an object (territory) in an if statement when the array is searched and when a certain number is found eg [0][0] a territory is created and placed there?
so far i have writen a few lines but im stumped on creating the object? any help would be create thanks
private Territory[][] createTerritori es()
{
final int _ = -1;
final int[][] map = { { _, _, _, _, _, _, _, _, _, _, _, _, _, _ },
{ _, _, _, _, 0, 0, _, _, _, _, 2, _, _, _ },
{ 0, 0, 0, 0, 0, 0, _, 2, 2, 2, 2, 2, 2, 2 },
{ _, 0, 0, 0, _, _, _, 2, 2, 2, 2, 2, _, _ },
{ _, _, 0, 0, _, _, 2, _, 2, 2, 2, 2, _, _ },
{ _, _, 0, _, _, _, 3, 3, 2, 2, 2, _, _, _ },
{ _, _, _, 1, 1, _, 3, 3, 3, _, _, 4, _, _ },
{ _, _, _, 1, 1, _, _, 3, 3, _, _, 4, 4, _ },
{ _, _, _, 1, 1, _, _, 3, _, _, _, 4, 4, _ },
{ _, _, _, _, 1, _, _, _, _, _, _, _, _, _ } };
Territory[][] territories = new Territory[TERRITORY_ROWS][TERRITORY_COLS];
for (int row = 0; row < TERRITORY_ROWS; row++)
{
for (int col = 0; col < TERRITORY_COLS; col++)
{
if (int[row][col] map = 0;)
????
i have a 2 dimensional array where im trying to create an object (territory) in an if statement when the array is searched and when a certain number is found eg [0][0] a territory is created and placed there?
so far i have writen a few lines but im stumped on creating the object? any help would be create thanks
private Territory[][] createTerritori es()
{
final int _ = -1;
final int[][] map = { { _, _, _, _, _, _, _, _, _, _, _, _, _, _ },
{ _, _, _, _, 0, 0, _, _, _, _, 2, _, _, _ },
{ 0, 0, 0, 0, 0, 0, _, 2, 2, 2, 2, 2, 2, 2 },
{ _, 0, 0, 0, _, _, _, 2, 2, 2, 2, 2, _, _ },
{ _, _, 0, 0, _, _, 2, _, 2, 2, 2, 2, _, _ },
{ _, _, 0, _, _, _, 3, 3, 2, 2, 2, _, _, _ },
{ _, _, _, 1, 1, _, 3, 3, 3, _, _, 4, _, _ },
{ _, _, _, 1, 1, _, _, 3, 3, _, _, 4, 4, _ },
{ _, _, _, 1, 1, _, _, 3, _, _, _, 4, 4, _ },
{ _, _, _, _, 1, _, _, _, _, _, _, _, _, _ } };
Territory[][] territories = new Territory[TERRITORY_ROWS][TERRITORY_COLS];
for (int row = 0; row < TERRITORY_ROWS; row++)
{
for (int col = 0; col < TERRITORY_COLS; col++)
{
if (int[row][col] map = 0;)
????
Comment