Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please provide the correct code that solves the challenge To get your starter code, execute the following command in your home directory: $ getStarter PA2b

image text in transcribed

image text in transcribed

image text in transcribed

please provide the correct code that solves the challenge

To get your starter code, execute the following command in your home directory: $ getStarter PA2b As in the previous programming assignment, the repeat() functionality no longer works. However, you are allowed to use variables of type int, including different storage classes such as static variables. However, throughout this PA, you are not allowed to use global variables. In this PA, we will also be introducing integer pointers. Again, all problems require generic solutions, meaning that they should work for a variety of different maps and situations, within the constraints of each problem. To signal that he has reached his goal, execute the turn_off() command and Karel's final orientation is not important. Some of the problems may have specific constraints. Make sure you read these carefully. If you do not follow these constraints, your code will fail the grading scripts. For some problems, you are also told not to modify the main(). In these cases, the grading scripts will replace your main() with our own version 1 and any changes you were to make to the main() would not have any effect. You should again consider using the printf() function combined with Karel's pause() command for debugging purposes. As a reminder, if you are using ASCII graphics, always have a pause() right after a printf() command (or you won't be able to see what you've printed). When you submit your code. it is important to comment out. delete or disable all your printf(). say text() and pause() statements, as it impacts how long your code takes to run with our test scripts. Also remember that you can view maps using the karel map editor (e.g., with the -v option). This can be helpful to verify the correct end state for a task, by looking at the end map. To compile your code, follow the same procedure as in the previous PAs, using the Makefile. For example, to compile unstack.c, use: \$ make unstack Karel Unstacks his Items Karel is in a completely empty map with only walls at the edges. All his items are in stacks on the floor and he needs to hang them from the ceiling. Karel starts at the SW corner of the map facing E on an empty tile. The tiles in front of him each have some items (or possibly no items). He needs to take these items and place them one-by-one on the N-most tiles of the column, as illustrated in the example. Karel stops when he reaches the E wall and he needs to end up in the SE corner (the direction he is facing does not matter). He starts with an infinite number of items in his bag. You may assume the height of the columns is enough to fit all the items Karel needs to place. Write your solution in unstack.c

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mastering Big Data Interview 751 Comprehensive Questions And Expert Answers

Authors: Mr Bhanu Pratap Mahato

1st Edition

B0CLNT3NVD, 979-8865047216

More Books

Students also viewed these Databases questions

Question

politeness and modesty, as well as indirectness;

Answered: 1 week ago