Question
I have to make a c program using turtle graphics. Basically how it works is I have a 24x24 board, using a multidimensional array, and
I have to make a c program using turtle graphics. Basically how it works is I have a 24x24 board, using a multidimensional array, and I have to print out the movement of the turtle using these directions inputed by the user:
1: pen up
2:pen down
3.turn right 90 degrees
4.turn left 90 degrees
5 x. move foward x spaces
6.output the board
9. end data.
Ive managed to print out the board but I can not get the turtle path printed out. I have looked at it for days but have come to no avail. I really need the help.I apologize ahead of time for all the board functions. Here is my code:
#include
#include
/*Proj #6*/
void penUp(char board[][55],int row,int col){
board[row][col]=' ';
return;
}
void penDown(char board[][55],int row,int col){
board[row][col]='*';
return;
}
char moveTurtleFoward(char board[][55],int y,int row, int col,int pen){
scanf("%d",&y);
y = y*2;
col = col+y;
if(pen==1){
penUp(board,row,col);
board[row][col]=' ';
}
if(pen==2){
penDown(board,row,col);
board[row][col]='*';
}
return board[row][col];
}
char moveTurtleDown(char board[][55],int y,int row, int col,int pen){
scanf("%d",&y);
y = y*2;
row = row+y;
if(pen==1){
penUp(board,row,col);
}
if(pen==2){
penDown(board,row,col);
}
return board[row][col];
}
char moveTurtleBackward(char board[][55],int y,int row, int col, int pen){
scanf("%d",&y);
y = y*2;
col = col-y;
if(pen==1){
penUp(board,row,col);
}
if(pen==2){
penDown(board,row,col);
}
return board[row][col];
}
char moveTurtleUp(char board[][55],int y, int row, int col,int pen){
scanf("%d",&y);
y = y*2;
row = row-y;
if(pen==1){
penUp(board,row,col);
}
if(pen==2){
penDown(board,row,col);
}
return board[row][col];
}
int turnRight(int degrees){
degrees++;
return degrees;
}
int turnLeft(int degrees){
degrees--;
return degrees;
}
void outputBoard(char board[][56],int row,int col,int i,int j){
for(i=0;i<31;i++){
for(j=0;j<55;j++){
printf("%c",board[i][j]);
}
printf(" ");
}
}
int main(void){
int row=31;
int col=56;
char board[row][col];
char currentLocation;
int x=0;
int i,y,j,ch,pen,degrees;
printf("Proj. #6 - C. ");
board[0][0]=' ';board[0][1]=' ';board[0][2]=' ';board[0][3]=' ';board[0][4]=' ';board[0][5]=' ';board[0][6]=' ';board[0][7]=' ';board[0][8]=' ';board[0][9]=' ';board[0][10]=' ';board[0][11]=' ';board[0][12]=' ';board[0][13]=' ';board[0][14]=' ';board[0][15]=' ';board[0][16]=' ';board[0][17]=' ';board[0][18]=' ';board[0][19]=' ';board[0][20]=' ';board[0][21]=' ';board[0][22]=' ';board[0][23]='1';board[0][24]=' ';board[0][25]=' ';board[0][26]=' ';board[0][27]=' ';board[0][28]=' ';board[0][29]=' ';board[0][30]=' ';board[0][31]=' ';board[0][32]=' ';board[0][33]=' ';board[0][34]=' ';board[0][35]=' ';board[0][36]=' ';board[0][37]=' ';board[0][38]=' ';board[0][39]=' ';board[0][40]=' ';board[0][41]=' ';board[0][42]=' ';board[0][43]='2';board[0][44]=' ';board[0][45]=' ';board[0][46]=' ';board[0][47]=' ';board[0][48]=' ';board[0][49]=' ';board[0][50]=' ';board[0][51]=' ';board[0][52]=' ';board[0][53]=' ';board[0][54]=' ';board[0][55]=' ';
board[1][0]=' '; board[1][1]=' '; board[1][2]=' '; board[1][3]='0';board[1][4]=' '; board[1][5]='1'; board[1][6]=' '; board[1][7]='2'; board[1][8]=' '; board[1][9]='3';board[1][10]=' ';board[1][11]='4';board[1][12]=' ';board[1][13]='5';board[1][14]=' ';board[1][15]='6';board[1][16]=' ';board[1][17]='7';board[1][18]=' ';board[1][19]='8';board[1][20]=' ';board[1][21]='9';board[1][22]=' ';board[1][23]='0';board[1][24]=' ';board[1][25]='1';board[1][26]=' ';board[1][27]='2';board[1][28]=' ';board[1][29]='3';board[1][30]=' ';board[1][31]='4';board[1][32]=' ';board[1][33]='5';board[1][34]=' ';board[1][35]='6';board[1][36]=' ';board[1][37]='7';board[1][38]=' ';board[1][39]='8';board[1][40]=' ';board[1][41]='9';board[1][42]=' ';board[1][43]='0';board[1][44]=' ';board[1][45]='1';board[1][46]=' ';board[1][47]='2';board[1][48]=' ';board[1][49]='3';board[1][50]=' ';board[1][51]='4';board[1][52]=' ';board[1][53]=' ';board[1][54]=' ';board[1][55]=' ';
board[2][0]=' ';board[2][1]=' ';board[2][2]='+';board[2][3]='-';board[2][4]='-';board[2][5]='-';board[2][6]='-';board[2][7]='-';board[2][8]='-';board[2][9]='-';board[2][10]='-';board[2][11]='-';board[2][12]='-';board[2][13]='-';board[2][14]='-';board[2][15]='-';board[2][16]='-';board[2][17]='-';board[2][18]='-';board[2][19]='-';board[2][20]='-';board[2][21]='-';board[2][22]='-';board[2][23]='-';board[2][24]='-';board[2][25]='-';board[2][26]='-';board[2][27]='-';board[2][28]='-';board[2][29]='-';board[2][30]='-';board[2][31]='-';board[2][32]='-';board[2][33]='-';board[2][34]='-';board[2][35]='-';board[2][36]='-';board[2][37]='-';board[2][38]='-';board[2][39]='-';board[2][40]='-';board[2][41]='-';board[2][42]='-';board[2][43]='-';board[2][44]='-';board[2][45]='-';board[2][46]='-';board[2][47]='-';board[2][48]='-';board[2][49]='-';board[2][50]='-';board[2][51]='-';board[2][52]='+';board[2][53]=' ';board[2][54]=' ';board[2][55]=' ';
board[3][0]=' ';board[3][1]='0';board[3][2]='|';board[3][3]=' ';board[3][4]=' ';board[3][5]=' ';board[3][6]=' ';board[3][7]=' ';board[3][8]=' ';board[3][9]=' ';board[3][10]=' ';board[3][11]=' ';board[3][12]=' ';board[3][13]=' ';board[3][14]=' ';board[3][15]=' ';board[3][16]=' ';board[3][17]=' ';board[3][18]=' ';board[3][19]=' ';board[3][20]=' ';board[3][21]=' ';board[3][22]=' ';board[3][23]=' ';board[3][24]=' ';board[3][25]=' ';board[3][26]=' ';board[3][27]=' ';board[3][28]=' ';board[3][29]=' ';board[3][30]=' ';board[3][31]=' ';board[3][32]=' ';board[3][33]=' ';board[3][34]=' ';board[3][35]=' ';board[3][36]=' ';board[3][37]=' ';board[3][38]=' ';board[3][39]=' ';board[3][40]=' ';board[3][41]=' ';board[3][42]=' ';board[3][43]=' ';board[3][44]=' ';board[3][45]=' ';board[3][46]=' ';board[3][47]=' ';board[3][48]=' ';board[3][49]=' ';board[3][50]=' ';board[3][51]=' ';board[3][52]='|';board[3][53]='0';board[3][54]=' ';board[3][55]=' ';
board[4][0]=' ';board[4][1]='1';board[4][2]='|';board[4][3]=' ';board[4][4]=' ';board[4][5]=' ';board[4][6]=' ';board[4][7]=' ';board[4][8]=' ';board[4][9]=' ';board[4][10]=' ';board[4][11]=' ';board[4][12]=' ';board[4][13]=' ';board[4][14]=' ';board[4][15]=' ';board[4][16]=' ';board[4][17]=' ';board[4][18]=' ';board[4][19]=' ';board[4][20]=' ';board[4][21]=' ';board[4][22]=' ';board[4][23]=' ';board[4][24]=' ';board[4][25]=' ';board[4][26]=' ';board[4][27]=' ';board[4][28]=' ';board[4][29]=' ';board[4][30]=' ';board[4][31]=' ';board[4][32]=' ';board[4][33]=' ';board[4][34]=' ';board[4][35]=' ';board[4][36]=' ';board[4][37]=' ';board[4][38]=' ';board[4][39]=' ';board[4][40]=' ';board[4][41]=' ';board[4][42]=' ';board[4][43]=' ';board[4][44]=' ';board[4][45]=' ';board[4][46]=' ';board[4][47]=' ';board[4][48]=' ';board[4][49]=' ';board[4][50]=' ';board[4][51]=' ';board[4][52]='|';board[4][53]='1';board[4][54]=' ';board[4][55]=' ';
board[5][0]=' ';board[5][1]='2';board[5][2]='|';board[5][3]=' ';board[5][4]=' ';board[5][5]=' ';board[5][6]=' ';board[5][7]=' ';board[5][8]=' ';board[5][9]=' ';board[5][10]=' ';board[5][11]=' ';board[5][12]=' ';board[5][13]=' ';board[5][14]=' ';board[5][15]=' ';board[5][16]=' ';board[5][17]=' ';board[5][18]=' ';board[5][19]=' ';board[5][20]=' ';board[5][21]=' ';board[5][22]=' ';board[5][23]=' ';board[5][24]=' ';board[5][25]=' ';board[5][26]=' ';board[5][27]=' ';board[5][28]=' ';board[5][29]=' ';board[5][30]=' ';board[5][31]=' ';board[5][32]=' ';board[5][33]=' ';board[5][34]=' ';board[5][35]=' ';board[5][36]=' ';board[5][37]=' ';board[5][38]=' ';board[5][39]=' ';board[5][40]=' ';board[5][41]=' ';board[5][42]=' ';board[5][43]=' ';board[5][44]=' ';board[5][45]=' ';board[5][46]=' ';board[5][47]=' ';board[5][48]=' ';board[5][49]=' ';board[5][50]=' ';board[5][51]=' ';board[5][52]='|';board[5][53]='2';board[5][54]=' ';board[5][55]=' ';
board[6][0]=' ';board[6][1]='3';board[6][2]='|';board[6][3]=' ';board[6][4]=' ';board[6][5]=' ';board[6][6]=' ';board[6][7]=' ';board[6][8]=' ';board[6][9]=' ';board[6][10]=' ';board[6][11]=' ';board[6][12]=' ';board[6][13]=' ';board[6][14]=' ';board[6][15]=' ';board[6][16]=' ';board[6][17]=' ';board[6][18]=' ';board[6][19]=' ';board[6][20]=' ';board[6][21]=' ';board[6][22]=' ';board[6][23]=' ';board[6][24]=' ';board[6][25]=' ';board[6][26]=' ';board[6][27]=' ';board[6][28]=' ';board[6][29]=' ';board[6][30]=' ';board[6][31]=' ';board[6][32]=' ';board[6][33]=' ';board[6][34]=' ';board[6][35]=' ';board[6][36]=' ';board[6][37]=' ';board[6][38]=' ';board[6][39]=' ';board[6][40]=' ';board[6][41]=' ';board[6][42]=' ';board[6][43]=' ';board[6][44]=' ';board[6][45]=' ';board[6][46]=' ';board[6][47]=' ';board[6][48]=' ';board[6][49]=' ';board[6][50]=' ';board[6][51]=' ';board[6][52]='|';board[6][53]='3';board[6][54]=' ';board[6][55]=' ';
board[7][0]=' ';board[7][1]='4';board[7][2]='|';board[7][3]=' ';board[7][4]=' ';board[7][5]=' ';board[7][6]=' ';board[7][7]=' ';board[7][8]=' ';board[7][9]=' ';board[7][10]=' ';board[7][11]=' ';board[7][12]=' ';board[7][13]=' ';board[7][14]=' ';board[7][15]=' ';board[7][16]=' ';board[7][17]=' ';board[7][18]=' ';board[7][19]=' ';board[7][20]=' ';board[7][21]=' ';board[7][22]=' ';board[7][23]=' ';board[7][24]=' ';board[7][25]=' ';board[7][26]=' ';board[7][27]=' ';board[7][28]=' ';board[7][29]=' ';board[7][30]=' ';board[7][31]=' ';board[7][32]=' ';board[7][33]=' ';board[7][34]=' ';board[7][35]=' ';board[7][36]=' ';board[7][37]=' ';board[7][38]=' ';board[7][39]=' ';board[7][40]=' ';board[7][41]=' ';board[7][42]=' ';board[7][43]=' ';board[7][44]=' ';board[7][45]=' ';board[7][46]=' ';board[7][47]=' ';board[7][48]=' ';board[7][49]=' ';board[7][50]=' ';board[7][51]=' ';board[7][52]='|';board[7][53]='4';board[7][54]=' ';board[7][55]=' ';
board[8][0]=' ';board[8][1]='5';board[8][2]='|';board[8][3]=' ';board[8][4]=' ';board[8][5]=' ';board[8][6]=' ';board[8][7]=' ';board[8][8]=' ';board[8][9]=' ';board[8][10]=' ';board[8][11]=' ';board[8][12]=' ';board[8][13]=' ';board[8][14]=' ';board[8][15]=' ';board[8][16]=' ';board[8][17]=' ';board[8][18]=' ';board[8][19]=' ';board[8][20]=' ';board[8][21]=' ';board[8][22]=' ';board[8][23]=' ';board[8][24]=' ';board[8][25]=' ';board[8][26]=' ';board[8][27]=' ';board[8][28]=' ';board[8][29]=' ';board[8][30]=' ';board[8][31]=' ';board[8][32]=' ';board[8][33]=' ';board[8][34]=' ';board[8][35]=' ';board[8][36]=' ';board[8][37]=' ';board[8][38]=' ';board[8][39]=' ';board[8][40]=' ';board[8][41]=' ';board[8][42]=' ';board[8][43]=' ';board[8][44]=' ';board[8][45]=' ';board[8][46]=' ';board[8][47]=' ';board[8][48]=' ';board[8][49]=' ';board[8][50]=' ';board[8][51]=' ';board[8][52]='|';board[8][53]='5';board[8][54]=' ';board[8][55]=' ';
board[9][0]=' ';board[9][1]='6';board[9][2]='|';board[9][3]=' ';board[9][4]=' ';board[9][5]=' ';board[9][6]=' ';board[9][7]=' ';board[9][8]=' ';board[9][9]=' ';board[9][10]=' ';board[9][11]=' ';board[9][12]=' ';board[9][13]=' ';board[9][14]=' ';board[9][15]=' ';board[9][16]=' ';board[9][17]=' ';board[9][18]=' ';board[9][19]=' ';board[9][20]=' ';board[9][21]=' ';board[9][22]=' ';board[9][23]=' ';board[9][24]=' ';board[9][25]=' ';board[9][26]=' ';board[9][27]=' ';board[9][28]=' ';board[9][29]=' ';board[9][30]=' ';board[9][31]=' ';board[9][32]=' ';board[9][33]=' ';board[9][34]=' ';board[9][35]=' ';board[9][36]=' ';board[9][37]=' ';board[9][38]=' ';board[9][39]=' ';board[9][40]=' ';board[9][41]=' ';board[9][42]=' ';board[9][43]=' ';board[9][44]=' ';board[9][45]=' ';board[9][46]=' ';board[9][47]=' ';board[9][48]=' ';board[9][49]=' ';board[9][50]=' ';board[9][51]=' ';board[9][52]='|';board[9][53]='6';board[9][54]=' ';board[9][55]=' ';
board[10][0]=' ';board[10][1]='7';board[10][2]='|';board[10][3]=' ';board[10][4]=' ';board[10][5]=' ';board[10][6]=' ';board[10][7]=' ';board[10][8]=' ';board[10][9]=' ';board[10][10]=' ';board[10][11]=' ';board[10][12]=' ';board[10][13]=' ';board[10][14]=' ';board[10][15]=' ';board[10][16]=' ';board[10][17]=' ';board[10][18]=' ';board[10][19]=' ';board[10][20]=' ';board[10][21]=' ';board[10][22]=' ';board[10][23]=' ';board[10][24]=' ';board[10][25]=' ';board[10][26]=' ';board[10][27]=' ';board[10][28]=' ';board[10][29]=' ';board[10][30]=' ';board[10][31]=' ';board[10][32]=' ';board[10][33]=' ';board[10][34]=' ';board[10][35]=' ';board[10][36]=' ';board[10][37]=' ';board[10][38]=' ';board[10][39]=' ';board[10][40]=' ';board[10][41]=' ';board[10][42]=' ';board[10][43]=' ';board[10][44]=' ';board[10][45]=' ';board[10][46]=' ';board[10][47]=' ';board[10][48]=' ';board[10][49]=' ';board[10][50]=' ';board[10][51]=' ';board[10][52]='|';board[10][53]='7';board[10][54]=' ';board[10][55]=' ';
board[11][0]=' ';board[11][1]='8';board[11][2]='|';board[11][3]=' ';board[11][4]=' ';board[11][5]=' ';board[11][6]=' ';board[11][7]=' ';board[11][8]=' ';board[11][9]=' ';board[11][10]=' ';board[11][11]=' ';board[11][12]=' ';board[11][13]=' ';board[11][14]=' ';board[11][15]=' ';board[11][16]=' ';board[11][17]=' ';board[11][18]=' ';board[11][19]=' ';board[11][20]=' ';board[11][21]=' ';board[11][22]=' ';board[11][23]=' ';board[11][24]=' ';board[11][25]=' ';board[11][26]=' ';board[11][27]=' ';board[11][28]=' ';board[11][29]=' ';board[11][30]=' ';board[11][31]=' ';board[11][32]=' ';board[11][33]=' ';board[11][34]=' ';board[11][35]=' ';board[11][36]=' ';board[11][37]=' ';board[11][38]=' ';board[11][39]=' ';board[11][40]=' ';board[11][41]=' ';board[11][42]=' ';board[11][43]=' ';board[11][44]=' ';board[11][45]=' ';board[11][46]=' ';board[11][47]=' ';board[11][48]=' ';board[11][49]=' ';board[11][50]=' ';board[11][51]=' ';board[11][52]='|';board[11][53]='8';board[11][54]=' ';board[11][55]=' ';
board[12][0]=' ';board[12][1]='9';board[12][2]='|';board[12][3]=' ';board[12][4]=' ';board[12][5]=' ';board[12][6]=' ';board[12][7]=' ';board[12][8]=' ';board[12][9]=' ';board[12][10]=' ';board[12][11]=' ';board[12][12]=' ';board[12][13]=' ';board[12][14]=' ';board[12][15]=' ';board[12][16]=' ';board[12][17]=' ';board[12][18]=' ';board[12][19]=' ';board[12][20]=' ';board[12][21]=' ';board[12][22]=' ';board[12][23]=' ';board[12][24]=' ';board[12][25]=' ';board[12][26]=' ';board[12][27]=' ';board[12][28]=' ';board[12][29]=' ';board[12][30]=' ';board[12][31]=' ';board[12][32]=' ';board[12][33]=' ';board[12][34]=' ';board[12][35]=' ';board[12][36]=' ';board[12][37]=' ';board[12][38]=' ';board[12][39]=' ';board[12][40]=' ';board[12][41]=' ';board[12][42]=' ';board[12][43]=' ';board[12][44]=' ';board[12][45]=' ';board[12][46]=' ';board[12][47]=' ';board[12][48]=' ';board[12][49]=' ';board[12][50]=' ';board[12][51]=' ';board[12][52]='|';board[12][53]='9';board[12][54]=' ';board[12][55]=' ';
board[13][0]='1';board[13][1]='0';board[13][2]='|';board[13][3]=' ';board[13][4]=' ';board[13][5]=' ';board[13][6]=' ';board[13][7]=' ';board[13][8]=' ';board[13][9]=' ';board[13][10]=' ';board[13][11]=' ';board[13][12]=' ';board[13][13]=' ';board[13][14]=' ';board[13][15]=' ';board[13][16]=' ';board[13][17]=' ';board[13][18]=' ';board[13][19]=' ';board[13][20]=' ';board[13][21]=' ';board[13][22]=' ';board[13][23]=' ';board[13][24]=' ';board[13][25]=' ';board[13][26]=' ';board[13][27]=' ';board[13][28]=' ';board[13][29]=' ';board[13][30]=' ';board[13][31]=' ';board[13][32]=' ';board[13][33]=' ';board[13][34]=' ';board[13][35]=' ';board[13][36]=' ';board[13][37]=' ';board[13][38]=' ';board[13][39]=' ';board[13][40]=' ';board[13][41]=' ';board[13][42]=' ';board[13][43]=' ';board[13][44]=' ';board[13][45]=' ';board[13][46]=' ';board[13][47]=' ';board[13][48]=' ';board[13][49]=' ';board[13][50]=' ';board[13][51]=' ';board[13][52]='|';board[13][53]='1';board[13][54]='0';board[13][55]=' ';
board[14][0]='1';board[14][1]='1';board[14][2]='|';board[14][3]=' ';board[14][4]=' ';board[14][5]=' ';board[14][6]=' ';board[14][7]=' ';board[14][8]=' ';board[14][9]=' ';board[14][10]=' ';board[14][11]=' ';board[14][12]=' ';board[14][13]=' ';board[14][14]=' ';board[14][15]=' ';board[14][16]=' ';board[14][17]=' ';board[14][18]=' ';board[14][19]=' ';board[14][20]=' ';board[14][21]=' ';board[14][22]=' ';board[14][23]=' ';board[14][24]=' ';board[14][25]=' ';board[14][26]=' ';board[14][27]=' ';board[14][28]=' ';board[14][29]=' ';board[14][30]=' ';board[14][31]=' ';board[14][32]=' ';board[14][33]=' ';board[14][34]=' ';board[14][35]=' ';board[14][36]=' ';board[14][37]=' ';board[14][38]=' ';board[14][39]=' ';board[14][40]=' ';board[14][41]=' ';board[14][42]=' ';board[14][43]=' ';board[14][44]=' ';board[14][45]=' ';board[14][46]=' ';board[14][47]=' ';board[14][48]=' ';board[14][49]=' ';board[14][50]=' ';board[14][51]=' ';board[14][52]='|';board[14][53]='1';board[14][54]='1';board[14][55]=' ';
board[15][0]='1';board[15][1]='2';board[15][2]='|';board[15][3]=' ';board[15][4]=' ';board[15][5]=' ';board[15][6]=' ';board[15][7]=' ';board[15][8]=' ';board[15][9]=' ';board[15][10]=' ';board[15][11]=' ';board[15][12]=' ';board[15][13]=' ';board[15][14]=' ';board[15][15]=' ';board[15][16]=' ';board[15][17]=' ';board[15][18]=' ';board[15][19]=' ';board[15][20]=' ';board[15][21]=' ';board[15][22]=' ';board[15][23]=' ';board[15][24]=' ';board[15][25]=' ';board[15][26]=' ';board[15][27]=' ';board[15][28]=' ';board[15][29]=' ';board[15][30]=' ';board[15][31]=' ';board[15][32]=' ';board[15][33]=' ';board[15][34]=' ';board[15][35]=' ';board[15][36]=' ';board[15][37]=' ';board[15][38]=' ';board[15][39]=' ';board[15][40]=' ';board[15][41]=' ';board[15][42]=' ';board[15][43]=' ';board[15][44]=' ';board[15][45]=' ';board[15][46]=' ';board[15][47]=' ';board[15][48]=' ';board[15][49]=' ';board[15][50]=' ';board[15][51]=' ';board[15][52]='|';board[15][53]='1';board[15][54]='2';board[15][55]=' ';
board[16][0]='1';board[16][1]='3';board[16][2]='|';board[16][3]=' ';board[16][4]=' ';board[16][5]=' ';board[16][6]=' ';board[16][7]=' ';board[16][8]=' ';board[16][9]=' ';board[16][10]=' ';board[16][11]=' ';board[16][12]=' ';board[16][13]=' ';board[16][14]=' ';board[16][15]=' ';board[16][16]=' ';board[16][17]=' ';board[16][18]=' ';board[16][19]=' ';board[16][20]=' ';board[16][21]=' ';board[16][22]=' ';board[16][23]=' ';board[16][24]=' ';board[16][25]=' ';board[16][26]=' ';board[16][27]=' ';board[16][28]=' ';board[16][29]=' ';board[16][30]=' ';board[16][31]=' ';board[16][32]=' ';board[16][33]=' ';board[16][34]=' ';board[16][35]=' ';board[16][36]=' ';board[16][37]=' ';board[16][38]=' ';board[16][39]=' ';board[16][40]=' ';board[16][41]=' ';board[16][42]=' ';board[16][43]=' ';board[16][44]=' ';board[16][45]=' ';board[16][46]=' ';board[16][47]=' ';board[16][48]=' ';board[16][49]=' ';board[16][50]=' ';board[16][51]=' ';board[16][52]='|';board[16][53]='1';board[16][54]='3';board[16][55]=' ';
board[17][0]='1';board[17][1]='4';board[17][2]='|';board[17][3]=' ';board[17][4]=' ';board[17][5]=' ';board[17][6]=' ';board[17][7]=' ';board[17][8]=' ';board[17][9]=' ';board[17][10]=' ';board[17][11]=' ';board[17][12]=' ';board[17][13]=' ';board[17][14]=' ';board[17][15]=' ';board[17][16]=' ';board[17][17]=' ';board[17][18]=' ';board[17][19]=' ';board[17][20]=' ';board[17][21]=' ';board[17][22]=' ';board[17][23]=' ';board[17][24]=' ';board[17][25]=' ';board[17][26]=' ';board[17][27]=' ';board[17][28]=' ';board[17][29]=' ';board[17][30]=' ';board[17][31]=' ';board[17][32]=' ';board[17][33]=' ';board[17][34]=' ';board[17][35]=' ';board[17][36]=' ';board[17][37]=' ';board[17][38]=' ';board[17][39]=' ';board[17][40]=' ';board[17][41]=' ';board[17][42]=' ';board[17][43]=' ';board[17][44]=' ';board[17][45]=' ';board[17][46]=' ';board[17][47]=' ';board[17][48]=' ';board[17][49]=' ';board[17][50]=' ';board[17][51]=' ';board[17][52]='|';board[17][53]='1';board[17][54]='4';board[17][55]=' ';
board[18][0]='1';board[18][1]='5';board[18][2]='|';board[18][3]=' ';board[18][4]=' ';board[18][5]=' ';board[18][6]=' ';board[18][7]=' ';board[18][8]=' ';board[18][9]=' ';board[18][10]=' ';board[18][11]=' ';board[18][12]=' ';board[18][13]=' ';board[18][14]=' ';board[18][15]=' ';board[18][16]=' ';board[18][17]=' ';board[18][18]=' ';board[18][19]=' ';board[18][20]=' ';board[18][21]=' ';board[18][22]=' ';board[18][23]=' ';board[18][24]=' ';board[18][25]=' ';board[18][26]=' ';board[18][27]=' ';board[18][28]=' ';board[18][29]=' ';board[18][30]=' ';board[18][31]=' ';board[18][32]=' ';board[18][33]=' ';board[18][34]=' ';board[18][35]=' ';board[18][36]=' ';board[18][37]=' ';board[18][38]=' ';board[18][39]=' ';board[18][40]=' ';board[18][41]=' ';board[18][42]=' ';board[18][43]=' ';board[18][44]=' ';board[18][45]=' ';board[18][46]=' ';board[18][47]=' ';board[18][48]=' ';board[18][49]=' ';board[18][50]=' ';board[18][51]=' ';board[18][52]='|';board[18][53]='1';board[18][54]='5';board[18][55]=' ';
board[19][0]='1';board[19][1]='6';board[19][2]='|';board[19][3]=' ';board[19][4]=' ';board[19][5]=' ';board[19][6]=' ';board[19][7]=' ';board[19][8]=' ';board[19][9]=' ';board[19][10]=' ';board[19][11]=' ';board[19][12]=' ';board[19][13]=' ';board[19][14]=' ';board[19][15]=' ';board[19][16]=' ';board[19][17]=' ';board[19][18]=' ';board[19][19]=' ';board[19][20]=' ';board[19][21]=' ';board[19][22]=' ';board[19][23]=' ';board[19][24]=' ';board[19][25]=' ';board[19][26]=' ';board[19][27]=' ';board[19][28]=' ';board[19][29]=' ';board[19][30]=' ';board[19][31]=' ';board[19][32]=' ';board[19][33]=' ';board[19][34]=' ';board[19][35]=' ';board[19][36]=' ';board[19][37]=' ';board[19][38]=' ';board[19][39]=' ';board[19][40]=' ';board[19][41]=' ';board[19][42]=' ';board[19][43]=' ';board[19][44]=' ';board[19][45]=' ';board[19][46]=' ';board[19][47]=' ';board[19][48]=' ';board[19][49]=' ';board[19][50]=' ';board[19][51]=' ';board[19][52]='|';board[19][53]='1';board[19][54]='6';board[19][55]=' ';
board[20][0]='1';board[20][1]='7';board[20][2]='|';board[20][3]=' ';board[20][4]=' ';board[20][5]=' ';board[20][6]=' ';board[20][7]=' ';board[20][8]=' ';board[20][9]=' ';board[20][10]=' ';board[20][11]=' ';board[20][12]=' ';board[20][13]=' ';board[20][14]=' ';board[20][15]=' ';board[20][16]=' ';board[20][17]=' ';board[20][18]=' ';board[20][19]=' ';board[20][20]=' ';board[20][21]=' ';board[20][22]=' ';board[20][23]=' ';board[20][24]=' ';board[20][25]=' ';board[20][26]=' ';board[20][27]=' ';board[20][28]=' ';board[20][29]=' ';board[20][30]=' ';board[20][31]=' ';board[20][32]=' ';board[20][33]=' ';board[20][34]=' ';board[20][35]=' ';board[20][36]=' ';board[20][37]=' ';board[20][38]=' ';board[20][39]=' ';board[20][40]=' ';board[20][41]=' ';board[20][42]=' ';board[20][43]=' ';board[20][44]=' ';board[20][45]=' ';board[20][46]=' ';board[20][47]=' ';board[20][48]=' ';board[20][49]=' ';board[20][50]=' ';board[20][51]=' ';board[20][52]='|';board[20][53]='1';board[20][54]='7';board[20][55]=' ';
board[21][0]='1';board[21][1]='8';board[21][2]='|';board[21][3]=' ';board[21][4]=' ';board[21][5]=' ';board[21][6]=' ';board[21][7]=' ';board[21][8]=' ';board[21][9]=' ';board[21][10]=' ';board[21][11]=' ';board[21][12]=' ';board[21][13]=' ';board[21][14]=' ';board[21][15]=' ';board[21][16]=' ';board[21][17]=' ';board[21][18]=' ';board[21][19]=' ';board[21][20]=' ';board[21][21]=' ';board[21][22]=' ';board[21][23]=' ';board[21][24]=' ';board[21][25]=' ';board[21][26]=' ';board[21][27]=' ';board[21][28]=' ';board[21][29]=' ';board[21][30]=' ';board[21][31]=' ';board[21][32]=' ';board[21][33]=' ';board[21][34]=' ';board[21][35]=' ';board[21][36]=' ';board[21][37]=' ';board[21][38]=' ';board[21][39]=' ';board[21][40]=' ';board[21][41]=' ';board[21][42]=' ';board[21][43]=' ';board[21][44]=' ';board[21][45]=' ';board[21][46]=' ';board[21][47]=' ';board[21][48]=' ';board[21][49]=' ';board[21][50]=' ';board[21][51]=' ';board[21][52]='|';board[21][53]='1';board[21][54]='8';board[21][55]=' ';
board[22][0]='1';board[22][1]='9';board[22][2]='|';board[22][3]=' ';board[22][4]=' ';board[22][5]=' ';board[22][6]=' ';board[22][7]=' ';board[22][8]=' ';board[22][9]=' ';board[22][10]=' ';board[22][11]=' ';board[22][12]=' ';board[22][13]=' ';board[22][14]=' ';board[22][15]=' ';board[22][16]=' ';board[22][17]=' ';board[22][18]=' ';board[22][19]=' ';board[22][20]=' ';board[22][21]=' ';board[22][22]=' ';board[22][23]=' ';board[22][24]=' ';board[22][25]=' ';board[22][26]=' ';board[22][27]=' ';board[22][28]=' ';board[22][29]=' ';board[22][30]=' ';board[22][31]=' ';board[22][32]=' ';board[22][33]=' ';board[22][34]=' ';board[22][35]=' ';board[22][36]=' ';board[22][37]=' ';board[22][38]=' ';board[22][39]=' ';board[22][40]=' ';board[22][41]=' ';board[22][42]=' ';board[22][43]=' ';board[22][44]=' ';board[22][45]=' ';board[22][46]=' ';board[22][47]=' ';board[22][48]=' ';board[22][49]=' ';board[22][50]=' ';board[22][51]=' ';board[22][52]='|';board[22][53]='1';board[22][54]='9';board[22][55]=' ';
board[23][0]='2';board[23][1]='0';board[23][2]='|';board[23][3]=' ';board[23][4]=' ';board[23][5]=' ';board[23][6]=' ';board[23][7]=' ';board[23][8]=' ';board[23][9]=' ';board[23][10]=' ';board[23][11]=' ';board[23][12]=' ';board[23][13]=' ';board[23][14]=' ';board[23][15]=' ';board[23][16]=' ';board[23][17]=' ';board[23][18]=' ';board[23][19]=' ';board[23][20]=' ';board[23][21]=' ';board[23][22]=' ';board[23][23]=' ';board[23][24]=' ';board[23][25]=' ';board[23][26]=' ';board[23][27]=' ';board[23][28]=' ';board[23][29]=' ';board[23][30]=' ';board[23][31]=' ';board[23][32]=' ';board[23][33]=' ';board[23][34]=' ';board[23][35]=' ';board[23][36]=' ';board[23][37]=' ';board[23][38]=' ';board[23][39]=' ';board[23][40]=' ';board[23][41]=' ';board[23][42]=' ';board[23][43]=' ';board[23][44]=' ';board[23][45]=' ';board[23][46]=' ';board[23][47]=' ';board[23][48]=' ';board[23][49]=' ';board[23][50]=' ';board[23][51]=' ';board[23][52]='|';board[23][53]='2';board[23][54]='0';board[23][55]=' ';
board[24][0]='2';board[24][1]='1';board[24][2]='|';board[24][3]=' ';board[24][4]=' ';board[24][5]=' ';board[24][6]=' ';board[24][7]=' ';board[24][8]=' ';board[24][9]=' ';board[24][10]=' ';board[24][11]=' ';board[24][12]=' ';board[24][13]=' ';board[24][14]=' ';board[24][15]=' ';board[24][16]=' ';board[24][17]=' ';board[24][18]=' ';board[24][19]=' ';board[24][20]=' ';board[24][21]=' ';board[24][22]=' ';board[24][23]=' ';board[24][24]=' ';board[24][25]=' ';board[24][26]=' ';board[24][27]=' ';board[24][28]=' ';board[24][29]=' ';board[24][30]=' ';board[24][31]=' ';board[24][32]=' ';board[24][33]=' ';board[24][34]=' ';board[24][35]=' ';board[24][36]=' ';board[24][37]=' ';board[24][38]=' ';board[24][39]=' ';board[24][40]=' ';board[24][41]=' ';board[24][42]=' ';board[24][43]=' ';board[24][44]=' ';board[24][45]=' ';board[24][46]=' ';board[24][47]=' ';board[24][48]=' ';board[24][49]=' ';board[24][50]=' ';board[24][51]=' ';board[24][52]='|';board[24][53]='2';board[24][54]='1';board[24][55]=' ';
board[25][0]='2';board[25][1]='2';board[25][2]='|';board[25][3]=' ';board[25][4]=' ';board[25][5]=' ';board[25][6]=' ';board[25][7]=' ';board[25][8]=' ';board[25][9]=' ';board[25][10]=' ';board[25][11]=' ';board[25][12]=' ';board[25][13]=' ';board[25][14]=' ';board[25][15]=' ';board[25][16]=' ';board[25][17]=' ';board[25][18]=' ';board[25][19]=' ';board[25][20]=' ';board[25][21]=' ';board[25][22]=' ';board[25][23]=' ';board[25][24]=' ';board[25][25]=' ';board[25][26]=' ';board[25][27]=' ';board[25][28]=' ';board[25][29]=' ';board[25][30]=' ';board[25][31]=' ';board[25][32]=' ';board[25][33]=' ';board[25][34]=' ';board[25][35]=' ';board[25][36]=' ';board[25][37]=' ';board[25][38]=' ';board[25][39]=' ';board[25][40]=' ';board[25][41]=' ';board[25][42]=' ';board[25][43]=' ';board[25][44]=' ';board[25][45]=' ';board[25][46]=' ';board[25][47]=' ';board[25][48]=' ';board[25][49]=' ';board[25][50]=' ';board[25][51]=' ';board[25][52]='|';board[25][53]='2';board[25][54]='2';board[25][55]=' ';
board[26][0]='2';board[26][1]='3';board[26][2]='|';board[26][3]=' ';board[26][4]=' ';board[26][5]=' ';board[26][6]=' ';board[26][7]=' ';board[26][8]=' ';board[26][9]=' ';board[26][10]=' ';board[26][11]=' ';board[26][12]=' ';board[26][13]=' ';board[26][14]=' ';board[26][15]=' ';board[26][16]=' ';board[26][17]=' ';board[26][18]=' ';board[26][19]=' ';board[26][20]=' ';board[26][21]=' ';board[26][22]=' ';board[26][23]=' ';board[26][24]=' ';board[26][25]=' ';board[26][26]=' ';board[26][27]=' ';board[26][28]=' ';board[26][29]=' ';board[26][30]=' ';board[26][31]=' ';board[26][32]=' ';board[26][33]=' ';board[26][34]=' ';board[26][35]=' ';board[26][36]=' ';board[26][37]=' ';board[26][38]=' ';board[26][39]=' ';board[26][40]=' ';board[26][41]=' ';board[26][42]=' ';board[26][43]=' ';board[26][44]=' ';board[26][45]=' ';board[26][46]=' ';board[26][47]=' ';board[26][48]=' ';board[26][49]=' ';board[26][50]=' ';board[26][51]=' ';board[26][52]='|';board[26][53]='2';board[26][54]='3';board[26][55]=' ';
board[27][0]='2';board[27][1]='4';board[27][2]='|';board[27][3]=' ';board[27][4]=' ';board[27][5]=' ';board[27][6]=' ';board[27][7]=' ';board[27][8]=' ';board[27][9]=' ';board[27][10]=' ';board[27][11]=' ';board[27][12]=' ';board[27][13]=' ';board[27][14]=' ';board[27][15]=' ';board[27][16]=' ';board[27][17]=' ';board[27][18]=' ';board[27][19]=' ';board[27][20]=' ';board[27][21]=' ';board[27][22]=' ';board[27][23]=' ';board[27][24]=' ';board[27][25]=' ';board[27][26]=' ';board[27][27]=' ';board[27][28]=' ';board[27][29]=' ';board[27][30]=' ';board[27][31]=' ';board[27][32]=' ';board[27][33]=' ';board[27][34]=' ';board[27][35]=' ';board[27][36]=' ';board[27][37]=' ';board[27][38]=' ';board[27][39]=' ';board[27][40]=' ';board[27][41]=' ';board[27][42]=' ';board[27][43]=' ';board[27][44]=' ';board[27][45]=' ';board[27][46]=' ';board[27][47]=' ';board[27][48]=' ';board[27][49]=' ';board[27][50]=' ';board[27][51]=' ';board[27][52]='|';board[27][53]='2';board[27][54]='4';board[27][55]=' ';
board[28][0]=' ';board[28][1]=' ';board[28][2]='+';board[28][3]='-';board[28][4]='-';board[28][5]='-';board[28][6]='-';board[28][7]='-';board[28][8]='-';board[28][9]='-';board[28][10]='-';board[28][11]='-';board[28][12]='-';board[28][13]='-';board[28][14]='-';board[28][15]='-';board[28][16]='-';board[28][17]='-';board[28][18]='-';board[28][19]='-';board[28][20]='-';board[28][21]='-';board[28][22]='-';board[28][23]='-';board[28][24]='-';board[28][25]='-';board[28][26]='-';board[28][27]='-';board[28][28]='-';board[28][29]='-';board[28][30]='-';board[28][31]='-';board[28][32]='-';board[28][33]='-';board[28][34]='-';board[28][35]='-';board[28][36]='-';board[28][37]='-';board[28][38]='-';board[28][39]='-';board[28][40]='-';board[28][41]='-';board[28][42]='-';board[28][43]='-';board[28][44]='-';board[28][45]='-';board[28][46]='-';board[28][47]='-';board[28][48]='-';board[28][49]='-';board[28][50]='-';board[28][51]='-';board[28][52]='+';board[28][53]=' ';board[28][54]=' ';board[28][55]=' ';
board[29][0]=' '; board[29][1]=' '; board[29][2]=' '; board[29][3]='0';board[29][4]=' '; board[29][5]='1'; board[29][6]=' '; board[29][7]='2'; board[29][8]=' '; board[29][9]='3';board[29][10]=' ';board[29][11]='4';board[29][12]=' ';board[29][13]='5';board[29][14]=' ';board[29][15]='6';board[29][16]=' ';board[29][17]='7';board[29][18]=' ';board[29][19]='8';board[29][20]=' ';board[29][21]='9';board[29][22]=' ';board[29][23]='0';board[29][24]=' ';board[29][25]='1';board[29][26]=' ';board[29][27]='2';board[29][28]=' ';board[29][29]='3';board[29][30]=' ';board[29][31]='4';board[29][32]=' ';board[29][33]='5';board[29][34]=' ';board[29][35]='6';board[29][36]=' ';board[29][37]='7';board[29][38]=' ';board[29][39]='8';board[29][40]=' ';board[29][41]='9';board[29][42]=' ';board[29][43]='0';board[29][44]=' ';board[29][45]='1';board[29][46]=' ';board[29][47]='2';board[29][48]=' ';board[29][49]='3';board[29][50]=' ';board[29][51]='4';board[29][52]=' ';board[29][53]=' ';board[29][54]=' ';board[29][55]=' ';
board[30][0]=' ';board[30][1]=' ';board[30][2]=' ';board[30][3]=' ';board[30][4]=' ';board[30][5]=' ';board[30][6]=' ';board[30][7]=' ';board[30][8]=' ';board[30][9]=' ';board[30][10]=' ';board[30][11]=' ';board[30][12]=' ';board[30][13]=' ';board[30][14]=' ';board[30][15]=' ';board[30][16]=' ';board[30][17]=' ';board[30][18]=' ';board[30][19]=' ';board[30][20]=' ';board[30][21]=' ';board[30][22]=' ';board[30][23]='1';board[30][24]=' ';board[30][25]=' ';board[30][26]=' ';board[30][27]=' ';board[30][28]=' ';board[30][29]=' ';board[30][30]=' ';board[30][31]=' ';board[30][32]=' ';board[30][33]=' ';board[30][34]=' ';board[30][35]=' ';board[30][36]=' ';board[30][37]=' ';board[30][38]=' ';board[30][39]=' ';board[30][40]=' ';board[30][41]=' ';board[30][42]=' ';board[30][43]='2';board[30][44]=' ';board[30][45]=' ';board[30][46]=' ';board[30][47]=' ';board[30][48]=' ';board[30][49]=' ';board[30][50]=' ';board[30][51]=' ';board[30][52]=' ';board[30][53]=' ';board[30][54]=' ';board[30][55]=' ';
pen=1;
for(i=4;i<28;){
for(i=4;i<53;){
while(ch!=9){
scanf("%d",&ch);
if(ch==1){
pen=1;
}
if(ch==2){
pen=2;
}
if(ch==9){
exit(0);
}
switch(ch){
case 3:turnRight(degrees); break;
case 4:turnLeft(degrees); break;
case 5:if(degrees==1||degrees==-3){
moveTurtleDown(board,y,row,col,pen);
break;
}
if(degrees==2||degrees==-2){
moveTurtleBackward(board,y,row,col,pen);
break;
}
if(degrees==3||degrees==-1){
moveTurtleUp(board,y,row,col,pen);
break;
}
if(degrees==4||degrees==0){
moveTurtleFoward(board,y,row,col,pen);
break;
}
}
if(ch==6){
outputBoard(board,row,col,i,j);
}
}
}
}
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started