SATRANÇ OYUNUNUN C++ İLE GERÇEKLENDİĞİ KOD AŞAĞIDADIR BU OYUN AYNI ZAMANDA BENİM İLK YAZILIM PROJESİDİR.BİR SORUN OLURSA SORABİLİRSİNİZ
OYUN CONSOLE EKRANINI OLDUĞUNDAN TEK TEK KORDİNAT KORDİNAT GİRİP ÖYLE İCRA ETTİRİLİR.
#include<iostream>
using namespace std;
void dizme();
void yaz();
void Bpiyon(int k,int l,int x,int y);
void Kpiyon(int k,int l,int x,int y);
void Kale(int k,int l,int x,int y,int m);
void At(int k,int l,int x,int y,int m);
void Fil(int k,int l,int x,int y,int m);
void Sah(int k,int l,int x,int y,int m);
void Vezir(int k,int l,int x,int y,int m);
int control();
int recognition(int x,int y);
char board [8][8];
main()
{
system(“color 5a”);
gel:
int p,r,k,l,m;
int x,y;
cout<<endl<<endl;
p=1;
char limit;
limit=’E’;
while(limit==’E’)
{ system (“cls”);
dizme();
yaz();
while(p){
if(p){
cout<<“1.oyuncu oynamak istedigin kordinati gir:”;
cin>>x>>y;
r=recognition(x,y);
m=board[x][y];
switch(r){
case 1:
cout<<“BUYUK Piyon icin oynayacagin konumu gir:”;
cin>>k>>l;
system (“cls”);
Bpiyon(k,l,x,y);
yaz();
break;
case 2:
cout<<“BUYUK Kale icin oynayacagin konumu gir:”;
cin>>k>>l;
system (“cls”);
Kale(k,l,x,y,m);
yaz();
break;
case 3:
cout<<“BUYUK At icin oynayacagin konumu gir:”;
cin>>k>>l;
system (“cls”);
At(k,l,x,y,m);
yaz();
break;
case 4:
cout<<“BUYUK Fil icin oynayacagin konumu gir:”;
cin>>k>>l;
system (“cls”);
Fil(k,l,x,y,m);
yaz();
break;
case 5:
cout<<“BUYUK Vezir icin oynayacagin konumu gir:”;
cin>>k>>l;
system (“cls”);
Vezir(k,l,x,y,m);
yaz();
break;
case 6:
cout<<“BUYUK Sah icin oynayacagin konumu gir:”;
cin>>k>>l;
system (“cls”);
Sah(k,l,x,y,m);
yaz();
break;
}}
else{
system (“cls”);
cout<<endl<<endl;
cout<<“………..Maalesef Oyunumuz bitmistir………”;
cout<<endl<<endl;
}
p=control();
if(p){
cout<<“2.oyuncu oynamak istedigin kordinati gir:”;
cin>>x>>y;
r=recognition(x,y);
m=board[x][y];
switch(r){
case 7:
cout<<“KUCUK Piyon icin oynayacagin konumu gir:”;
cin>>k>>l;
system (“cls”);
Kpiyon(k,l,x,y);
yaz();
break;
case 8:
cout<<“KUCUK Kale icin oynayacagin konumu gir:”;
cin>>k>>l;
system (“cls”);
Kale(k,l,x,y,m);
yaz();
break;
case 9:
cout<<“KUCUK At icin oynayacagin konumu gir:”;
cin>>k>>l;
system (“cls”);
At(k,l,x,y,m);
yaz();
break;
case 10:
cout<<“KUCUK Fil icin oynayacagin konumu gir:”;
cin>>k>>l;
system (“cls”);
Fil(k,l,x,y,m);
yaz();
break;
case 11:
cout<<“KUCUK Vezir icin oynayacagin konumu gir:”;
cin>>k>>l;
system (“cls”);
Vezir(k,l,x,y,m);
yaz();
break;
case 12:
cout<<“KUCUK Sah icin oynayacagin konumu gir:”;
cin>>k>>l;
system (“cls”);
Sah(k,l,x,y,m);
yaz();
break;
}}
else{
system (“cls”);
cout<<endl<<endl;
cout<<“………..Maalesef Oyunumuz bitmistir………”;
cout<<endl<<endl;
}
p=control();
}
cout<<“Oyunu yeniden oynamak isterseniz E istemiyorsaniz H basin:”;
cin>>limit;
p=1;
system(“color 2c”);
}
system(“pause”);
}
//——————————————————————————
int recognition(int x,int y)
{
int l=board[x][y];
switch(l){
case 80:
return 1;
case 75:
return 2;
case 65:
return 3;
case 70:
return 4;
case 86:
return 5;
case 83:
return 6;
case 112:
return 7;
case 107:
return 8;
case 97:
return 9;
case 102:
return 10;
case 118:
return 11;
case 115:
return 12;
}
}
//——————————————————————————
int control()
{
int counter=0;
// dizme();
for(int i=0;i<8;i++){
for(int j=0;j<8;j++){
if(board[i][j]==83)
counter++;
if(board[i][j]==115)
counter++;
}}
if(counter==2)
return 1;
else
return 0;
}
//——————————————————————————
void dizme()
{
board[0][0]=’K’;
board[0][7]=’K’;
board[0][1]=’A’;
board[0][6]=’A’;
board[0][2]=’F’;
board[0][5]=’F’;
board[0][3]=’V’;
board[0][4]=’S’;
for(int j=0;j<8;j++){
board[1][j]=’P’;
board[6][j]=’p’;}
board[7][0]=’k’;
board[7][7]=’k’;
board[7][1]=’a’;
board[7][6]=’a’;
board[7][2]=’f’;
board[7][5]=’f’;
board[7][3]=’v’;
board[7][4]=’s’;
for(int i=2;i<6;i++)
for(int j=0;j<8;j++)
if((i+j)%2==0)
board[i][j]=’\xdb’;
else
board[i][j]=’\xb0′;
}
//——————————————————————————
void yaz()
{
cout<<” MEHMET SALIH DEVECI 02.05.2009″;
cout<<endl<<endl<<endl;
for(int i=0;i<8;i++){cout<<” “;
for(int j=0;j<8;j++)
cout<<board[i][j]<<” “;
cout<<endl<<endl;
}}
//——————————————————————————
void Bpiyon(int k,int l,int x,int y)
{
if((k>=0&&k<8)&&(l>=0&&l<8)){
if(x==1){
if((k==x+1||k==x+2)&&l==y){
board[k][l]=’P’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
}
else
if(k==x+1&&l==y){
board[k][l]=’P’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
else
if(k==x+1&&l==y-1)
if(board[k][l]!=’\xdb’||board[k][l]!=’\xb0′){
if((board[k][l]>96)&&(board[k][l]<123)){
board[k][l]=’P’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
else
board[x][y]=’P’;
}
else
if(k==x+1&&l==y+1)
if(board[k][l]!=’\xdb’||board[k][l]!=’\xb0′){
if((board[k][l]>96)&&(board[k][l]<123)){
board[k][l]=’P’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
else
board[x][y]=’P’;
}
else
if(x!=1&&x!=0)
{
if(k==x+2&&l==y)
board[k][l]=’P’;
} }
}
//——————————————————————————
void Kpiyon(int k,int l,int x,int y)
{
if((k>=0&&k<8)&&(l>=0&&l<8)){
if(x==6){
if((k==x-1||k==x-2)&&l==y){
board[k][l]=’p’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
}
else
if(k==x-1&&l==y){
board[k][l]=’p’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
else
if(k==x-1&&l==y-1){
if(board[k][l]!=’\xdb’||board[k][l]!=’\xb0′)
if((board[k][l]>64)&&(board[k][l]<91)){
board[k][l]=’p’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
else
board[x][y]=’p’;
}
else
if(k==x-1&&l==y+1){
if(board[k][l]!=’\xdb’||board[k][l]!=’\xb0′)
if((board[k][l]>64)&&(board[k][l]<91)){
board[k][l]=’p’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
else
board[x][y]=’p’;
}}
}
//——————————————————————————
void Kale(int k,int l,int x,int y,int m)
{
int counter=0;
if((k>=0&&k<8)&&(l>=0&&l<8)){
if(m==75&&(!(board[k][l]>64&&board[k][l]<91))||(m==107&&(!(board[k][l]>96&&board[k][l]<123)))){
if(k>x&&l==y){
for(int a=x+1;a<=k;a++)
if((!(board[a][l]>64&&board[a][l]<91))&&(!(board[a][l]>96&&board[a][l]<123)))
if(board[a][l]==’\xb0’||board[a][l]==’\xdb’)
counter++;
if(counter==k-x-1){
if(m==75)
board[k][l]=’K’;
else
if(m==107)
board[k][l]=’k’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
counter=0;
for(int a=x;a<k;a++)
if(board[a][l]==’\xb0’||board[a][l]==’\xdb’)
counter++;
if(counter==k-x-1){
if(m==75)
board[k][l]=’K’;
else
if(m==107)
board[k][l]=’k’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
}
if(k<x&&l==y){
for(int a=k;a<x;a++)
if((!(board[a][l]>64&&board[a][l]<91))&&(!(board[a][l]>96&&board[a][l]<123)))
if(board[a][l]==’\xb0’||board[a][l]==’\xdb’)
counter++;
if(counter==x-k){
if(m==75)
board[k][l]=’K’;
else
if(m==107)
board[k][l]=’k’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
counter=0;
for(int a=k;a<x;a++)
if(board[a][l]==’\xb0’||board[a][l]==’\xdb’)
counter++;
if(counter==x-k){
if(m==75)
board[k][l]=’K’;
else
if(m==107)
board[k][l]=’k’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
}
if(k==x&&l>y){
for(int a=y+1;a<=l;a++)
if((!(board[k][a]>64&&board[k][a]<91))&&(!(board[k][a]>96&&board[k][a]<123)))
if(board[k][a]==’\xb0’||board[k][a]==’\xdb’)
counter++;
if(counter==l-y){
if(m==75)
board[k][l]=’K’;
else
if(m==107)
board[k][l]=’k’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
counter=0;
for(int a=y+1;a<l;a++)
if(board[k][a]==’\xb0’||board[k][a]==’\xdb’)
counter++;
if(counter==l-y-1){
if(m==75)
board[k][l]=’K’;
else
if(m==107)
board[k][l]=’k’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
}
if(k==x&&l<y){
for(int a=l+1;a<y;a++)
if((!(board[k][a]>64&&board[k][a]<91))&&(!(board[k][a]>96&&board[k][a]<123)))
if(board[k][a]==’\xb0’||board[k][a]==’\xdb’)
counter++;
if(counter==y-l-1){
if(m==75)
board[k][l]=’K’;
else
if(m==107)
board[k][l]=’k’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
counter=0;
for(int a=y+1;a<l;a++)
if(board[k][a]==’\xb0’||board[k][a]==’\xdb’)
counter++;
if(counter==y-l-1){
if(m==75)
board[k][l]=’K’;
else
if(m==107)
board[k][l]=’k’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
} }}
}
//——————————————————————————
void At(int k,int l,int x,int y,int m)
{
if((k>=0&&k<8)&&(l>=0&&l<8)){
if(m==65&&(!(board[k][l]>64&&board[k][l]<91))||(m==97&&(!(board[k][l]>96&&board[k][l]<123)))){
if(k==x+2&&l==y-1){
if((!(board[k][l]>64&&board[k][l]<91))){
if(m==65)
board[k][l]=’A’;
else
if(m==97)
board[k][l]=’a’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}}
else
if(k==x+2&&l==y+1){
if((!(board[k][l]>64&&board[k][l]<91))){
if(m==65)
board[k][l]=’A’;
else
if(m==97)
board[k][l]=’a’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
} }
else
if(k==x+1&&l==y+2){
if((!(board[k][l]>64&&board[k][l]<91))){
if(m==65)
board[k][l]=’A’;
else
if(m==97)
board[k][l]=’a’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
} }
else
if(k==x+1&&l==y-2){
if((!(board[k][l]>64&&board[k][l]<91))){
if(m==65)
board[k][l]=’A’;
else
if(m==97)
board[k][l]=’a’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
} }
else
if(k==x-1&&l==y-2){
if((!(board[k][l]>64&&board[k][l]<91))){
if(m==65)
board[k][l]=’A’;
else
if(m==97)
board[k][l]=’a’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
} }
else
if(k==x-2&&l==y-1){
if((!(board[k][l]>64&&board[k][l]<91))){
if(m==65)
board[k][l]=’A’;
else
if(m==97)
board[k][l]=’a’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
} }
else
if(k==x-2&&l==y+1){
if((!(board[k][l]>64&&board[k][l]<91))){
if(m==65)
board[k][l]=’A’;
else
if(m==97)
board[k][l]=’a’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
} }
else
if(k==x-1&&l==y+2){
if((!(board[k][l]>64&&board[k][l]<91))){
if(m==65)
board[k][l]=’A’;
else
if(m==97)
board[k][l]=’a’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
} }
}
}
}
//——————————————————————————
void Fil(int k,int l,int x,int y,int m)
{
if((k>=0&&k<8)&&(l>=0&&l<8)){
if(m==70&&(!(board[k][l]>64&&board[k][l]<91))||(m==102&&(!(board[k][l]>96&&board[k][l]<123)))){
int counter=0;
if(k>x&&l>y){
for(int a=x+1;a<=k;a++){
for(int b=y;b<=l;b++)
if(k-a==l-b)
{
if((!(board[a][b]>65&&board[a][b]<91))&&(board[a][b]==’\xdb’||board[a][b]==’\xb0′))
counter++;
if(counter==0){
if(m==70)
board[k][l]=’F’;
else
if(m==102)
board[k][l]=’f’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
else
if(m==70)
board[k][l]=’F’;
else
if(m==102)
board[k][l]=’f’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
}
}
else
if(k>x&&l<y){
for(int a=x+1;a<=k;a++){
for(int b=l;b<=y;b++)
if(k-a==y-b)
{
if((!(board[a][b]>65&&board[a][b]<91))&&(board[a][b]==’\xdb’||board[a][b]==’\xb0′))
counter++;
if(counter==0){
if(m==70)
board[k][l]=’F’;
else
if(m==102)
board[k][l]=’f’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
else
if(m==70)
board[k][l]=’F’;
else
if(m==102)
board[k][l]=’f’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
}
}
else
if(k<x&&l<y){
for(int a=k;a<=x;a++){
for(int b=l+1;b<=y;b++)
if(x-a==y-b)
{
if((!(board[a][b]>64&&board[a][b]<91))&&(board[a][b]==’\xdb’||board[a][b]==’\xb0′))
counter++;
if(counter==0){
if(m==70)
board[k][l]=’F’;
else
if(m==102)
board[k][l]=’f’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
else
if(m==70)
board[k][l]=’F’;
else
if(m==102)
board[k][l]=’f’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
}
}
else
if(k<x&&l>y){
for(int a=k;a<=x;a++){
for(int b=y+1;b<=l;b++)
if(x-a==l-b)
{
if((!(board[a][b]>64&&board[a][b]<91))&&(board[a][b]==’\xdb’||board[a][b]==’\xb0′))
counter++;
if(counter==0){
if(m==70)
board[k][l]=’F’;
else
if(m==102)
board[k][l]=’f’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
else
if(m==70)
board[k][l]=’F’;
else
if(m==102)
board[k][l]=’f’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
}
}
} }
}
//——————————————————————————
void Vezir(int k,int l,int x,int y,int m)
{
bool bayrak=true;
int counter=0;
if((k>=0&&k<8)&&(l>=0&&l<8)){
if(m==86&&(!(board[k][l]>64&&board[k][l]<91))||(m==118&&(!(board[k][l]>96&&board[k][l]<123)))){
if(k>x&&l==y){
for(int a=x+1;a<=k;a++)
if(!(board[a][l]>96&&board[a][l]<123))
if(board[a][l]==’\xb0’||board[a][l]==’\xdb’)
counter++;
if(counter==k-x-1){
if(m==86)
board[k][l]=’V’;
else
if(m==118)
board[k][l]=’v’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
counter=0;
for(int a=x;a<k;a++)
if(board[a][l]==’\xb0’||board[a][l]==’\xdb’)
counter++;
if(counter==k-x-1){
if(m==86)
board[k][l]=’V’;
else
if(m==118)
board[k][l]=’v’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
}
else
if(k==x&&l>y){
for(int a=y+1;a<=l;a++)
if(!(board[k][a]>96&&board[k][a]<123))
if(board[k][a]==’\xb0’||board[k][a]==’\xdb’)
counter++;
if(counter==l-y){
if(m==86)
board[k][l]=’V’;
else
if(m==118)
board[k][l]=’v’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
counter=0;
for(int a=y+1;a<l;a++)
if(board[k][a]==’\xb0’||board[k][a]==’\xdb’)
counter++;
if(counter==l-y-1){
if(m==86)
board[k][l]=’V’;
else
if(m==118)
board[k][l]=’v’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
}
else
if(k==x&&l<y){
for(int a=l+1;a<y;a++)
if(!(board[k][a]>96&&board[k][a]<123))
if(board[k][a]==’\xb0’||board[k][a]==’\xdb’)
counter++;
if(counter==y-l-1){
if(m==86)
board[k][l]=’V’;
else
if(m==118)
board[k][l]=’v’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
counter=0;
for(int a=y+1;a<l;a++)
if(board[k][a]==’\xb0’||board[k][a]==’\xdb’)
counter++;
if(counter==y-l-1){
if(m==86)
board[k][l]=’V’;
else
if(m==118)
board[k][l]=’v’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
}
else
if(k<x&&l==y){
for(int a=k;a<x;a++)
if(!(board[a][l]>96&&board[a][l]<123))
if(board[a][l]==’\xb0’||board[a][l]==’\xdb’)
counter++;
if(counter==x-k){
if(m==86)
board[k][l]=’V’;
else
if(m==118)
board[k][l]=’v’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
counter=0;
for(int a=k;a<x;a++)
if(board[a][l]==’\xb0’||board[a][l]==’\xdb’)
counter++;
if(counter==x-k){
if(m==86)
board[k][l]=’V’;
else
if(m==118)
board[k][l]=’v’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
}
else
if(k>x&&l<y){
for(int a=x+1;a<=k;a++){
for(int b=l;b<=y;b++)
if(k-a==y-b)
{
if(board[a][b]==’\xdb’||board[a][b]==’\xb0′)
counter++;
if(counter==0){
if(m==86)
board[k][l]=’V’;
else
if(m==118)
board[k][l]=’v’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
else
if(m==86)
board[k][l]=’V’;
else
if(m==118)
board[k][l]=’v’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
}
}
if(k>x&&l>y){
for(int a=x+1;a<=k;a++){
for(int b=y;b<=l;b++)
if(k-a==l-b)
{
if(board[a][b]==’\xdb’||board[a][b]==’\xb0′)
counter++;
if(counter==0){
if(m==86)
board[k][l]=’V’;
else
if(m==118)
board[k][l]=’v’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
else
if(m==86)
board[k][l]=’V’;
else
if(m==118)
board[k][l]=’v’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
}
}
else
if(k<x&&l<y){
for(int a=k;a<=x;a++){
for(int b=l+1;b<=y;b++)
if(x-a==y-b)
{
if(board[a][b]==’\xdb’||board[a][b]==’\xb0′)
counter++;
if(counter==0){
if(m==86)
board[k][l]=’V’;
else
if(m==118)
board[k][l]=’v’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
else
if(m==86)
board[k][l]=’V’;
else
if(m==118)
board[k][l]=’v’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
}
}
else
if(k<x&&l>y){
for(int a=k;a<=x;a++){
for(int b=y+1;b<=l;b++)
if(x-a==l-b)
{
if(board[a][b]==’\xdb’||board[a][b]==’\xb0′)
counter++;
if(counter==0){
if(m==86)
board[k][l]=’V’;
else
if(m==118)
board[k][l]=’v’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
else
if(m==86)
board[k][l]=’V’;
else
if(m==118)
board[k][l]=’v’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
}
}
}
else{
if(m==86)
board[x][y]=’V’;
else
if(m==118)
board[x][y]=’v’;
}
}
}
//——————————————————————————
void Sah(int k,int l,int x,int y,int m)
{
if((k>=0&&k<8)&&(l>=0&&l<8)){
if(m==83&&(!(board[k][l]>64&&board[k][l]<91))||(m==115&&(!(board[k][l]>96&&board[k][l]<123)))){
if(k==x+1&&l==y){
if(m==83)
board[k][l]=’S’;
else
if(m==115)
board[k][l]=’s’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
else
if(k==x+1&&l==y-1){
if(m==83)
board[k][l]=’S’;
else
if(m==115)
board[k][l]=’s’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
else
if(k==x+1&&l==y+1){
if(m==83)
board[k][l]=’S’;
else
if(m==115)
board[k][l]=’s’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
else
if(k==x&&l==y-1){
if(m==83)
board[k][l]=’S’;
else
if(m==115)
board[k][l]=’s’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
else
if(k==x&&l==y+1){
if(m==83)
board[k][l]=’S’;
else
if(m==115)
board[k][l]=’s’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
else
if(k==x-1&&l==y){
if(m==83)
board[k][l]=’S’;
else
if(m==115)
board[k][l]=’s’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
else
if(k==x-1&&l==y+1){
if(m==83)
board[k][l]=’S’;
else
if(m==115)
board[k][l]=’s’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
else
if(k==x-1&&l==y-1){
if(m==83)
board[k][l]=’S’;
else
if(m==115)
board[k][l]=’s’;
if((x+y)%2==0)
board[x][y]=’\xdb’;
else
board[x][y]=’\xb0′;
}
}
}}
//——————————————————————————
MEHMET SALİH DEVECİ
YAZILIM MÜHENDİSİ
merhaba,
control fonksiyonunu niçin yazdığınızı bir türlü anlayamadım yardımcı olursanız sevinirim.
bu fonksiyondan anladığım kadarıyla sadece şahlar için kullanılıyor neyi kontrol ediyor peki?