function.c
This commit is contained in:
54
function.c
54
function.c
@@ -38,4 +38,58 @@ unsigned short int **creatArea2D(const unsigned int N)
|
||||
return tab2d;
|
||||
}
|
||||
|
||||
int CanIGoUp(unsigned short int **tab,int size,int posX,int posY)
|
||||
{
|
||||
if(tab[posX][posY+1]!=1)
|
||||
{
|
||||
if(tab[posX][posY+1]==2)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
int CanIGoDown(unsigned short int **tab,int size,int posX,int posY)
|
||||
{
|
||||
if(tab[posX][posY-1]!=1)
|
||||
{
|
||||
if(tab[posX][posY-1]==2)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
int CanIGoLeft(unsigned short int **tab,int size,int posX,int posY)
|
||||
{
|
||||
if(tab[posX-1][posY]!=1)
|
||||
{
|
||||
if(tab[posX-1][posY]==2)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
int CanIGoRight(unsigned short int **tab,int size,int posX,int posY)
|
||||
{
|
||||
if(tab[posX+1][posY]!=1)
|
||||
{
|
||||
if(tab[posX+1][posY]==2)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user