At Westonci.ca, we connect you with the best answers from a community of experienced and knowledgeable individuals. Get detailed and accurate answers to your questions from a dedicated community of experts on our Q&A platform. Explore comprehensive solutions to your questions from knowledgeable professionals across various fields on our platform.

2.17.5 coders answers

Sagot :

Answer:

start();

if(colorIs(Color.blue)){

paint(Color.red);

if(frontIsClear());

move();

}else{

if(colorIs(Color.red)){

paint(Color.blue);

if(frontIsClear());

move();

}

}

if(colorIs(Color.blue)){

paint(Color.red);

if(frontIsClear());

move();

}else{

if(colorIs(Color.red)){

paint(Color.blue);

if(frontIsClear());

move();

}

}

if(colorIs(Color.blue)){

paint(Color.red);

if(frontIsClear());

move();

}else{

if(colorIs(Color.red)){

paint(Color.blue);

if(frontIsClear());

move();

}

}

if(colorIs(Color.blue)){

paint(Color.red);

if(frontIsClear());

move();

}else{

if(colorIs(Color.red)){

paint(Color.blue);

if(frontIsClear());

move();

}

}

if(colorIs(Color.blue)){

paint(Color.red);

if(frontIsClear());

move();

}else{

if(colorIs(Color.red)){

paint(Color.blue);

if(frontIsClear());

move();

}

}

if(colorIs(Color.blue)){

paint(Color.red);

if(frontIsClear());

move();

}else{

if(colorIs(Color.red)){

paint(Color.blue);

if(frontIsClear());

move();

}

}

if(colorIs(Color.blue)){

paint(Color.red);

if(frontIsClear());

move();

}else{

if(colorIs(Color.red)){

paint(Color.blue);

if(frontIsClear());

move();

}

}

if(colorIs(Color.blue)){

paint(Color.red);

if(frontIsClear());

move();

}else{

if(colorIs(Color.red)){

paint(Color.blue);

if(frontIsClear());

move();

}

}

if(colorIs(Color.blue)){

paint(Color.red);

if(frontIsClear());

move();

}else{

if(colorIs(Color.red)){

paint(Color.blue);

if(frontIsClear());

move();

}

}

if(colorIs(Color.blue)){

paint(Color.red);

if(frontIsClear());

}else{

if(colorIs(Color.red)){

paint(Color.blue);

if(frontIsClear());

}

}

function start(){

}

Q. 5.1.3: Move to Wall

Ans:

function start(){

while(frontIsClear()){

move();

}

}

I apologize if its incorrect