Question: Hello. This is for C++, any help would be amazing. In this program, you will write an interpreter for a language similar to the Lightbot

Hello. This is for C++, any help would be amazing.

Hello. This is for C++, any help would be amazing. In thisprogram, you will write an interpreter for a language similar to theLightbot language. The interpreter will take as input an initial board configuration,

In this program, you will write an interpreter for a language similar to the Lightbot language. The interpreter will take as input an initial board configuration, including the location of the robot (the robot always starts facing to the right), and a program. It must then compute the resulting board configuration, and determine whether the bot will win the level or not (by switching on all the lights and stopping without dying). "Switching" on a square toggles the light if there is one, and does nothing otherwise. Language Commands: Left rotate left 90 degrees Right rotate right 90 degrees Forward go forward one square Switch toggle light if there is one in the current square If Condition { Statements } Check the condition. If it is true, execute the statements, otherwise skip to after the close } Possible conditions: forwardopen, backopen, leftopen, rightopen forwardclosed, backclosed, leftclosed, rightClosed hasLight, lighton, lightoff Repeat N { Statements } Repeat the statements N times Break Break out of a loop Procedure procedureName { Statements } Define a procedure called procedureName. When it is run, do the Statements. If you reach the end of the statements, return to the calling procedure. Also return on a Return statement. Return Return from the current procedure procedureName Call the procedure. Execute its statements. When control returns, begin execution at the next location. Stop Stop the program In this program, you will write an interpreter for a language similar to the Lightbot language. The interpreter will take as input an initial board configuration, including the location of the robot (the robot always starts facing to the right), and a program. It must then compute the resulting board configuration, and determine whether the bot will win the level or not (by switching on all the lights and stopping without dying). "Switching" on a square toggles the light if there is one, and does nothing otherwise. Language Commands: Left rotate left 90 degrees Right rotate right 90 degrees Forward go forward one square Switch toggle light if there is one in the current square If Condition { Statements } Check the condition. If it is true, execute the statements, otherwise skip to after the close } Possible conditions: forwardopen, backopen, leftopen, rightopen forwardclosed, backclosed, leftclosed, rightClosed hasLight, lighton, lightoff Repeat N { Statements } Repeat the statements N times Break Break out of a loop Procedure procedureName { Statements } Define a procedure called procedureName. When it is run, do the Statements. If you reach the end of the statements, return to the calling procedure. Also return on a Return statement. Return Return from the current procedure procedureName Call the procedure. Execute its statements. When control returns, begin execution at the next location. Stop Stop the program

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 Databases Questions!