HALLO
i need to write a " mastermind game " and i have some problems with the functions ...hope your can help me..


#define DIGITS 4
#define LINES_IN_PAGE 20
#define NUMBERS_IN_ROW 9
#define ROWS 10
#define COLS 1000
#define STR_CHECK "CHECK"
#define STR_ALL "ALL"
#define STR_QUIT "QUIT"

#include <stdio.h> //for printf, scanf
#include <stdlib.h> //for system
#include <ctype.h> //for isupper

/***************************************************************/
/********** Functions/Functions-Declarations section *********/
/***************************************************************/
int MakeValidsMatrix(int Matrix[][COLS]); //מייצרת מטריצת מספרים תקינים
void DisplayAllValids(int Matrix[][COLS]); //מציגה את המספרים
int check(int NumToCheck); //בודקת תקינות מספר
//מחזירה מספר עמודה עם הכי הרבה מספרים תקניים
int ColWithMostValids(int Matrix[][COLS]);
int TotalInCol(int Matrix[][COLS],int col); // מחזירה סכום עמודה מבוקשת
void GetRequest(char strInp[]); //קולטת מחרוזת עם בקשת המשתמש
int CheckOne(); // קולטת מספר ומודיעה אם חוקי
int Same(char str1[],char str2[]); // בודקת שוויון מחרוזות


/***************************************************************/
/* ,התכנית מייצרת את כל המספרים הרלוונטיים למשחק בול פגיעה */
/* .כלומר כל המספרים בני 4 ספרות ללא ספרות חוזרות */
/* .השיטה: מעבר על כל המספרים הקטנים מ-10000 ובדיקת חוקיותם */
/* .התוצאה מוכנסת למטריצת תוצאות - 1 עבור מספר חוקי ו0- אחרת */
/***************************************************************/
main()
/***************************************************************/
{
char strRequest[256];
int MatrixOfValids[ROWS][COLS]={0},most;
do
{
//קליטת בקשת המשתמש
GetRequest(strRequest);
//ביצוע הבקשה
if (Same(strRequest,STR_CHECK))
{
//============================
//בדיקת מספר אחד
//============================
if (CheckOne())
printf("\n\t<<<<<<<< VALID >>>>>>>>\n");
else
printf("\n\t<<<<<<<< NOT VALID >>>>>>>>\n");
}
else
{
if(Same(strRequest,STR_ALL))
{
//============================
//טבלה שלמה
//============================
// יצירת מטריצת חוקיים והצגת כמות החוקיים
printf("\nTotal Valid Numbers:\t%d\n",MakeValidsMatrix(MatrixOfValids));;
// הצגת המספרים
DisplayAllValids(MatrixOfValids);
// הצגת מספר העמודה שמכילה הכי הרבה מספרים תקניים,וסכום התקניים בעמודה זו
printf("\nColumn %d has most valids (%d)\n\n",
most=ColWithMostValids(MatrixOfValids),TotalInCol(MatrixOfValids,most));
}
}
}while(!Same(strRequest,STR_QUIT));
}

void GetRequest(char strInp[]) //קולטת מחרוזת עם בקשת המשתמש
{
char strRequest[256]={0};

printf ("please enter:\n CHECK\n ALL\n QUIT\n");
fflush(stdin);
gets(strRequest);

}


int Same(char str1[],char str2[]) // בודקת שוויון מחרוזות
{
char strRequest[256]={0};
int same=0 ;
int i;
strcmp (strRequest,STR_CHECK);

//if (strcmp==0)
// same=1 ;
// return same;

}

int CheckOne() // קולטת מספר ומודיעה אם חוקי
{
char arr[4];
int z;
int flag=0;

printf (" please enter 4 digits num:\n ");
gets (arr);

for (z=1;z<arr;z++)
{
if (arr[0] == arr[z])
flag=1 ;
}
for (z=2;z<arr;z++)
{
if (arr[1] == arr[z])
flag=1 ;
}
for (z=3;z<arr;z++)
{
if (arr[2] == arr[z])
flag=1 ;
}
return flag;
}
int MakeValidsMatrix(int Matrix[][COLS]) //מייצרת מטריצת מספרים תקינים
{
int i,j,y;
char dits[4];
int flag2=0 ;
int MatrixOfValids[ROWS][COLS]={0};
int counter=0;

for (i=0;i<ROWS;i++)
{
for (j=0;j<COLS;j++)

{
dits[4]=i*1000+j ;


for (y=1;y<4;y++)
{
if (dits[0] == dits[y])
flag2=1 ;
}
for (y=2;y<dits;y++)
{
if (dits[1] == dits[y])
flag2=1 ;
}
for (y=3;y<dits;y++)
{
if (dits[2] == dits[y])
flag2=1 ;
}
if (flag2==1)
MatrixOfValids[ROWS][COLS]=0;
else
MatrixOfValids[ROWS][COLS]=1;
counter++;

}
}
return counter ;
}

void DisplayAllValids(int Matrix[][COLS]) //מציגה את המספרים
{
int c,d;

for (c=0;c<ROWS;c++)
{
for (d=0;d<COLS;d++)

{ printf ("MatrixOfValids[c][d]");
}
printf("\n");
}
}

int ColWithMostValids(int Matrix[][COLS]) //מחזירה מספר עמודה עם הכי הרבה מספרים תקניים
{
int a,b,i;
int counter2=0 ;
int mem=0;
int MatrixOfValids[ROWS][COLS];

for (b=0,counter2=0;b<COLS;b++)
{
for (a=0;a<ROWS;a++)
{
if (MatrixOfValids[a][b]==1)
counter2++;
}

if (mem<counter2)
mem=b ;

}
return mem;
}

int TotalInCol(int Matrix[][COLS],int col)// מחזירה סכום עמודה מבוקשת
{
int a,b,i;
int counter2=0 ;
int mem=0;
int MatrixOfValids[ROWS][COLS];

for (b=0,counter2=0;b<COLS;b++)
{
for (a=0;a<ROWS;a++)
{
if (MatrixOfValids[a][b]==1)
counter2++;
}

if (mem<counter2)
mem=counter2 ;

}
return mem;
}