Question: Please code this using c++ programming Rabbit instruction.txt forward 100 back 50 right_turn 90 forward 50 back 100 left_turn 90 left_turn 90 forward 80 First,

Please code this using c++ programming

Rabbit instruction.txt

forward 100

back 50

right_turn 90

forward 50

back 100

left_turn 90

left_turn 90

forward 80

First, your program should print the following 3 lines:

There are 3 rabbits.

The rabbits are traced.

The state of the rabbit is 0 initially.

if instruction "forward 100" the programme generate this 2 sentence

When the state of the rabbit is equal to 0, it moves forward 1 pixel and the s0_steps of the rabbit increases.

When the s0_steps of the rabbit is greater than or equal to 20, the state of the rabbit increments and the s0_steps of the rabbit becomes 0.

If instruction "right_turn 90" the programme generate this 2 sentence

When the state of the rabbit is equal to 1, the angle of the rabbit increases by 3 and the s1_steps of the rabbit increases.

When the s1_steps of the rabbit is greater than or equal to 30, the state of the rabbit increments and the s1_steps of the rabbit becomes 0.

Please help me finish back 50, forward 50, back 100, left turn 90, left turn 90 and forward 80 instruction using this example above.

if it says forward right turn or left turn we just copy past the two sentences from the direction. the only change is you need them is the magnitude of the movement and increment the state.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!