package maze.eng;
public class manage
{
int date = 0;
char[][] theDate;
int x;
int y;
public manage(int theCount)
{
date = theCount;
theDate = new char[date][date];
for(int i = 0; i < date; i++)
{
for(int j = 0; j < date; j++)
{
theDate[i][j] = '1';
}
}
}
public void setManage(int xNum, int yNum, char theIn)
{
theDate[xNum - 1][yNum - 1] = theIn;
}
public char getManage(int xNum, int yNum)
{
return theDate[xNum - 1][yNum - 1];
}
boolean judgeBuild(int xNum, int yNum)
{
int count = 0;
if(xNum == 1 || yNum == 1 || xNum == date || yNum == date)
{
return false;
}
if(theDate[xNum - 2][yNum - 1] == '2')
{
count++;
}
if(theDate[xNum][yNum - 1] == '2')
{
count++;
}
if(theDate[xNum - 1][yNum - 2] == '2')
{
count++;
}
if(theDate[xNum - 1][yNum] == '2')
{
count++;
}
if(count < 2)
{
return true;
}
else
{
return false;
}
}
int judgeGo(int xNum, int yNum)
{
if(theDate[xNum - 1][yNum - 1] == '1')
{
return -1;
}
else if(theDate[xNum - 1][yNum - 1] == '4')
{
return 1;
}
else
{
return 0;
}
}
public int getX()
{
return x;
}
public int getY()
{
return y;
}
public void setX(int xIn)
{
x = xIn;
}
public void setY(int yIn)
{
y = yIn;
}
public void renew()
{
for(int i = 0; i < date; i++)
{
for(int j = 0; j < date; j++)
{
theDate[i][j] = '1';
}
}
}
}