Firstly, use more sensible names: if you call your variables by names that reflect what they do, it is a lot easier to understand what you are doing. For example, have two variables called userRow and userCol to tell you where the user actually is.
Secondly, use routines to break up your code and make it easier to read:
#include <stdio.h>
#define ROWS_COUNT 4
#define COLS_COUNT 4
#define TRUE (1==1)
int playSurface[ROWS_COUNT][COLS_COUNT]={{1,4,15,7},{8,10,2,11},{14,3,6,13},{12,9,5,-1}};
int userRow = ROWS_COUNT - 1;
int userCol = COLS_COUNT - 1;
int main()
{
int key;
do
{
ShowPlaySurface();
key = GetKey();
if (key == 'Q' || key == 'q')
{
break;
}
DoMove(key);
} while (TRUE);
exit(0);
}
int ShowPlaySurface()
{
int i, j;
for (i = 0; i < ROWS_COUNT; i++)
{
for (j = 0; j < COLS_COUNT; j++)
{
if (i == userRow && j == userCol)
{
printf ("\t");
}
else
{
printf ("%d\t", playSurface[i][j]);
}
}
printf("\n");
}
}
int GetKey()
{
return (int) getch();
}
int DoMove(int key)
{
}
Now, all you have to do is concentrate on the Do Move function - which is just a case of checking keys, and moving in the appropriate direction, if you can. Easy!