- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
int removing_mask (int *x , int *y, int *lng , char board[][Y],
char *content[PL] , int select, void (*write )( int x , int y ,char board[][Y],
char *content) , int search_cross_pnt(char cross_point[LN] , int *point ,char *content[PL] , int in_x , int in_y) ,
int (*chk_mask )(char board[][Y] , int mem ,int sh, int br )
){
char mask_word[LN] = {0} ;
int sm = 1;
int lvl = 0;
int shift = 0;
int brd = 0;
int mem = 0;
int stp = 0;
int mn = 0;
int bi = 0;
int rd = 0;
int gor = 0 ,vert = 0;
int pnt = 0;
int hg = 15;
int sr = 0;
int *one_value = 0 , *second_value = 0;
int ctr = 0;
if(select == 0 ){
mem = *y;
hg = *y < LN ? *y : hg ;
}
else {
mem = *x;
hg = *x < LN ? *x : hg ;
}
for( lvl = 0 ,rd = 0; lvl <= *lng - 1 ; lvl++ ,mem++ ){
for(brd = 0 ; brd <= hg ; brd++ ){
select == 0 ? ( shift = *x , one_value = &sr , second_value = &mem) : (shift = *y , one_value = &mem , second_value = &sr ) ;
if( (select == 0 && board[ shift - 1][ *second_value ] == 0 ) || (select == 1 && board[*one_value ][shift - 1 ] == 0 )){
for( pnt = 0, stp = 0; stp <= LN ;stp++ ){
if ( chk_mask ( board , mem , shift , brd ) == 1 ){
pnt = 1;
break;
}
sr = shift++ - brd ;
mask_word[stp] = board[ *one_value ][ *second_value ] ;
}
}
if(pnt == 1 ){
break;
}
sm = search_cross_pnt( mask_word ,&mn , content ,*x, *y ) ;
if( sm > bi ){
select == 0 ? ( gor = *x - brd, vert = mem) : (gor = mem ,vert = *y - brd) ;
bi = sm ;
rd = mn;
}
}
}
if( (select == 1 && isalpha(board[gor][vert - 1] ) ||
(select == 0 && isalpha(board[gor - 1 ][vert] )) ||
( gor && vert ) == 0
) ) {
ctr = 1;
}
if( ( ( content[rd] != " " ) ) &&
( board[gor ][vert ] == content[rd][0] || !isalpha (board[gor ][vert ] ) )
&& !ctr
) {
*x = gor ;
*y = vert ;
*lng = strlen(content[rd ]);
write( gor , vert , board , content[rd] );
content[rd] = " ";
return 1 ;
}
return 0;
}