I have to write a C program for players to play chess. I was able to project the chessboard on the screen but I'm having trouble moving the pieces. I just need a few movements for these pieces. I need help with this. I'm writing my own code here ; #include int main() { printf("Chess Board : "); printf("\n"); int i,j,k; char column_name[9] = {'A','B','C','D','E','F','G','H','\0'}; char chess[9] = {'R', 'K', 'B', 'Q', 'G', 'B', 'K', 'R', '\0'}; for(i=8; i>0; i--) { printf("%d ", i); for(j = 1; j<9; j++) { if(i==8) { printf("B%c ",chess[j-1]); } if(i==7) { printf("BP "); } if(i==2) { printf("WP "); } if (i==1) { printf("W%c ", chess[j-1]); } if(i==3||i==4||i==5||i==6) { printf(" 0 "); } } printf("\n"); } //here i will be 0 then write column names for (j=1; j<9; j++) { printf(" "); printf("%c", column_name[j-1]); } return 0; } Please help me with the code I need to include in this code.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

I have to write a C program for players to play chess. I was able to project the chessboard on the screen but I'm having trouble moving the pieces. I just need a few movements for these pieces. I need help with this. I'm writing my own code here ;

#include <stdio.h>

int main() {
printf("Chess Board : ");
printf("\n");
int i,j,k;
char column_name[9] = {'A','B','C','D','E','F','G','H','\0'};
char chess[9] = {'R', 'K', 'B', 'Q', 'G', 'B', 'K', 'R', '\0'};

for(i=8; i>0; i--)
{
printf("%d ", i);
for(j = 1; j<9; j++)
{
if(i==8)
{
printf("B%c ",chess[j-1]);
}
if(i==7)
{
printf("BP ");
}
if(i==2)
{
printf("WP ");
}
if (i==1)
{
printf("W%c ", chess[j-1]);
}
if(i==3||i==4||i==5||i==6)
{
printf(" 0 ");
}
}
printf("\n");
}
//here i will be 0 then write column names
for (j=1; j<9; j++)
{
printf(" ");
printf("%c", column_name[j-1]);
}
return 0;
}

Please help me with the code I need to include in this code.

 

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Similar questions
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY