bool Sudoku::CanSetValue(int aIndex, int aValue) { if (!CheckRow(aIndex, aValue)) return false; else if (!CheckColumn(aIndex, aValue)) return false; else if (!CheckSubGrid(aIndex, aValue)) return false; else return true; }
/* Check whether value is suitable for the current position*/ int Check(int i, int j, int value) { return CheckRow(i, j, value) && CheckColumn(i, j, value) && Check3x3SmallSudoku(i, j, value); }
int BlackRookCheck(int a,int b) { static int BlackRookSearchIndex; static char BlackRookPosition[3]; static int BlackRookNumber; static char BlackRookCheckMatch[29]; static int BlackRookCheckMatchIndex; BlackRookSearchIndex=0; BlackRookNumber=2; BlackRookPosition[0]=-1; BlackRookPosition[1]=-1; for(; BlackRookSearchIndex<71; ++BlackRookSearchIndex) { if(Board[BlackRookSearchIndex]=='r') { if(BlackRookNumber==2) { BlackRookPosition[0]=BlackRookSearchIndex; } if(BlackRookNumber==1) { BlackRookPosition[1]=BlackRookSearchIndex; } --BlackRookNumber; } } BlackRookCheckMatchIndex=0; for(; BlackRookCheckMatchIndex<29; ++BlackRookCheckMatchIndex) { BlackRookCheckMatch[BlackRookCheckMatchIndex]=-1; } BlackRookCheckMatchIndex=0; for(; BlackRookCheckMatchIndex<28; ++BlackRookCheckMatchIndex) { BlackRookCheckMatch[BlackRookCheckMatchIndex]=0; } if(BlackRookPosition[0]>-1) { CheckColumn_ret=0; CheckRowValue=0; CheckColumn(BlackRookPosition[0]); CheckRow(BlackRookPosition[0]); if(CheckRowValue==1) { BlackRookCheckMatch[0]=BlackRookPosition[0]+9; if(Board[BlackRookPosition[0]+9]=='o') { BlackRookCheckMatch[1]=BlackRookPosition[0]+18; } if((Board[BlackRookPosition[0]+9]=='o')&& (Board[BlackRookPosition[0]+18]=='o')) { BlackRookCheckMatch[2]=BlackRookPosition[0]+27; } if((Board[BlackRookPosition[0]+9]=='o')&& (Board[BlackRookPosition[0]+18]=='o')&& (Board[BlackRookPosition[0]+27]=='o')) { BlackRookCheckMatch[3]=BlackRookPosition[0]+36; } if((Board[BlackRookPosition[0]+9]=='o')&& (Board[BlackRookPosition[0]+18]=='o')&& (Board[BlackRookPosition[0]+27]=='o')&& (Board[BlackRookPosition[0]+36]=='o')) { BlackRookCheckMatch[4]=BlackRookPosition[0]+45; } if((Board[BlackRookPosition[0]+9]=='o')&& (Board[BlackRookPosition[0]+18]=='o')&& (Board[BlackRookPosition[0]+27]=='o')&& (Board[BlackRookPosition[0]+36]=='o')&& (Board[BlackRookPosition[0]+45]=='o')) { BlackRookCheckMatch[5]=BlackRookPosition[0]+54; } if((Board[BlackRookPosition[0]+9]=='o')&& (Board[BlackRookPosition[0]+18]=='o')&& (Board[BlackRookPosition[0]+27]=='o')&& (Board[BlackRookPosition[0]+36]=='o')&& (Board[BlackRookPosition[0]+45]=='o')&& (Board[BlackRookPosition[0]+54]=='o')) { BlackRookCheckMatch[6]=BlackRookPosition[0]+63; } } if(CheckRowValue==2) { BlackRookCheckMatch[0]=BlackRookPosition[0]-9; BlackRookCheckMatch[1]=BlackRookPosition[0]+9; if(Board[BlackRookPosition[0]+9]=='o') { BlackRookCheckMatch[2]=BlackRookPosition[0]+18; } if((Board[BlackRookPosition[0]+9]=='o')&& (Board[BlackRookPosition[0]+18]=='o')) { BlackRookCheckMatch[3]=BlackRookPosition[0]+27; } if((Board[BlackRookPosition[0]+9]=='o')&& (Board[BlackRookPosition[0]+18]=='o')&& (Board[BlackRookPosition[0]+27]=='o')) { BlackRookCheckMatch[4]=BlackRookPosition[0]+36; } if((Board[BlackRookPosition[0]+9]=='o')&& (Board[BlackRookPosition[0]+18]=='o')&& (Board[BlackRookPosition[0]+27]=='o')&& (Board[BlackRookPosition[0]+36]=='o')) { BlackRookCheckMatch[5]=BlackRookPosition[0]+45; } if((Board[BlackRookPosition[0]+9]=='o')&& (Board[BlackRookPosition[0]+18]=='o')&& (Board[BlackRookPosition[0]+27]=='o')&& (Board[BlackRookPosition[0]+36]=='o')&& (Board[BlackRookPosition[0]+45]=='o')) { BlackRookCheckMatch[6]=BlackRookPosition[0]+54; } } if(CheckRowValue==3) { if(Board[BlackRookPosition[0]-9]=='o') { BlackRookCheckMatch[0]=BlackRookPosition[0]-18; } BlackRookCheckMatch[1]=BlackRookPosition[0]-9; BlackRookCheckMatch[2]=BlackRookPosition[0]+9; if(Board[BlackRookPosition[0]+9]=='o') { BlackRookCheckMatch[3]=BlackRookPosition[0]+18; } if((Board[BlackRookPosition[0]+9]=='o')&& (Board[BlackRookPosition[0]+18]=='o')) { BlackRookCheckMatch[4]=BlackRookPosition[0]+27; } if((Board[BlackRookPosition[0]+9]=='o')&& (Board[BlackRookPosition[0]+18]=='o')&& (Board[BlackRookPosition[0]+27]=='o')) { BlackRookCheckMatch[5]=BlackRookPosition[0]+36; } if((Board[BlackRookPosition[0]+9]=='o')&& (Board[BlackRookPosition[0]+18]=='o')&& (Board[BlackRookPosition[0]+27]=='o')&& (Board[BlackRookPosition[0]+36]=='o')) { BlackRookCheckMatch[6]=BlackRookPosition[0]+45; } } if(CheckRowValue==4) { if((Board[BlackRookPosition[0]-18]=='o')&& (Board[BlackRookPosition[0]-9]=='o')) { BlackRookCheckMatch[0]=BlackRookPosition[0]-27; } if(Board[BlackRookPosition[0]-9]=='o') { BlackRookCheckMatch[1]=BlackRookPosition[0]-18; } BlackRookCheckMatch[2]=BlackRookPosition[0]-9; BlackRookCheckMatch[3]=BlackRookPosition[0]+9; if(Board[BlackRookPosition[0]+9]=='o') { BlackRookCheckMatch[4]=BlackRookPosition[0]+18; } if((Board[BlackRookPosition[0]+9]=='o')&& (Board[BlackRookPosition[0]+18]=='o')) { BlackRookCheckMatch[5]=BlackRookPosition[0]+27; } if((Board[BlackRookPosition[0]+9]=='o')&& (Board[BlackRookPosition[0]+18]=='o')&& (Board[BlackRookPosition[0]+27]=='o')) { BlackRookCheckMatch[6]=BlackRookPosition[0]+36; } } if(CheckRowValue==5) { if((Board[BlackRookPosition[0]-27]=='o')&& (Board[BlackRookPosition[0]-18]=='o')&& (Board[BlackRookPosition[0]-9]=='o')) { BlackRookCheckMatch[0]=BlackRookPosition[0]-36; } if((Board[BlackRookPosition[0]-18]=='o')&& (Board[BlackRookPosition[0]-9]=='o')) { BlackRookCheckMatch[1]=BlackRookPosition[0]-27; } if(Board[BlackRookPosition[0]-9]=='o') { BlackRookCheckMatch[2]=BlackRookPosition[0]-18; } BlackRookCheckMatch[3]=BlackRookPosition[0]-9; BlackRookCheckMatch[4]=BlackRookPosition[0]+9; if(Board[BlackRookPosition[0]+9]=='o') { BlackRookCheckMatch[5]=BlackRookPosition[0]+18; } if((Board[BlackRookPosition[0]+9]=='o')&& (Board[BlackRookPosition[0]+18]=='o')) { BlackRookCheckMatch[6]=BlackRookPosition[0]+27; } } if(CheckRowValue==6) { if((Board[BlackRookPosition[0]-36]=='o')&& (Board[BlackRookPosition[0]-27]=='o')&& (Board[BlackRookPosition[0]-18]=='o')&& (Board[BlackRookPosition[0]-9]=='o')) { BlackRookCheckMatch[0]=BlackRookPosition[0]-45; } if((Board[BlackRookPosition[0]-27]=='o')&& (Board[BlackRookPosition[0]-18]=='o')&& (Board[BlackRookPosition[0]-9]=='o')) { BlackRookCheckMatch[1]=BlackRookPosition[0]-36; } if((Board[BlackRookPosition[0]-18]=='o')&& (Board[BlackRookPosition[0]-9]=='o')) { BlackRookCheckMatch[2]=BlackRookPosition[0]-27; } if(Board[BlackRookPosition[0]-9]=='o') { BlackRookCheckMatch[3]=BlackRookPosition[0]-18; } BlackRookCheckMatch[4]=BlackRookPosition[0]-9; BlackRookCheckMatch[5]=BlackRookPosition[0]+9; if(Board[BlackRookPosition[0]+9]=='o') { BlackRookCheckMatch[6]=BlackRookPosition[0]+18; } } if(CheckRowValue==7) { if((Board[BlackRookPosition[0]-45]=='o')&& (Board[BlackRookPosition[0]-36]=='o')&& (Board[BlackRookPosition[0]-27]=='o')&& (Board[BlackRookPosition[0]-18]=='o')&& (Board[BlackRookPosition[0]-9]=='o')) { BlackRookCheckMatch[0]=BlackRookPosition[0]-54; } if((Board[BlackRookPosition[0]-36]=='o')&& (Board[BlackRookPosition[0]-27]=='o')&& (Board[BlackRookPosition[0]-18]=='o')&& (Board[BlackRookPosition[0]-9]=='o')) { BlackRookCheckMatch[1]=BlackRookPosition[0]-45; } if((Board[BlackRookPosition[0]-27]=='o')&& (Board[BlackRookPosition[0]-18]=='o')&& (Board[BlackRookPosition[0]-9]=='o')) { BlackRookCheckMatch[2]=BlackRookPosition[0]-36; } if((Board[BlackRookPosition[0]-18]=='o')&& (Board[BlackRookPosition[0]-9]=='o')) { BlackRookCheckMatch[3]=BlackRookPosition[0]-27; } if((Board[BlackRookPosition[0]-9]=='o')) { BlackRookCheckMatch[4]=BlackRookPosition[0]-18; } BlackRookCheckMatch[5]=BlackRookPosition[0]-9; BlackRookCheckMatch[6]=BlackRookPosition[0]+9; } if(CheckRowValue==8) { if((Board[BlackRookPosition[0]-9]=='o')&& (Board[BlackRookPosition[0]-18]=='o')&& (Board[BlackRookPosition[0]-27]=='o')&& (Board[BlackRookPosition[0]-36]=='o')&& (Board[BlackRookPosition[0]-45]=='o')&& (Board[BlackRookPosition[0]-54]=='o')) { BlackRookCheckMatch[0]=BlackRookPosition[0]-63; } if((Board[BlackRookPosition[0]-9]=='o')&& (Board[BlackRookPosition[0]-18]=='o')&& (Board[BlackRookPosition[0]-27]=='o')&& (Board[BlackRookPosition[0]-36]=='o')&& (Board[BlackRookPosition[0]-45]=='o')) { BlackRookCheckMatch[1]=BlackRookPosition[0]-54; } if((Board[BlackRookPosition[0]-9]=='o')&& (Board[BlackRookPosition[0]-18]=='o')&& (Board[BlackRookPosition[0]-27]=='o')&& (Board[BlackRookPosition[0]-36]=='o')) { BlackRookCheckMatch[2]=BlackRookPosition[0]-45; } if((Board[BlackRookPosition[0]-9]=='o')&& (Board[BlackRookPosition[0]-18]=='o')&& (Board[BlackRookPosition[0]-27]=='o')) { BlackRookCheckMatch[3]=BlackRookPosition[0]-36; } if((Board[BlackRookPosition[0]-9]=='o')&& (Board[BlackRookPosition[0]-18]=='o')) { BlackRookCheckMatch[4]=BlackRookPosition[0]-27; } if(Board[BlackRookPosition[0]-9]=='o') { BlackRookCheckMatch[5]=BlackRookPosition[0]-18; } BlackRookCheckMatch[6]=BlackRookPosition[0]-9; } if(CheckColumn_ret==1) { BlackRookCheckMatch[7]=BlackRookPosition[0]+1; if(Board[BlackRookPosition[0]+1]=='o') { BlackRookCheckMatch[8]=BlackRookPosition[0]+2; } if((Board[BlackRookPosition[0]+1]=='o')&& (Board[BlackRookPosition[0]+2]=='o')) { BlackRookCheckMatch[9]=BlackRookPosition[0]+3; } if((Board[BlackRookPosition[0]+1]=='o')&& (Board[BlackRookPosition[0]+2]=='o')&& (Board[BlackRookPosition[0]+3]=='o')) { BlackRookCheckMatch[10]=BlackRookPosition[0]+4; } if((Board[BlackRookPosition[0]+1]=='o')&& (Board[BlackRookPosition[0]+2]=='o')&& (Board[BlackRookPosition[0]+3]=='o')&& (Board[BlackRookPosition[0]+4]=='o')) { BlackRookCheckMatch[11]=BlackRookPosition[0]+5; } if((Board[BlackRookPosition[0]+1]=='o')&& (Board[BlackRookPosition[0]+2]=='o')&& (Board[BlackRookPosition[0]+3]=='o')&& (Board[BlackRookPosition[0]+4]=='o')&& (Board[BlackRookPosition[0]+5]=='o')) { BlackRookCheckMatch[12]=BlackRookPosition[0]+6; } if((Board[BlackRookPosition[0]+1]=='o')&& (Board[BlackRookPosition[0]+2]=='o')&& (Board[BlackRookPosition[0]+3]=='o')&& (Board[BlackRookPosition[0]+4]=='o')&& (Board[BlackRookPosition[0]+5]=='o')&& (Board[BlackRookPosition[0]+6]=='o')) { BlackRookCheckMatch[13]=BlackRookPosition[0]+7; } } if(CheckColumn_ret==2) { BlackRookCheckMatch[7]=BlackRookPosition[0]-1; BlackRookCheckMatch[8]=BlackRookPosition[0]+1; if(Board[BlackRookPosition[0]+1]=='o') { BlackRookCheckMatch[9]=BlackRookPosition[0]+2; } if((Board[BlackRookPosition[0]+1]=='o')&& (Board[BlackRookPosition[0]+2]=='o')) { BlackRookCheckMatch[10]=BlackRookPosition[0]+3; } if((Board[BlackRookPosition[0]+1]=='o')&& (Board[BlackRookPosition[0]+2]=='o')&& (Board[BlackRookPosition[0]+3]=='o')) { BlackRookCheckMatch[11]=BlackRookPosition[0]+4; } if((Board[BlackRookPosition[0]+1]=='o')&& (Board[BlackRookPosition[0]+2]=='o')&& (Board[BlackRookPosition[0]+3]=='o')&& (Board[BlackRookPosition[0]+4]=='o')) { BlackRookCheckMatch[12]=BlackRookPosition[0]+5; } if((Board[BlackRookPosition[0]+1]=='o')&& (Board[BlackRookPosition[0]+2]=='o')&& (Board[BlackRookPosition[0]+3]=='o')&& (Board[BlackRookPosition[0]+4]=='o')&& (Board[BlackRookPosition[0]+5]=='o')) { BlackRookCheckMatch[13]=BlackRookPosition[0]+6; } } if(CheckColumn_ret==3) { if(Board[BlackRookPosition[0]-1]=='o') { BlackRookCheckMatch[7]=BlackRookPosition[0]-2; } BlackRookCheckMatch[8]=BlackRookPosition[0]-1; BlackRookCheckMatch[9]=BlackRookPosition[0]+1; if(Board[BlackRookPosition[0]+1]=='o') { BlackRookCheckMatch[10]=BlackRookPosition[0]+2; } if((Board[BlackRookPosition[0]+1]=='o')&& (Board[BlackRookPosition[0]+2]=='o')) { BlackRookCheckMatch[11]=BlackRookPosition[0]+3; } if((Board[BlackRookPosition[0]+1]=='o')&& (Board[BlackRookPosition[0]+2]=='o')&& (Board[BlackRookPosition[0]+3]=='o')) { BlackRookCheckMatch[12]=BlackRookPosition[0]+4; } if((Board[BlackRookPosition[0]+1]=='o')&& (Board[BlackRookPosition[0]+2]=='o')&& (Board[BlackRookPosition[0]+3]=='o')&& (Board[BlackRookPosition[0]+4]=='o')) { BlackRookCheckMatch[13]=BlackRookPosition[0]+5; } } if(CheckColumn_ret==4) { if((Board[BlackRookPosition[0]-2]=='o')&& (Board[BlackRookPosition[0]-1]=='o')) { BlackRookCheckMatch[7]=BlackRookPosition[0]-3; } if(Board[BlackRookPosition[0]-1]=='o') { BlackRookCheckMatch[8]=BlackRookPosition[0]-2; } BlackRookCheckMatch[9]=BlackRookPosition[0]-1; BlackRookCheckMatch[10]=BlackRookPosition[0]+1; if(Board[BlackRookPosition[0]+1]=='o') { BlackRookCheckMatch[11]=BlackRookPosition[0]+2; } if((Board[BlackRookPosition[0]+1]=='o')&& (Board[BlackRookPosition[0]+2]=='o')) { BlackRookCheckMatch[12]=BlackRookPosition[0]+3; } if((Board[BlackRookPosition[0]+1]=='o')&& (Board[BlackRookPosition[0]+2]=='o')&& (Board[BlackRookPosition[0]+3]=='o')) { BlackRookCheckMatch[13]=BlackRookPosition[0]+4; } } if(CheckColumn_ret==5) { if((Board[BlackRookPosition[0]-3]=='o')&& (Board[BlackRookPosition[0]-2]=='o')&& (Board[BlackRookPosition[0]-1]=='o')) { BlackRookCheckMatch[7]=BlackRookPosition[0]-4; } if((Board[BlackRookPosition[0]-2]=='o')&& (Board[BlackRookPosition[0]-1]=='o')) { BlackRookCheckMatch[8]=BlackRookPosition[0]-3; } if(Board[BlackRookPosition[0]-1]=='o') { BlackRookCheckMatch[9]=BlackRookPosition[0]-2; } BlackRookCheckMatch[10]=BlackRookPosition[0]-1; BlackRookCheckMatch[11]=BlackRookPosition[0]+1; if(Board[BlackRookPosition[0]+1]=='o') { BlackRookCheckMatch[12]=BlackRookPosition[0]+2; } if((Board[BlackRookPosition[0]+1]=='o')&& (Board[BlackRookPosition[0]+2]=='o')) { BlackRookCheckMatch[13]=BlackRookPosition[0]+3; } } if(CheckColumn_ret==6) { if((Board[BlackRookPosition[0]-4]=='o')&& (Board[BlackRookPosition[0]-3]=='o')&& (Board[BlackRookPosition[0]-2]=='o')&& (Board[BlackRookPosition[0]-1]=='o')) { BlackRookCheckMatch[7]=BlackRookPosition[0]-5; } if((Board[BlackRookPosition[0]-3]=='o')&& (Board[BlackRookPosition[0]-2]=='o')&& (Board[BlackRookPosition[0]-1]=='o')) { BlackRookCheckMatch[8]=BlackRookPosition[0]-4; } if((Board[BlackRookPosition[0]-2]=='o')&& (Board[BlackRookPosition[0]-1]=='o')) { BlackRookCheckMatch[9]=BlackRookPosition[0]-3; } if(Board[BlackRookPosition[0]-1]=='o') { BlackRookCheckMatch[10]=BlackRookPosition[0]-2; } BlackRookCheckMatch[11]=BlackRookPosition[0]-1; BlackRookCheckMatch[12]=BlackRookPosition[0]+1; if(Board[BlackRookPosition[0]+1]=='o') { BlackRookCheckMatch[13]=BlackRookPosition[0]+2; } } if(CheckColumn_ret==7) { if((Board[BlackRookPosition[0]-5]=='o')&& (Board[BlackRookPosition[0]-4]=='o')&& (Board[BlackRookPosition[0]-3]=='o')&& (Board[BlackRookPosition[0]-2]=='o')&& (Board[BlackRookPosition[0]-1]=='o')) { BlackRookCheckMatch[7]=BlackRookPosition[0]-6; } if((Board[BlackRookPosition[0]-4]=='o')&& (Board[BlackRookPosition[0]-3]=='o')&& (Board[BlackRookPosition[0]-2]=='o')&& (Board[BlackRookPosition[0]-1]=='o')) { BlackRookCheckMatch[8]=BlackRookPosition[0]-5; } if((Board[BlackRookPosition[0]-3]=='o')&& (Board[BlackRookPosition[0]-2]=='o')&& (Board[BlackRookPosition[0]-1]=='o')) { BlackRookCheckMatch[9]=BlackRookPosition[0]-4; } if((Board[BlackRookPosition[0]-2]=='o')&& (Board[BlackRookPosition[0]-1]=='o')) { BlackRookCheckMatch[10]=BlackRookPosition[0]-3; } if(Board[BlackRookPosition[0]-1]=='o') { BlackRookCheckMatch[11]=BlackRookPosition[0]-2; } BlackRookCheckMatch[12]=BlackRookPosition[0]-1; BlackRookCheckMatch[13]=BlackRookPosition[0]+1; } if(CheckColumn_ret==8) { if((Board[BlackRookPosition[0]-6]=='o')&& (Board[BlackRookPosition[0]-5]=='o')&& (Board[BlackRookPosition[0]-4]=='o')&& (Board[BlackRookPosition[0]-3]=='o')&& (Board[BlackRookPosition[0]-2]=='o')&& (Board[BlackRookPosition[0]-1]=='o')) { BlackRookCheckMatch[7]=BlackRookPosition[0]-7; } if((Board[BlackRookPosition[0]-5]=='o')&& (Board[BlackRookPosition[0]-4]=='o')&& (Board[BlackRookPosition[0]-3]=='o')&& (Board[BlackRookPosition[0]-2]=='o')&& (Board[BlackRookPosition[0]-1]=='o')) { BlackRookCheckMatch[8]=BlackRookPosition[0]-6; } if((Board[BlackRookPosition[0]-4]=='o')&& (Board[BlackRookPosition[0]-3]=='o')&& (Board[BlackRookPosition[0]-2]=='o')&& (Board[BlackRookPosition[0]-1]=='o')) { BlackRookCheckMatch[9]=BlackRookPosition[0]-5; } if((Board[BlackRookPosition[0]-3]=='o')&& (Board[BlackRookPosition[0]-2]=='o')&& (Board[BlackRookPosition[0]-1]=='o')) { BlackRookCheckMatch[10]=BlackRookPosition[0]-4; } if((Board[BlackRookPosition[0]-2]=='o')&& (Board[BlackRookPosition[0]-1]=='o')) { BlackRookCheckMatch[11]=BlackRookPosition[0]-3; } if(Board[BlackRookPosition[0]-1]=='o') { BlackRookCheckMatch[12]=BlackRookPosition[0]-2; } BlackRookCheckMatch[13]=BlackRookPosition[0]-1; } } if(BlackRookPosition[1]>-1) { CheckColumn_ret=0; CheckRowValue=0; CheckRow(BlackRookPosition[1]); CheckColumn(BlackRookPosition[1]); if(CheckRowValue==1) { BlackRookCheckMatch[14]=BlackRookPosition[1]+9; if(Board[BlackRookPosition[1]+9]=='o') { BlackRookCheckMatch[15]=BlackRookPosition[1]+18; } if((Board[BlackRookPosition[1]+9]=='o')&& (Board[BlackRookPosition[1]+18]=='o')) { BlackRookCheckMatch[16]=BlackRookPosition[1]+27; } if((Board[BlackRookPosition[1]+9]=='o')&& (Board[BlackRookPosition[1]+18]=='o')&& (Board[BlackRookPosition[1]+27]=='o')) { BlackRookCheckMatch[17]=BlackRookPosition[1]+36; } if((Board[BlackRookPosition[1]+9]=='o')&& (Board[BlackRookPosition[1]+18]=='o')&& (Board[BlackRookPosition[1]+27]=='o')&& (Board[BlackRookPosition[1]+36]=='o')) { BlackRookCheckMatch[18]=BlackRookPosition[1]+45; } if((Board[BlackRookPosition[1]+9]=='o')&& (Board[BlackRookPosition[1]+18]=='o')&& (Board[BlackRookPosition[1]+27]=='o')&& (Board[BlackRookPosition[1]+36]=='o')&& (Board[BlackRookPosition[1]+45]=='o')) { BlackRookCheckMatch[19]=BlackRookPosition[1]+54; } if((Board[BlackRookPosition[1]+9]=='o')&& (Board[BlackRookPosition[1]+18]=='o')&& (Board[BlackRookPosition[1]+27]=='o')&& (Board[BlackRookPosition[1]+36]=='o')&& (Board[BlackRookPosition[1]+45]=='o')&& (Board[BlackRookPosition[1]+54]=='o')) { BlackRookCheckMatch[20]=BlackRookPosition[1]+63; } } if(CheckRowValue==2) { BlackRookCheckMatch[14]=BlackRookPosition[1]-9; BlackRookCheckMatch[15]=BlackRookPosition[1]+9; if(Board[BlackRookPosition[1]+9]=='o') { BlackRookCheckMatch[16]=BlackRookPosition[1]+18; } if((Board[BlackRookPosition[1]+9]=='o')&& (Board[BlackRookPosition[1]+18]=='o')) { BlackRookCheckMatch[17]=BlackRookPosition[1]+27; } if((Board[BlackRookPosition[1]+9]=='o')&& (Board[BlackRookPosition[1]+18]=='o')&& (Board[BlackRookPosition[1]+27]=='o')) { BlackRookCheckMatch[18]=BlackRookPosition[1]+36; } if((Board[BlackRookPosition[1]+9]=='o')&& (Board[BlackRookPosition[1]+18]=='o')&& (Board[BlackRookPosition[1]+27]=='o')&& (Board[BlackRookPosition[1]+36]=='o')) { BlackRookCheckMatch[19]=BlackRookPosition[1]+45; } if((Board[BlackRookPosition[1]+9]=='o')&& (Board[BlackRookPosition[1]+18]=='o')&& (Board[BlackRookPosition[1]+27]=='o')&& (Board[BlackRookPosition[1]+36]=='o')&& (Board[BlackRookPosition[1]+45]=='o')) { BlackRookCheckMatch[20]=BlackRookPosition[1]+54; } } if(CheckRowValue==3) { if(Board[BlackRookPosition[1]-9]=='o') { BlackRookCheckMatch[14]=BlackRookPosition[1]-18; } BlackRookCheckMatch[15]=BlackRookPosition[1]-9; BlackRookCheckMatch[16]=BlackRookPosition[1]+9; if(Board[BlackRookPosition[1]+9]=='o') { BlackRookCheckMatch[17]=BlackRookPosition[1]+18; } if((Board[BlackRookPosition[1]+9]=='o')&& (Board[BlackRookPosition[1]+18]=='o')) { BlackRookCheckMatch[18]=BlackRookPosition[1]+27; } if((Board[BlackRookPosition[1]+9]=='o')&& (Board[BlackRookPosition[1]+18]=='o')&& (Board[BlackRookPosition[1]+27]=='o')) { BlackRookCheckMatch[19]=BlackRookPosition[1]+36; } if((Board[BlackRookPosition[1]+9]=='o')&& (Board[BlackRookPosition[1]+18]=='o')&& (Board[BlackRookPosition[1]+27]=='o')&& (Board[BlackRookPosition[1]+36]=='o')) { BlackRookCheckMatch[20]=BlackRookPosition[1]+45; } } if(CheckRowValue==4) { if((Board[BlackRookPosition[1]-18]=='o')&& (Board[BlackRookPosition[1]-9]=='o')) { BlackRookCheckMatch[14]=BlackRookPosition[1]-27; } if(Board[BlackRookPosition[1]-9]=='o') { BlackRookCheckMatch[15]=BlackRookPosition[1]-18; } BlackRookCheckMatch[16]=BlackRookPosition[1]-9; BlackRookCheckMatch[17]=BlackRookPosition[1]+9; if(Board[BlackRookPosition[1]+9]=='o') { BlackRookCheckMatch[18]=BlackRookPosition[1]+18; } if((Board[BlackRookPosition[1]+9]=='o')&& (Board[BlackRookPosition[1]+18]=='o')) { BlackRookCheckMatch[19]=BlackRookPosition[1]+27; } if((Board[BlackRookPosition[1]+9]=='o')&& (Board[BlackRookPosition[1]+18]=='o')&& (Board[BlackRookPosition[1]+27]=='o')) { BlackRookCheckMatch[20]=BlackRookPosition[1]+36; } } if(CheckRowValue==5) { if((Board[BlackRookPosition[1]-27]=='o')&& (Board[BlackRookPosition[1]-18]=='o')&& (Board[BlackRookPosition[1]-9]=='o')) { BlackRookCheckMatch[14]=BlackRookPosition[1]-36; } if((Board[BlackRookPosition[1]-18]=='o')&& (Board[BlackRookPosition[1]-9]=='o')) { BlackRookCheckMatch[15]=BlackRookPosition[1]-27; } if(Board[BlackRookPosition[1]-9]=='o') { BlackRookCheckMatch[16]=BlackRookPosition[1]-18; } BlackRookCheckMatch[17]=BlackRookPosition[1]-9; BlackRookCheckMatch[18]=BlackRookPosition[1]+9; if(Board[BlackRookPosition[1]+9]=='o') { BlackRookCheckMatch[19]=BlackRookPosition[1]+18; } if((Board[BlackRookPosition[1]+9]=='o')&& (Board[BlackRookPosition[1]+18]=='o')) { BlackRookCheckMatch[20]=BlackRookPosition[1]+27; } } if(CheckRowValue==6) { if((Board[BlackRookPosition[1]-36]=='o')&& (Board[BlackRookPosition[1]-27]=='o')&& (Board[BlackRookPosition[1]-18]=='o')&& (Board[BlackRookPosition[1]-9]=='o')) { BlackRookCheckMatch[14]=BlackRookPosition[1]-45; } if((Board[BlackRookPosition[1]-27]=='o')&& (Board[BlackRookPosition[1]-18]=='o')&& (Board[BlackRookPosition[1]-9]=='o')) { BlackRookCheckMatch[15]=BlackRookPosition[1]-36; } if((Board[BlackRookPosition[1]-18]=='o')&& (Board[BlackRookPosition[1]-9]=='o')) { BlackRookCheckMatch[16]=BlackRookPosition[1]-27; } if((Board[BlackRookPosition[1]-9]=='o')) { BlackRookCheckMatch[17]=BlackRookPosition[1]-18; } BlackRookCheckMatch[18]=BlackRookPosition[1]-9; BlackRookCheckMatch[19]=BlackRookPosition[1]+9; if((Board[BlackRookPosition[1]+9]=='o')) { BlackRookCheckMatch[20]=BlackRookPosition[1]+18; } } if(CheckRowValue==7) { if((Board[BlackRookPosition[1]-45]=='o')&& (Board[BlackRookPosition[1]-36]=='o')&& (Board[BlackRookPosition[1]-27]=='o')&& (Board[BlackRookPosition[1]-18]=='o')&& (Board[BlackRookPosition[1]-9]=='o')) { BlackRookCheckMatch[14]=BlackRookPosition[1]-54; } if((Board[BlackRookPosition[1]-36]=='o')&& (Board[BlackRookPosition[1]-27]=='o')&& (Board[BlackRookPosition[1]-18]=='o')&& (Board[BlackRookPosition[1]-9]=='o')) { BlackRookCheckMatch[15]=BlackRookPosition[1]-45; } if((Board[BlackRookPosition[1]-27]=='o')&& (Board[BlackRookPosition[1]-18]=='o')&& (Board[BlackRookPosition[1]-9]=='o')) { BlackRookCheckMatch[16]=BlackRookPosition[1]-36; } if((Board[BlackRookPosition[1]-18]=='o')&& (Board[BlackRookPosition[1]-9]=='o')) { BlackRookCheckMatch[17]=BlackRookPosition[1]-27; } if((Board[BlackRookPosition[1]-9]=='o')) { BlackRookCheckMatch[18]=BlackRookPosition[1]-18; } BlackRookCheckMatch[19]=BlackRookPosition[1]-9; BlackRookCheckMatch[20]=BlackRookPosition[1]+9; } if(CheckRowValue==8) { if((Board[BlackRookPosition[1]-9]=='o')&& (Board[BlackRookPosition[1]-18]=='o')&& (Board[BlackRookPosition[1]-27]=='o')&& (Board[BlackRookPosition[1]-36]=='o')&& (Board[BlackRookPosition[1]-45]=='o')&& (Board[BlackRookPosition[1]-54]=='o')) { BlackRookCheckMatch[14]=BlackRookPosition[1]-63; } if((Board[BlackRookPosition[1]-9]=='o')&& (Board[BlackRookPosition[1]-18]=='o')&& (Board[BlackRookPosition[1]-27]=='o')&& (Board[BlackRookPosition[1]-36]=='o')&& (Board[BlackRookPosition[1]-45]=='o')) { BlackRookCheckMatch[15]=BlackRookPosition[1]-54; } if((Board[BlackRookPosition[1]-9]=='o')&& (Board[BlackRookPosition[1]-18]=='o')&& (Board[BlackRookPosition[1]-27]=='o')&& (Board[BlackRookPosition[1]-36]=='o')) { BlackRookCheckMatch[16]=BlackRookPosition[1]-45; } if((Board[BlackRookPosition[1]-9]=='o')&& (Board[BlackRookPosition[1]-18]=='o')&& (Board[BlackRookPosition[1]-27]=='o')) { BlackRookCheckMatch[17]=BlackRookPosition[1]-36; } if((Board[BlackRookPosition[1]-9]=='o')&& (Board[BlackRookPosition[1]-18]=='o')) { BlackRookCheckMatch[18]=BlackRookPosition[1]-27; } if(Board[BlackRookPosition[1]-9]=='o') { BlackRookCheckMatch[19]=BlackRookPosition[1]-18; } BlackRookCheckMatch[20]=BlackRookPosition[1]-9; } if(CheckColumn_ret==1) { BlackRookCheckMatch[21]=BlackRookPosition[1]+1; if(Board[BlackRookPosition[1]+1]=='o') { BlackRookCheckMatch[22]=BlackRookPosition[1]+2; } if((Board[BlackRookPosition[1]+1]=='o')&& (Board[BlackRookPosition[1]+2]=='o')) { BlackRookCheckMatch[23]=BlackRookPosition[1]+3; } if((Board[BlackRookPosition[1]+1]=='o')&& (Board[BlackRookPosition[1]+2]=='o')&& (Board[BlackRookPosition[1]+3]=='o')) { BlackRookCheckMatch[24]=BlackRookPosition[1]+4; } if((Board[BlackRookPosition[1]+1]=='o')&& (Board[BlackRookPosition[1]+2]=='o')&& (Board[BlackRookPosition[1]+3]=='o')&& (Board[BlackRookPosition[1]+4]=='o')) { BlackRookCheckMatch[25]=BlackRookPosition[1]+5; } if((Board[BlackRookPosition[1]+1]=='o')&& (Board[BlackRookPosition[1]+2]=='o')&& (Board[BlackRookPosition[1]+3]=='o')&& (Board[BlackRookPosition[1]+4]=='o')&& (Board[BlackRookPosition[1]+5]=='o')) { BlackRookCheckMatch[26]=BlackRookPosition[1]+6; } if((Board[BlackRookPosition[1]+1]=='o')&& (Board[BlackRookPosition[1]+2]=='o')&& (Board[BlackRookPosition[1]+3]=='o')&& (Board[BlackRookPosition[1]+4]=='o')&& (Board[BlackRookPosition[1]+5]=='o')&& (Board[BlackRookPosition[1]+6]=='o')) { BlackRookCheckMatch[27]=BlackRookPosition[1]+7; } } if(CheckColumn_ret==2) { BlackRookCheckMatch[21]=BlackRookPosition[1]-1; BlackRookCheckMatch[22]=BlackRookPosition[1]+1; if(Board[BlackRookPosition[1]+1]=='o') { BlackRookCheckMatch[23]=BlackRookPosition[1]+2; } if((Board[BlackRookPosition[1]+1]=='o')&& (Board[BlackRookPosition[1]+2]=='o')) { BlackRookCheckMatch[24]=BlackRookPosition[1]+3; } if((Board[BlackRookPosition[1]+1]=='o')&& (Board[BlackRookPosition[1]+2]=='o')&& (Board[BlackRookPosition[1]+3]=='o')) { BlackRookCheckMatch[25]=BlackRookPosition[1]+4; } if((Board[BlackRookPosition[1]+1]=='o')&& (Board[BlackRookPosition[1]+2]=='o')&& (Board[BlackRookPosition[1]+3]=='o')&& (Board[BlackRookPosition[1]+4]=='o')) { BlackRookCheckMatch[26]=BlackRookPosition[1]+5; } if((Board[BlackRookPosition[1]+1]=='o')&& (Board[BlackRookPosition[1]+2]=='o')&& (Board[BlackRookPosition[1]+3]=='o')&& (Board[BlackRookPosition[1]+4]=='o')&& (Board[BlackRookPosition[1]+5]=='o')) { BlackRookCheckMatch[27]=BlackRookPosition[1]+6; } } if(CheckColumn_ret==3) { if(Board[BlackRookPosition[1]-1]=='o') { BlackRookCheckMatch[21]=BlackRookPosition[1]-2; } BlackRookCheckMatch[22]=BlackRookPosition[1]-1; BlackRookCheckMatch[23]=BlackRookPosition[1]+1; if(Board[BlackRookPosition[1]+1]=='o') { BlackRookCheckMatch[24]=BlackRookPosition[1]+2; } if((Board[BlackRookPosition[1]+1]=='o')&& (Board[BlackRookPosition[1]+2]=='o')) { BlackRookCheckMatch[25]=BlackRookPosition[1]+3; } if((Board[BlackRookPosition[1]+1]=='o')&& (Board[BlackRookPosition[1]+2]=='o')&& (Board[BlackRookPosition[1]+3]=='o')) { BlackRookCheckMatch[26]=BlackRookPosition[1]+4; } if((Board[BlackRookPosition[1]+1]=='o')&& (Board[BlackRookPosition[1]+2]=='o')&& (Board[BlackRookPosition[1]+3]=='o')&& (Board[BlackRookPosition[1]+4]=='o')) { BlackRookCheckMatch[27]=BlackRookPosition[1]+5; } } if(CheckColumn_ret==4) { if((Board[BlackRookPosition[1]-2]=='o')&& (Board[BlackRookPosition[1]-1]=='o')) { BlackRookCheckMatch[21]=BlackRookPosition[1]-3; } if(Board[BlackRookPosition[1]-1]=='o') { BlackRookCheckMatch[22]=BlackRookPosition[1]-2; } BlackRookCheckMatch[23]=BlackRookPosition[1]-1; BlackRookCheckMatch[24]=BlackRookPosition[1]+1; if(Board[BlackRookPosition[1]+1]=='o') { BlackRookCheckMatch[25]=BlackRookPosition[1]+2; } if((Board[BlackRookPosition[1]+1]=='o')&& (Board[BlackRookPosition[1]+2]=='o')) { BlackRookCheckMatch[26]=BlackRookPosition[1]+3; } if((Board[BlackRookPosition[1]+1]=='o')&& (Board[BlackRookPosition[1]+2]=='o')&& (Board[BlackRookPosition[1]+3]=='o')) { BlackRookCheckMatch[27]=BlackRookPosition[1]+4; } } if(CheckColumn_ret==5) { if((Board[BlackRookPosition[1]-3]=='o')&& (Board[BlackRookPosition[1]-2]=='o')&& (Board[BlackRookPosition[1]-1]=='o')) { BlackRookCheckMatch[21]=BlackRookPosition[1]-4; } if((Board[BlackRookPosition[1]-2]=='o')&& (Board[BlackRookPosition[1]-1]=='o')) { BlackRookCheckMatch[22]=BlackRookPosition[1]-3; } if(Board[BlackRookPosition[1]-1]=='o') { BlackRookCheckMatch[23]=BlackRookPosition[1]-2; } BlackRookCheckMatch[24]=BlackRookPosition[1]-1; BlackRookCheckMatch[25]=BlackRookPosition[1]+1; if(Board[BlackRookPosition[1]+1]=='o') { BlackRookCheckMatch[26]=BlackRookPosition[1]+2; } if((Board[BlackRookPosition[1]+1]=='o')&& (Board[BlackRookPosition[1]+2]=='o')) { BlackRookCheckMatch[27]=BlackRookPosition[1]+3; } } if(CheckColumn_ret==6) { if((Board[BlackRookPosition[1]-4]=='o')&& (Board[BlackRookPosition[1]-3]=='o')&& (Board[BlackRookPosition[1]-2]=='o')&& (Board[BlackRookPosition[1]-1]=='o')) { BlackRookCheckMatch[21]=BlackRookPosition[1]-5; } if((Board[BlackRookPosition[1]-3]=='o')&& (Board[BlackRookPosition[1]-2]=='o')&& (Board[BlackRookPosition[1]-1]=='o')) { BlackRookCheckMatch[22]=BlackRookPosition[1]-4; } if((Board[BlackRookPosition[1]-2]=='o')&& (Board[BlackRookPosition[1]-1]=='o')) { BlackRookCheckMatch[23]=BlackRookPosition[1]-3; } if(Board[BlackRookPosition[1]-1]=='o') { BlackRookCheckMatch[24]=BlackRookPosition[1]-2; } BlackRookCheckMatch[25]=BlackRookPosition[1]-1; BlackRookCheckMatch[26]=BlackRookPosition[1]+1; if(Board[BlackRookPosition[1]+1]=='o') { BlackRookCheckMatch[27]=BlackRookPosition[1]+2; } } if(CheckColumn_ret==7) { if((Board[BlackRookPosition[1]-5]=='o')&& (Board[BlackRookPosition[1]-4]=='o')&& (Board[BlackRookPosition[1]-3]=='o')&& (Board[BlackRookPosition[1]-2]=='o')&& (Board[BlackRookPosition[1]-1]=='o')) { BlackRookCheckMatch[21]=BlackRookPosition[1]-6; } if((Board[BlackRookPosition[1]-4]=='o')&& (Board[BlackRookPosition[1]-3]=='o')&& (Board[BlackRookPosition[1]-2]=='o')&& (Board[BlackRookPosition[1]-1]=='o')) { BlackRookCheckMatch[22]=BlackRookPosition[1]-5; } if((Board[BlackRookPosition[1]-3]=='o')&& (Board[BlackRookPosition[1]-2]=='o')&& (Board[BlackRookPosition[1]-1]=='o')) { BlackRookCheckMatch[23]=BlackRookPosition[1]-4; } if((Board[BlackRookPosition[1]-2]=='o')&& (Board[BlackRookPosition[1]-1]=='o')) { BlackRookCheckMatch[24]=BlackRookPosition[1]-3; } if(Board[BlackRookPosition[1]-1]=='o') { BlackRookCheckMatch[25]=BlackRookPosition[1]-2; } BlackRookCheckMatch[26]=BlackRookPosition[1]-1; BlackRookCheckMatch[27]=BlackRookPosition[1]+1; } if(CheckColumn_ret==8) { if((Board[BlackRookPosition[1]-6]=='o')&& (Board[BlackRookPosition[1]-5]=='o')&& (Board[BlackRookPosition[1]-4]=='o')&& (Board[BlackRookPosition[1]-3]=='o')&& (Board[BlackRookPosition[1]-2]=='o')&& (Board[BlackRookPosition[1]-1]=='o')) { BlackRookCheckMatch[21]=BlackRookPosition[1]-7; } if((Board[BlackRookPosition[1]-5]=='o')&& (Board[BlackRookPosition[1]-4]=='o')&& (Board[BlackRookPosition[1]-3]=='o')&& (Board[BlackRookPosition[1]-2]=='o')&& (Board[BlackRookPosition[1]-1]=='o')) { BlackRookCheckMatch[22]=BlackRookPosition[1]-6; } if((Board[BlackRookPosition[1]-4]=='o')&& (Board[BlackRookPosition[1]-3]=='o')&& (Board[BlackRookPosition[1]-2]=='o')&& (Board[BlackRookPosition[1]-1]=='o')) { BlackRookCheckMatch[23]=BlackRookPosition[1]-5; } if((Board[BlackRookPosition[1]-3]=='o')&& (Board[BlackRookPosition[1]-2]=='o')&& (Board[BlackRookPosition[1]-1]=='o')) { BlackRookCheckMatch[24]=BlackRookPosition[1]-4; } if((Board[BlackRookPosition[1]-2]=='o')&& (Board[BlackRookPosition[1]-1]=='o')) { BlackRookCheckMatch[25]=BlackRookPosition[1]-3; } if(Board[BlackRookPosition[1]-1]=='o') { BlackRookCheckMatch[26]=BlackRookPosition[1]-2; } BlackRookCheckMatch[27]=BlackRookPosition[1]-1; } } BlackRookCheckMatchIndex=0; for(; BlackRookCheckMatchIndex<28; ++BlackRookCheckMatchIndex) { if(Board[BlackRookCheckMatch[BlackRookCheckMatchIndex]]=='K') { Check=1; } if(a>-1) { if(BlackRookCheckMatch[BlackRookCheckMatchIndex]==a) { if(CheckerID1==-1){ CheckerID1=BlackRookCheckMatch[BlackRookCheckMatchIndex]; } if(CheckerID2==-1){ CheckerID2=BlackRookCheckMatch[BlackRookCheckMatchIndex]; } if(CheckerID3==-1){ CheckerID3=BlackRookCheckMatch[BlackRookCheckMatchIndex]; } if(CheckerID4==-1){ CheckerID4=BlackRookCheckMatch[BlackRookCheckMatchIndex]; } if(CheckerID5==-1){ CheckerID5=BlackRookCheckMatch[BlackRookCheckMatchIndex]; } if(CheckerID6==-1){ CheckerID6=BlackRookCheckMatch[BlackRookCheckMatchIndex]; } return 1; } } } }
int WhiteRookCheck(int a,int b) { static int w_search; static int w_rk_p[3]; static int w_rk_no; static char w_rk[29]; static int i; static char King; w_search=0; w_rk_no=2; w_rk_p[0]=-1; w_rk_p[1]=-1; for(; w_search<71; ++w_search) { if(Board[w_search]=='R') { if(w_rk_no==2) { w_rk_p[0]=w_search; } if(w_rk_no==1) { w_rk_p[1]=w_search; } --w_rk_no; } } i=0; for(; i<28; ++i) { w_rk[i]=-1; } if(w_rk_p[0]>-1) { CheckColumn_ret=0; CheckRowValue=0; CheckColumn(w_rk_p[0]); CheckRow(w_rk_p[0]); if(CheckRowValue==1) { w_rk[0]=w_rk_p[0]+9; if(Board[w_rk_p[0]+9]==blank) { w_rk[1]=w_rk_p[0]+18; } if((Board[w_rk_p[0]+9]==blank)&& (Board[w_rk_p[0]+18]==blank)) { w_rk[2]=w_rk_p[0]+27; } if((Board[w_rk_p[0]+9]==blank)&& (Board[w_rk_p[0]+18]==blank)&& (Board[w_rk_p[0]+27]==blank)) { w_rk[3]=w_rk_p[0]+36; } if((Board[w_rk_p[0]+9]==blank)&& (Board[w_rk_p[0]+18]==blank)&& (Board[w_rk_p[0]+27]==blank)&& (Board[w_rk_p[0]+36]==blank)) { w_rk[4]=w_rk_p[0]+45; } if((Board[w_rk_p[0]+9]==blank)&& (Board[w_rk_p[0]+18]==blank)&& (Board[w_rk_p[0]+27]==blank)&& (Board[w_rk_p[0]+36]==blank)&& (Board[w_rk_p[0]+45]==blank)) { w_rk[5]=w_rk_p[0]+54; } if((Board[w_rk_p[0]+9]==blank)&& (Board[w_rk_p[0]+18]==blank)&& (Board[w_rk_p[0]+27]==blank)&& (Board[w_rk_p[0]+36]==blank)&& (Board[w_rk_p[0]+45]==blank)&& (Board[w_rk_p[0]+54]==blank)) { w_rk[6]=w_rk_p[0]+63; } } if(CheckRowValue==2) { w_rk[0]=w_rk_p[0]-9; w_rk[1]=w_rk_p[0]+9; if(Board[w_rk_p[0]+9]==blank) { w_rk[2]=w_rk_p[0]+18; } if((Board[w_rk_p[0]+9]==blank)&& (Board[w_rk_p[0]+18]==blank)) { w_rk[3]=w_rk_p[0]+27; } if((Board[w_rk_p[0]+9]==blank)&& (Board[w_rk_p[0]+18]==blank)&& (Board[w_rk_p[0]+27]==blank)) { w_rk[4]=w_rk_p[0]+36; } if((Board[w_rk_p[0]+9]==blank)&& (Board[w_rk_p[0]+18]==blank)&& (Board[w_rk_p[0]+27]==blank)&& (Board[w_rk_p[0]+36]==blank)) { w_rk[5]=w_rk_p[0]+45; } if((Board[w_rk_p[0]+9]==blank)&& (Board[w_rk_p[0]+18]==blank)&& (Board[w_rk_p[0]+27]==blank)&& (Board[w_rk_p[0]+36]==blank)&& (Board[w_rk_p[0]+45]==blank)) { w_rk[6]=w_rk_p[0]+54; } } if(CheckRowValue==3) { if(Board[w_rk_p[0]-9]==blank) { w_rk[0]=w_rk_p[0]-18; } w_rk[1]=w_rk_p[0]-9; w_rk[2]=w_rk_p[0]+9; if(Board[w_rk_p[0]+9]==blank) { w_rk[3]=w_rk_p[0]+18; } if((Board[w_rk_p[0]+9]==blank)&& (Board[w_rk_p[0]+18]==blank)) { w_rk[4]=w_rk_p[0]+27; } if((Board[w_rk_p[0]+9]==blank)&& (Board[w_rk_p[0]+18]==blank)&& (Board[w_rk_p[0]+27]==blank)) { w_rk[5]=w_rk_p[0]+36; } if((Board[w_rk_p[0]+9]==blank)&& (Board[w_rk_p[0]+18]==blank)&& (Board[w_rk_p[0]+27]==blank)&& (Board[w_rk_p[0]+36]==blank)) { w_rk[6]=w_rk_p[0]+45; } } if(CheckRowValue==4) { if((Board[w_rk_p[0]-18]==blank)&& (Board[w_rk_p[0]-9]==blank)) { w_rk[0]=w_rk_p[0]-27; } if(Board[w_rk_p[0]-9]==blank) { w_rk[1]=w_rk_p[0]-18; } w_rk[2]=w_rk_p[0]-9; w_rk[3]=w_rk_p[0]+9; if(Board[w_rk_p[0]+9]==blank) { w_rk[4]=w_rk_p[0]+18; } if((Board[w_rk_p[0]+9]==blank)&& (Board[w_rk_p[0]+18]==blank)) { w_rk[5]=w_rk_p[0]+27; } if((Board[w_rk_p[0]+9]==blank)&& (Board[w_rk_p[0]+18]==blank)&& (Board[w_rk_p[0]+27]==blank)) { w_rk[6]=w_rk_p[0]+36; } } if(CheckRowValue==5) { if((Board[w_rk_p[0]-27]==blank)&& (Board[w_rk_p[0]-18]==blank)&& (Board[w_rk_p[0]-9]==blank)) { w_rk[0]=w_rk_p[0]-36; } if((Board[w_rk_p[0]-18]==blank)&& (Board[w_rk_p[0]-9]==blank)) { w_rk[1]=w_rk_p[0]-27; } if(Board[w_rk_p[0]-9]==blank) { w_rk[2]=w_rk_p[0]-18; } w_rk[3]=w_rk_p[0]-9; w_rk[4]=w_rk_p[0]+9; if(Board[w_rk_p[0]+9]==blank) { w_rk[5]=w_rk_p[0]+18; } if((Board[w_rk_p[0]+9]==blank)&& (Board[w_rk_p[0]+18]==blank)) { w_rk[6]=w_rk_p[0]+27; } } if(CheckRowValue==6) { if((Board[w_rk_p[0]-36]==blank)&& (Board[w_rk_p[0]-27]==blank)&& (Board[w_rk_p[0]-18]==blank)&& (Board[w_rk_p[0]-9]==blank)) { w_rk[0]=w_rk_p[0]-45; } if((Board[w_rk_p[0]-27]==blank)&& (Board[w_rk_p[0]-18]==blank)&& (Board[w_rk_p[0]-9]==blank)) { w_rk[1]=w_rk_p[0]-36; } if((Board[w_rk_p[0]-18]==blank)&& (Board[w_rk_p[0]-9]==blank)) { w_rk[2]=w_rk_p[0]-27; } if(Board[w_rk_p[0]-9]==blank) { w_rk[3]=w_rk_p[0]-18; } w_rk[4]=w_rk_p[0]-9; w_rk[5]=w_rk_p[0]+9; if(Board[w_rk_p[0]+9]==blank) { w_rk[6]=w_rk_p[0]+18; } } if(CheckRowValue==7) { if((Board[w_rk_p[0]-45]==blank)&& (Board[w_rk_p[0]-36]==blank)&& (Board[w_rk_p[0]-27]==blank)&& (Board[w_rk_p[0]-18]==blank)&& (Board[w_rk_p[0]-9]==blank)) { w_rk[0]=w_rk_p[0]-54; } if((Board[w_rk_p[0]-36]==blank)&& (Board[w_rk_p[0]-27]==blank)&& (Board[w_rk_p[0]-18]==blank)&& (Board[w_rk_p[0]-9]==blank)) { w_rk[1]=w_rk_p[0]-45; } if((Board[w_rk_p[0]-27]==blank)&& (Board[w_rk_p[0]-18]==blank)&& (Board[w_rk_p[0]-9]==blank)) { w_rk[2]=w_rk_p[0]-36; } if((Board[w_rk_p[0]-18]==blank)&& (Board[w_rk_p[0]-9]==blank)) { w_rk[3]=w_rk_p[0]-27; } if((Board[w_rk_p[0]-9]==blank)) { w_rk[4]=w_rk_p[0]-18; } w_rk[5]=w_rk_p[0]-9; w_rk[6]=w_rk_p[0]+9; } if(CheckRowValue==8) { if((Board[w_rk_p[0]-9]==blank)&& (Board[w_rk_p[0]-18]==blank)&& (Board[w_rk_p[0]-27]==blank)&& (Board[w_rk_p[0]-36]==blank)&& (Board[w_rk_p[0]-45]==blank)&& (Board[w_rk_p[0]-54]==blank)) { w_rk[0]=w_rk_p[0]-63; } if((Board[w_rk_p[0]-9]==blank)&& (Board[w_rk_p[0]-18]==blank)&& (Board[w_rk_p[0]-27]==blank)&& (Board[w_rk_p[0]-36]==blank)&& (Board[w_rk_p[0]-45]==blank)) { w_rk[1]=w_rk_p[0]-54; } if((Board[w_rk_p[0]-9]==blank)&& (Board[w_rk_p[0]-18]==blank)&& (Board[w_rk_p[0]-27]==blank)&& (Board[w_rk_p[0]-36]==blank)) { w_rk[2]=w_rk_p[0]-45; } if((Board[w_rk_p[0]-9]==blank)&& (Board[w_rk_p[0]-18]==blank)&& (Board[w_rk_p[0]-27]==blank)) { w_rk[3]=w_rk_p[0]-36; } if((Board[w_rk_p[0]-9]==blank)&& (Board[w_rk_p[0]-18]==blank)) { w_rk[4]=w_rk_p[0]-27; } if(Board[w_rk_p[0]-9]==blank) { w_rk[5]=w_rk_p[0]-18; } w_rk[6]=w_rk_p[0]-9; } if(CheckColumn_ret==1) { w_rk[7]=w_rk_p[0]+1; if(Board[w_rk_p[0]+1]==blank) { w_rk[8]=w_rk_p[0]+2; } if((Board[w_rk_p[0]+1]==blank)&& (Board[w_rk_p[0]+2]==blank)) { w_rk[9]=w_rk_p[0]+3; } if((Board[w_rk_p[0]+1]==blank)&& (Board[w_rk_p[0]+2]==blank)&& (Board[w_rk_p[0]+3]==blank)) { w_rk[10]=w_rk_p[0]+4; } if((Board[w_rk_p[0]+1]==blank)&& (Board[w_rk_p[0]+2]==blank)&& (Board[w_rk_p[0]+3]==blank)&& (Board[w_rk_p[0]+4]==blank)) { w_rk[11]=w_rk_p[0]+5; } if((Board[w_rk_p[0]+1]==blank)&& (Board[w_rk_p[0]+2]==blank)&& (Board[w_rk_p[0]+3]==blank)&& (Board[w_rk_p[0]+4]==blank)&& (Board[w_rk_p[0]+5]==blank)) { w_rk[12]=w_rk_p[0]+6; } if((Board[w_rk_p[0]+1]==blank)&& (Board[w_rk_p[0]+2]==blank)&& (Board[w_rk_p[0]+3]==blank)&& (Board[w_rk_p[0]+4]==blank)&& (Board[w_rk_p[0]+5]==blank)&& (Board[w_rk_p[0]+6]==blank)) { w_rk[13]=w_rk_p[0]+7; } } if(CheckColumn_ret==2) { w_rk[7]=w_rk_p[0]-1; w_rk[8]=w_rk_p[0]+1; if(Board[w_rk_p[0]+1]==blank) { w_rk[9]=w_rk_p[0]+2; } if((Board[w_rk_p[0]+1]==blank)&& (Board[w_rk_p[0]+2]==blank)) { w_rk[10]=w_rk_p[0]+3; } if((Board[w_rk_p[0]+1]==blank)&& (Board[w_rk_p[0]+2]==blank)&& (Board[w_rk_p[0]+3]==blank)) { w_rk[11]=w_rk_p[0]+4; } if((Board[w_rk_p[0]+1]==blank)&& (Board[w_rk_p[0]+2]==blank)&& (Board[w_rk_p[0]+3]==blank)&& (Board[w_rk_p[0]+4]==blank)) { w_rk[12]=w_rk_p[0]+5; } if((Board[w_rk_p[0]+1]==blank)&& (Board[w_rk_p[0]+2]==blank)&& (Board[w_rk_p[0]+3]==blank)&& (Board[w_rk_p[0]+4]==blank)&& (Board[w_rk_p[0]+5]==blank)) { w_rk[13]=w_rk_p[0]+6; } } if(CheckColumn_ret==3) { if(Board[w_rk_p[0]-1]==blank) { w_rk[7]=w_rk_p[0]-2; } w_rk[8]=w_rk_p[0]-1; w_rk[9]=w_rk_p[0]+1; if(Board[w_rk_p[0]+1]==blank) { w_rk[10]=w_rk_p[0]+2; } if((Board[w_rk_p[0]+1]==blank)&& (Board[w_rk_p[0]+2]==blank)) { w_rk[11]=w_rk_p[0]+3; } if((Board[w_rk_p[0]+1]==blank)&& (Board[w_rk_p[0]+2]==blank)&& (Board[w_rk_p[0]+3]==blank)) { w_rk[12]=w_rk_p[0]+4; } if((Board[w_rk_p[0]+1]==blank)&& (Board[w_rk_p[0]+2]==blank)&& (Board[w_rk_p[0]+3]==blank)&& (Board[w_rk_p[0]+4]==blank)) { w_rk[13]=w_rk_p[0]+5; } } if(CheckColumn_ret==4) { if((Board[w_rk_p[0]-2]==blank)&& (Board[w_rk_p[0]-1]==blank)) { w_rk[7]=w_rk_p[0]-3; } if(Board[w_rk_p[0]-1]==blank) { w_rk[8]=w_rk_p[0]-2; } w_rk[9]=w_rk_p[0]-1; w_rk[10]=w_rk_p[0]+1; if(Board[w_rk_p[0]+1]==blank) { w_rk[11]=w_rk_p[0]+2; } if((Board[w_rk_p[0]+1]==blank)&& (Board[w_rk_p[0]+2]==blank)) { w_rk[12]=w_rk_p[0]+3; } if((Board[w_rk_p[0]+1]==blank)&& (Board[w_rk_p[0]+2]==blank)&& (Board[w_rk_p[0]+3]==blank)) { w_rk[13]=w_rk_p[0]+4; } } if(CheckColumn_ret==5) { if((Board[w_rk_p[0]-3]==blank)&& (Board[w_rk_p[0]-2]==blank)&& (Board[w_rk_p[0]-1]==blank)) { w_rk[7]=w_rk_p[0]-4; } if((Board[w_rk_p[0]-2]==blank)&& (Board[w_rk_p[0]-1]==blank)) { w_rk[8]=w_rk_p[0]-3; } if(Board[w_rk_p[0]-1]==blank) { w_rk[9]=w_rk_p[0]-2; } w_rk[10]=w_rk_p[0]-1; w_rk[11]=w_rk_p[0]+1; if(Board[w_rk_p[0]+1]==blank) { w_rk[12]=w_rk_p[0]+2; } if((Board[w_rk_p[0]+1]==blank)&& (Board[w_rk_p[0]+2]==blank)) { w_rk[13]=w_rk_p[0]+3; } } if(CheckColumn_ret==6) { if((Board[w_rk_p[0]-4]==blank)&& (Board[w_rk_p[0]-3]==blank)&& (Board[w_rk_p[0]-2]==blank)&& (Board[w_rk_p[0]-1]==blank)) { w_rk[7]=w_rk_p[0]-5; } if((Board[w_rk_p[0]-3]==blank)&& (Board[w_rk_p[0]-2]==blank)&& (Board[w_rk_p[0]-1]==blank)) { w_rk[8]=w_rk_p[0]-4; } if((Board[w_rk_p[0]-2]==blank)&& (Board[w_rk_p[0]-1]==blank)) { w_rk[9]=w_rk_p[0]-3; } if(Board[w_rk_p[0]-1]==blank) { w_rk[10]=w_rk_p[0]-2; } w_rk[11]=w_rk_p[0]-1; w_rk[12]=w_rk_p[0]+1; if(Board[w_rk_p[0]+1]==blank) { w_rk[13]=w_rk_p[0]+2; } } if(CheckColumn_ret==7) { if((Board[w_rk_p[0]-5]==blank)&& (Board[w_rk_p[0]-4]==blank)&& (Board[w_rk_p[0]-3]==blank)&& (Board[w_rk_p[0]-2]==blank)&& (Board[w_rk_p[0]-1]==blank)) { w_rk[7]=w_rk_p[0]-6; } if((Board[w_rk_p[0]-4]==blank)&& (Board[w_rk_p[0]-3]==blank)&& (Board[w_rk_p[0]-2]==blank)&& (Board[w_rk_p[0]-1]==blank)) { w_rk[8]=w_rk_p[0]-5; } if((Board[w_rk_p[0]-3]==blank)&& (Board[w_rk_p[0]-2]==blank)&& (Board[w_rk_p[0]-1]==blank)) { w_rk[9]=w_rk_p[0]-4; } if((Board[w_rk_p[0]-2]==blank)&& (Board[w_rk_p[0]-1]==blank)) { w_rk[10]=w_rk_p[0]-3; } if(Board[w_rk_p[0]-1]==blank) { w_rk[11]=w_rk_p[0]-2; } w_rk[12]=w_rk_p[0]-1; w_rk[13]=w_rk_p[0]+1; } if(CheckColumn_ret==8) { if((Board[w_rk_p[0]-6]==blank)&& (Board[w_rk_p[0]-5]==blank)&& (Board[w_rk_p[0]-4]==blank)&& (Board[w_rk_p[0]-3]==blank)&& (Board[w_rk_p[0]-2]==blank)&& (Board[w_rk_p[0]-1]==blank)) { w_rk[7]=w_rk_p[0]-7; } if((Board[w_rk_p[0]-5]==blank)&& (Board[w_rk_p[0]-4]==blank)&& (Board[w_rk_p[0]-3]==blank)&& (Board[w_rk_p[0]-2]==blank)&& (Board[w_rk_p[0]-1]==blank)) { w_rk[8]=w_rk_p[0]-6; } if((Board[w_rk_p[0]-4]==blank)&& (Board[w_rk_p[0]-3]==blank)&& (Board[w_rk_p[0]-2]==blank)&& (Board[w_rk_p[0]-1]==blank)) { w_rk[9]=w_rk_p[0]-5; } if((Board[w_rk_p[0]-3]==blank)&& (Board[w_rk_p[0]-2]==blank)&& (Board[w_rk_p[0]-1]==blank)) { w_rk[10]=w_rk_p[0]-4; } if((Board[w_rk_p[0]-2]==blank)&& (Board[w_rk_p[0]-1]==blank)) { w_rk[11]=w_rk_p[0]-3; } if(Board[w_rk_p[0]-1]==blank) { w_rk[12]=w_rk_p[0]-2; } w_rk[13]=w_rk_p[0]-1; } } if(w_rk_p[1]>-1) { CheckRowValue=0; CheckColumn_ret=0; CheckRow(w_rk_p[1]); CheckColumn(w_rk_p[1]); if(CheckRowValue==1) { w_rk[14]=w_rk_p[1]+9; if(Board[w_rk_p[1]+9]==blank) { w_rk[15]=w_rk_p[1]+18; } if((Board[w_rk_p[1]+9]==blank)&& (Board[w_rk_p[1]+18]==blank)) { w_rk[16]=w_rk_p[1]+27; } if((Board[w_rk_p[1]+9]==blank)&& (Board[w_rk_p[1]+18]==blank)&& (Board[w_rk_p[1]+27]==blank)) { w_rk[17]=w_rk_p[1]+36; } if((Board[w_rk_p[1]+9]==blank)&& (Board[w_rk_p[1]+18]==blank)&& (Board[w_rk_p[1]+27]==blank)&& (Board[w_rk_p[1]+36]==blank)) { w_rk[18]=w_rk_p[1]+45; } if((Board[w_rk_p[1]+9]==blank)&& (Board[w_rk_p[1]+18]==blank)&& (Board[w_rk_p[1]+27]==blank)&& (Board[w_rk_p[1]+36]==blank)&& (Board[w_rk_p[1]+45]==blank)) { w_rk[19]=w_rk_p[1]+54; } if((Board[w_rk_p[1]+9]==blank)&& (Board[w_rk_p[1]+18]==blank)&& (Board[w_rk_p[1]+27]==blank)&& (Board[w_rk_p[1]+36]==blank)&& (Board[w_rk_p[1]+45]==blank)&& (Board[w_rk_p[1]+54]==blank)) { w_rk[20]=w_rk_p[1]+63; } } if(CheckRowValue==2) { w_rk[14]=w_rk_p[1]-9; w_rk[15]=w_rk_p[1]+9; if(Board[w_rk_p[1]+9]==blank) { w_rk[16]=w_rk_p[1]+18; } if((Board[w_rk_p[1]+9]==blank)&& (Board[w_rk_p[1]+18]==blank)) { w_rk[17]=w_rk_p[1]+27; } if((Board[w_rk_p[1]+9]==blank)&& (Board[w_rk_p[1]+18]==blank)&& (Board[w_rk_p[1]+27]==blank)) { w_rk[18]=w_rk_p[1]+36; } if((Board[w_rk_p[1]+9]==blank)&& (Board[w_rk_p[1]+18]==blank)&& (Board[w_rk_p[1]+27]==blank)&& (Board[w_rk_p[1]+36]==blank)) { w_rk[19]=w_rk_p[1]+45; } if((Board[w_rk_p[1]+9]==blank)&& (Board[w_rk_p[1]+18]==blank)&& (Board[w_rk_p[1]+27]==blank)&& (Board[w_rk_p[1]+36]==blank)&& (Board[w_rk_p[1]+45]==blank)) { w_rk[20]=w_rk_p[1]+54; } } if(CheckRowValue==3) { if(Board[w_rk_p[1]-9]==blank) { w_rk[14]=w_rk_p[1]-18; } w_rk[15]=w_rk_p[1]-9; w_rk[16]=w_rk_p[1]+9; if(Board[w_rk_p[1]+9]==blank) { w_rk[17]=w_rk_p[1]+18; } if((Board[w_rk_p[1]+9]==blank)&& (Board[w_rk_p[1]+18]==blank)) { w_rk[18]=w_rk_p[1]+27; } if((Board[w_rk_p[1]+9]==blank)&& (Board[w_rk_p[1]+18]==blank)&& (Board[w_rk_p[1]+27]==blank)) { w_rk[19]=w_rk_p[1]+36; } if((Board[w_rk_p[1]+9]==blank)&& (Board[w_rk_p[1]+18]==blank)&& (Board[w_rk_p[1]+27]==blank)&& (Board[w_rk_p[1]+36]==blank)) { w_rk[20]=w_rk_p[1]+45; } } if(CheckRowValue==4) { if((Board[w_rk_p[1]-18]==blank)&& (Board[w_rk_p[1]-9]==blank)) { w_rk[14]=w_rk_p[1]-27; } if(Board[w_rk_p[1]-9]==blank) { w_rk[15]=w_rk_p[1]-18; } w_rk[16]=w_rk_p[1]-9; w_rk[17]=w_rk_p[1]+9; if(Board[w_rk_p[1]+9]==blank) { w_rk[18]=w_rk_p[1]+18; } if((Board[w_rk_p[1]+9]==blank)&& (Board[w_rk_p[1]+18]==blank)) { w_rk[19]=w_rk_p[1]+27; } if((Board[w_rk_p[1]+9]==blank)&& (Board[w_rk_p[1]+18]==blank)&& (Board[w_rk_p[1]+27]==blank)) { w_rk[20]=w_rk_p[1]+36; } } if(CheckRowValue==5) { if((Board[w_rk_p[1]-27]==blank)&& (Board[w_rk_p[1]-18]==blank)&& (Board[w_rk_p[1]-9]==blank)) { w_rk[14]=w_rk_p[1]-36; } if((Board[w_rk_p[1]-18]==blank)&& (Board[w_rk_p[1]-9]==blank)) { w_rk[15]=w_rk_p[1]-27; } if(Board[w_rk_p[1]-9]==blank) { w_rk[16]=w_rk_p[1]-18; } w_rk[17]=w_rk_p[1]-9; w_rk[18]=w_rk_p[1]+9; if(Board[w_rk_p[1]+9]==blank) { w_rk[19]=w_rk_p[1]+18; } if((Board[w_rk_p[1]+9]==blank)&& (Board[w_rk_p[1]+18]==blank)) { w_rk[20]=w_rk_p[1]+27; } } if(CheckRowValue==6) { if((Board[w_rk_p[1]-36]==blank)&& (Board[w_rk_p[1]-27]==blank)&& (Board[w_rk_p[1]-18]==blank)&& (Board[w_rk_p[1]-9]==blank)) { w_rk[14]=w_rk_p[1]-45; } if((Board[w_rk_p[1]-27]==blank)&& (Board[w_rk_p[1]-18]==blank)&& (Board[w_rk_p[1]-9]==blank)) { w_rk[15]=w_rk_p[1]-36; } if((Board[w_rk_p[1]-18]==blank)&& (Board[w_rk_p[1]-9]==blank)) { w_rk[16]=w_rk_p[1]-27; } if((Board[w_rk_p[1]-9]==blank)) { w_rk[17]=w_rk_p[1]-18; } w_rk[18]=w_rk_p[1]-9; w_rk[19]=w_rk_p[1]+9; if((Board[w_rk_p[1]+9]==blank)) { w_rk[20]=w_rk_p[1]+18; } } if(CheckRowValue==7) { if((Board[w_rk_p[1]-45]==blank)&& (Board[w_rk_p[1]-36]==blank)&& (Board[w_rk_p[1]-27]==blank)&& (Board[w_rk_p[1]-18]==blank)&& (Board[w_rk_p[1]-9]==blank)) { w_rk[14]=w_rk_p[1]-54; } if((Board[w_rk_p[1]-36]==blank)&& (Board[w_rk_p[1]-27]==blank)&& (Board[w_rk_p[1]-18]==blank)&& (Board[w_rk_p[1]-9]==blank)) { w_rk[15]=w_rk_p[1]-45; } if((Board[w_rk_p[1]-27]==blank)&& (Board[w_rk_p[1]-18]==blank)&& (Board[w_rk_p[1]-9]==blank)) { w_rk[16]=w_rk_p[1]-36; } if((Board[w_rk_p[1]-18]==blank)&& (Board[w_rk_p[1]-9]==blank)) { w_rk[17]=w_rk_p[1]-27; } if((Board[w_rk_p[1]-9]==blank)) { w_rk[18]=w_rk_p[1]-18; } w_rk[19]=w_rk_p[1]-9; w_rk[20]=w_rk_p[1]+9; } if(CheckRowValue==8) { if((Board[w_rk_p[1]-9]==blank)&& (Board[w_rk_p[1]-18]==blank)&& (Board[w_rk_p[1]-27]==blank)&& (Board[w_rk_p[1]-36]==blank)&& (Board[w_rk_p[1]-45]==blank)&& (Board[w_rk_p[1]-54]==blank)) { w_rk[14]=w_rk_p[1]-63; } if((Board[w_rk_p[1]-9]==blank)&& (Board[w_rk_p[1]-18]==blank)&& (Board[w_rk_p[1]-27]==blank)&& (Board[w_rk_p[1]-36]==blank)&& (Board[w_rk_p[1]-45]==blank)) { w_rk[15]=w_rk_p[1]-54; } if((Board[w_rk_p[1]-9]==blank)&& (Board[w_rk_p[1]-18]==blank)&& (Board[w_rk_p[1]-27]==blank)&& (Board[w_rk_p[1]-36]==blank)) { w_rk[16]=w_rk_p[1]-45; } if((Board[w_rk_p[1]-9]==blank)&& (Board[w_rk_p[1]-18]==blank)&& (Board[w_rk_p[1]-27]==blank)) { w_rk[17]=w_rk_p[1]-36; } if((Board[w_rk_p[1]-9]==blank)&& (Board[w_rk_p[1]-18]==blank)) { w_rk[18]=w_rk_p[1]-27; } if(Board[w_rk_p[1]-9]==blank) { w_rk[19]=w_rk_p[1]-18; } w_rk[20]=w_rk_p[1]-9; } if(CheckColumn_ret==1) { w_rk[21]=w_rk_p[1]+1; if(Board[w_rk_p[1]+1]==blank) { w_rk[22]=w_rk_p[1]+2; } if((Board[w_rk_p[1]+1]==blank)&& (Board[w_rk_p[1]+2]==blank)) { w_rk[23]=w_rk_p[1]+3; } if((Board[w_rk_p[1]+1]==blank)&& (Board[w_rk_p[1]+2]==blank)&& (Board[w_rk_p[1]+3]==blank)) { w_rk[24]=w_rk_p[1]+4; } if((Board[w_rk_p[1]+1]==blank)&& (Board[w_rk_p[1]+2]==blank)&& (Board[w_rk_p[1]+3]==blank)&& (Board[w_rk_p[1]+4]==blank)) { w_rk[25]=w_rk_p[1]+5; } if((Board[w_rk_p[1]+1]==blank)&& (Board[w_rk_p[1]+2]==blank)&& (Board[w_rk_p[1]+3]==blank)&& (Board[w_rk_p[1]+4]==blank)&& (Board[w_rk_p[1]+5]==blank)) { w_rk[26]=w_rk_p[1]+6; } if((Board[w_rk_p[1]+1]==blank)&& (Board[w_rk_p[1]+2]==blank)&& (Board[w_rk_p[1]+3]==blank)&& (Board[w_rk_p[1]+4]==blank)&& (Board[w_rk_p[1]+5]==blank)&& (Board[w_rk_p[1]+6]==blank)) { w_rk[27]=w_rk_p[1]+7; } } if(CheckColumn_ret==2) { w_rk[21]=w_rk_p[1]-1; w_rk[22]=w_rk_p[1]+1; if(Board[w_rk_p[1]+1]==blank) { w_rk[23]=w_rk_p[1]+2; } if((Board[w_rk_p[1]+1]==blank)&& (Board[w_rk_p[1]+2]==blank)) { w_rk[24]=w_rk_p[1]+3; } if((Board[w_rk_p[1]+1]==blank)&& (Board[w_rk_p[1]+2]==blank)&& (Board[w_rk_p[1]+3]==blank)) { w_rk[25]=w_rk_p[1]+4; } if((Board[w_rk_p[1]+1]==blank)&& (Board[w_rk_p[1]+2]==blank)&& (Board[w_rk_p[1]+3]==blank)&& (Board[w_rk_p[1]+4]==blank)) { w_rk[26]=w_rk_p[1]+5; } if((Board[w_rk_p[1]+1]==blank)&& (Board[w_rk_p[1]+2]==blank)&& (Board[w_rk_p[1]+3]==blank)&& (Board[w_rk_p[1]+4]==blank)&& (Board[w_rk_p[1]+5]==blank)) { w_rk[27]=w_rk_p[1]+6; } } if(CheckColumn_ret==3) { if(Board[w_rk_p[1]-1]==blank) { w_rk[21]=w_rk_p[1]-2; } w_rk[22]=w_rk_p[1]-1; w_rk[23]=w_rk_p[1]+1; if(Board[w_rk_p[1]+1]==blank) { w_rk[24]=w_rk_p[1]+2; } if((Board[w_rk_p[1]+1]==blank)&& (Board[w_rk_p[1]+2]==blank)) { w_rk[25]=w_rk_p[1]+3; } if((Board[w_rk_p[1]+1]==blank)&& (Board[w_rk_p[1]+2]==blank)&& (Board[w_rk_p[1]+3]==blank)) { w_rk[26]=w_rk_p[1]+4; } if((Board[w_rk_p[1]+1]==blank)&& (Board[w_rk_p[1]+2]==blank)&& (Board[w_rk_p[1]+3]==blank)&& (Board[w_rk_p[1]+4]==blank)) { w_rk[27]=w_rk_p[1]+5; } } if(CheckColumn_ret==4) { if((Board[w_rk_p[1]-2]==blank)&& (Board[w_rk_p[1]-1]==blank)) { w_rk[21]=w_rk_p[1]-3; } if(Board[w_rk_p[1]-1]==blank) { w_rk[22]=w_rk_p[1]-2; } w_rk[23]=w_rk_p[1]-1; w_rk[24]=w_rk_p[1]+1; if(Board[w_rk_p[1]+1]==blank) { w_rk[25]=w_rk_p[1]+2; } if((Board[w_rk_p[1]+1]==blank)&& (Board[w_rk_p[1]+2]==blank)) { w_rk[26]=w_rk_p[1]+3; } if((Board[w_rk_p[1]+1]==blank)&& (Board[w_rk_p[1]+2]==blank)&& (Board[w_rk_p[1]+3]==blank)) { w_rk[27]=w_rk_p[1]+4; } } if(CheckColumn_ret==5) { if((Board[w_rk_p[1]-3]==blank)&& (Board[w_rk_p[1]-2]==blank)&& (Board[w_rk_p[1]-1]==blank)) { w_rk[21]=w_rk_p[1]-4; } if((Board[w_rk_p[1]-2]==blank)&& (Board[w_rk_p[1]-1]==blank)) { w_rk[22]=w_rk_p[1]-3; } if(Board[w_rk_p[1]-1]==blank) { w_rk[23]=w_rk_p[1]-2; } w_rk[24]=w_rk_p[1]-1; w_rk[25]=w_rk_p[1]+1; if(Board[w_rk_p[1]+1]==blank) { w_rk[26]=w_rk_p[1]+2; } if((Board[w_rk_p[1]+1]==blank)&& (Board[w_rk_p[1]+2]==blank)) { w_rk[27]=w_rk_p[1]+3; } } if(CheckColumn_ret==6) { if((Board[w_rk_p[1]-4]==blank)&& (Board[w_rk_p[1]-3]==blank)&& (Board[w_rk_p[1]-2]==blank)&& (Board[w_rk_p[1]-1]==blank)) { w_rk[21]=w_rk_p[1]-5; } if((Board[w_rk_p[1]-3]==blank)&& (Board[w_rk_p[1]-2]==blank)&& (Board[w_rk_p[1]-1]==blank)) { w_rk[22]=w_rk_p[1]-4; } if((Board[w_rk_p[1]-2]==blank)&& (Board[w_rk_p[1]-1]==blank)) { w_rk[23]=w_rk_p[1]-3; } if(Board[w_rk_p[1]-1]==blank) { w_rk[24]=w_rk_p[1]-2; } w_rk[25]=w_rk_p[1]-1; w_rk[26]=w_rk_p[1]+1; if(Board[w_rk_p[1]+1]==blank) { w_rk[27]=w_rk_p[1]+2; } } if(CheckColumn_ret==7) { if((Board[w_rk_p[1]-5]==blank)&& (Board[w_rk_p[1]-4]==blank)&& (Board[w_rk_p[1]-3]==blank)&& (Board[w_rk_p[1]-2]==blank)&& (Board[w_rk_p[1]-1]==blank)) { w_rk[21]=w_rk_p[1]-6; } if((Board[w_rk_p[1]-4]==blank)&& (Board[w_rk_p[1]-3]==blank)&& (Board[w_rk_p[1]-2]==blank)&& (Board[w_rk_p[1]-1]==blank)) { w_rk[22]=w_rk_p[1]-5; } if((Board[w_rk_p[1]-3]==blank)&& (Board[w_rk_p[1]-2]==blank)&& (Board[w_rk_p[1]-1]==blank)) { w_rk[23]=w_rk_p[1]-4; } if((Board[w_rk_p[1]-2]==blank)&& (Board[w_rk_p[1]-1]==blank)) { w_rk[24]=w_rk_p[1]-3; } if(Board[w_rk_p[1]-1]==blank) { w_rk[25]=w_rk_p[1]-2; } w_rk[26]=w_rk_p[1]-1; w_rk[27]=w_rk_p[1]+1; } if(CheckColumn_ret==8) { if((Board[w_rk_p[1]-6]==blank)&& (Board[w_rk_p[1]-5]==blank)&& (Board[w_rk_p[1]-4]==blank)&& (Board[w_rk_p[1]-3]==blank)&& (Board[w_rk_p[1]-2]==blank)&& (Board[w_rk_p[1]-1]==blank)) { w_rk[21]=w_rk_p[1]-7; } if((Board[w_rk_p[1]-5]==blank)&& (Board[w_rk_p[1]-4]==blank)&& (Board[w_rk_p[1]-3]==blank)&& (Board[w_rk_p[1]-2]==blank)&& (Board[w_rk_p[1]-1]==blank)) { w_rk[22]=w_rk_p[1]-6; } if((Board[w_rk_p[1]-4]==blank)&& (Board[w_rk_p[1]-3]==blank)&& (Board[w_rk_p[1]-2]==blank)&& (Board[w_rk_p[1]-1]==blank)) { w_rk[23]=w_rk_p[1]-5; } if((Board[w_rk_p[1]-3]==blank)&& (Board[w_rk_p[1]-2]==blank)&& (Board[w_rk_p[1]-1]==blank)) { w_rk[24]=w_rk_p[1]-4; } if((Board[w_rk_p[1]-2]==blank)&& (Board[w_rk_p[1]-1]==blank)) { w_rk[25]=w_rk_p[1]-3; } if(Board[w_rk_p[1]-1]==blank) { w_rk[26]=w_rk_p[1]-2; } w_rk[27]=w_rk_p[1]-1; } } King=0x6B; i=0; for(; i<28; ++i) { if(Board[w_rk[i]]==King)Check=1; if(a>-1) { if(w_rk[i]==a) if(CheckerID1==-1){ CheckerID1=w_rk[i]; } if(CheckerID2==-1){ CheckerID2=w_rk[i]; } if(CheckerID3==-1){ CheckerID3=w_rk[i]; } if(CheckerID4==-1){ CheckerID4=w_rk[i]; } if(CheckerID5==-1){ CheckerID5=w_rk[i]; } if(CheckerID6==-1){ CheckerID6=w_rk[i]; } return 1; } } }