C Programming Question The output of my code is the left image. How do I make my othello board look like the right picture I provided? Could you correrct my code please.   void initializeBoard(char board[ROW][COL]) {     int i, j;     for (i = 0; i < ROW; i++)      {          for (j = 0; i < COL; i++)          {              if ((i == 3 && j == 3) || (i == 4 && j == 4))                 board[i][j] = 'O';                 else if ((i == 4 && j == 3) || (i == 3 && j == 4))                 board[i][j] = 'X';                 else                 board[i][j] = SPACE;          }      } } // function displayBoard void displayBoard(char board[ROW][COL]) {     int i, j;     printf("|-----------------------------------------------------|\n");     printf("|     |  A  |  B  |  C  |  D  |  E  |  F  |  G  |  H  |\n");     printf("|-----------------------------------------------------|\n");       for (i = 0; i < ROW; i++)     {         printf("|  %d  |", i + 1);         for (j = 0; j < COL; j++)         {             printf("  %c  |", board[i][j]);         }         printf("\n|-----------------------------------------------------|\n");     }         printf("\n"); }

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

C Programming Question

The output of my code is the left image.

How do I make my othello board look like the right picture I provided? Could you correrct my code please.

 

void initializeBoard(char board[ROW][COL])
{
    int i, j;

    for (i = 0; i < ROW; i++)
     {

         for (j = 0; i < COL; i++)
         {
             if ((i == 3 && j == 3) || (i == 4 && j == 4))
                board[i][j] = 'O';

                else if ((i == 4 && j == 3) || (i == 3 && j == 4))
                board[i][j] = 'X';

                else
                board[i][j] = SPACE;
         }
     }

}


// function displayBoard
void displayBoard(char board[ROW][COL])
{

    int i, j;

    printf("|-----------------------------------------------------|\n");
    printf("|     |  A  |  B  |  C  |  D  |  E  |  F  |  G  |  H  |\n");
    printf("|-----------------------------------------------------|\n");

 

    for (i = 0; i < ROW; i++)
    {
        printf("|  %d  |", i + 1);
        for (j = 0; j < COL; j++)
        {
            printf("  %c  |", board[i][j]);
        }
        printf("\n|-----------------------------------------------------|\n");
    }
        printf("\n");
}

2
5
|A|B |
|
|
|
6 I
8 |
| ↑
|
с
D |
|
| º | :
| a
| @
|
F
|
|
k |
|
E
|
F
| G |
|
| |
|
|
H
| A | B | C | D | E | F | G | H
1 |
2
3 |
4 |
5 |
6 |
7 |
8 |
|
|
|
|
|
|
| 0 | X
| X | 0 |
|
|
|
|
|
|
|
|
|
|
|
|
Transcribed Image Text:2 5 |A|B | | | | 6 I 8 | | ↑ | с D | | | º | : | a | @ | F | | k | | E | F | G | | | | | | H | A | B | C | D | E | F | G | H 1 | 2 3 | 4 | 5 | 6 | 7 | 8 | | | | | | | | 0 | X | X | 0 | | | | | | | | | | | | |
void displayExplicitBoard ()
31
}
printf("
printf(" |
printf("
printf(" | 1 I
printf("|-
printf(" 21
printf("
printf("
I
printf("
printf(" 4 |
printf("
printf(" | 5 I
printf("
printf(" | 6 1
printf("|-
printf(" 71
printf("
|A|B|C| D | E | F | G |
H
I
printf(" 8 I
printf("
I
I
I
I
I
I
1
I
I
I
|
I
I
I
I
I
|0|X |
I
| X | OI
|
I
|
I
I
-|\n");
|\n");
-- | \n");
|\n");
-|\n");
|\n");
-|\n");
I
|\n");
-|\n");
|\n");
-|\n");
|\n");
-|\n");
|\n");
-|\n");
|\n");
-|\n");
|\n");
-|\n");
Transcribed Image Text:void displayExplicitBoard () 31 } printf(" printf(" | printf(" printf(" | 1 I printf("|- printf(" 21 printf(" printf(" I printf(" printf(" 4 | printf(" printf(" | 5 I printf(" printf(" | 6 1 printf("|- printf(" 71 printf(" |A|B|C| D | E | F | G | H I printf(" 8 I printf(" I I I I I I 1 I I I | I I I I I |0|X | I | X | OI | I | I I -|\n"); |\n"); -- | \n"); |\n"); -|\n"); |\n"); -|\n"); I |\n"); -|\n"); |\n"); -|\n"); |\n"); -|\n"); |\n"); -|\n"); |\n"); -|\n"); |\n"); -|\n");
Expert Solution
Step 1

Please refer below for your reference:

Language used is C:

I have added comments at required position:

void initializeBoard(char board[ROW][COL])

{

    int i, j;

 

    for (i = 0; i < ROW; i++)

     {

 

         for (j = 0; i < COL; i++)

         {// Here the position should be 4*4 and 5*5

             if ((i == 4&& j == 4) || (i == 5&& j == 5))

                board[i][j] = 'O';

//Here it should be 4*5 and 5*4

                else if ((i == 4 && j == 5) || (i == 5 && j == 4))

                board[i][j] = 'X';

 

                else

                board[i][j] = SPACE;

         }

     }

 

}

steps

Step by step

Solved in 2 steps

Blurred answer
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