|
@@ -4,11 +4,11 @@
|
4
|
4
|
![main2.png](images/main2.png)
|
5
|
5
|
![main3.png](images/main3.png)
|
6
|
6
|
|
7
|
|
-[Verano 2016 - Rafa - Ive]
|
|
7
|
+[Verano 2016 - Rafa - Ive- Tatiana]
|
8
|
8
|
|
9
|
|
-One of the advantages of using computer programs is that we can easily implement repetitive tasks. Structures such as the `for`, `while`, and `do-while` allow us to repeat a block of instructions as many times as needed. These structures are also referred to as *repetition structures*.
|
|
9
|
+One of the advantages of using computer programs is that we can easily implement repetitive tasks. Structures such as `for`, `while`, and `do-while` allow us to repeat a block of instructions as many times as needed. These structures are also referred to as *repetition structures*.
|
10
|
10
|
|
11
|
|
-Algorithms are one of the fundamental concepts in Computer Science. Given a small set of instructions and the basic programming structures, we can solve many problems. In this laboratory experience you will practice the creation of algorithms simulating a robot that must explore a space using a set of very limited instructions.
|
|
11
|
+Algorithms are one of the fundamental concepts in Computer Science. Given a small set of instructions and the basic programming structures, we can solve many problems. In this laboratory experience, you will practice the creation of algorithms simulating a robot that must explore a space using a set of very limited instructions.
|
12
|
12
|
|
13
|
13
|
##Objectives:
|
14
|
14
|
|
|
@@ -36,7 +36,7 @@ Before arriving to the laboratory you should have:
|
36
|
36
|
|
37
|
37
|
## Counting Squares
|
38
|
38
|
|
39
|
|
-In this laboratory experience we will be programming a robot that has been placed in a grid of square rooms. Each one of the four walls in each room can have a door. Only the walls of adjoining rooms have doors. The walls that make up the grid's exterior do not have doors.
|
|
39
|
+In this laboratory experience, we will be programming a robot that has been placed in a grid of square rooms. Each one of the four walls in each room can have a door. Only the walls of adjoining rooms have doors. The walls that make up the grid's exterior do not have doors.
|
40
|
40
|
|
41
|
41
|
---
|
42
|
42
|
|
|
@@ -164,7 +164,7 @@ Suppose that the robot is currently in the upper left room (northwest) of a **sq
|
164
|
164
|
|
165
|
165
|
5. Suppose we want to minimize the amount of energy used by the robot. Can you create an algorithm that uses less steps for the same grid size?
|
166
|
166
|
|
167
|
|
-6. Once you have finished your algorithm, and made it correct and efficient, hand it in using Delivererable 1 in Moodle. On the algorithm's header, write and explain the expression you found about the number of rooms the robot should visit to complete its task for a grid of size $$n \times n$$ (For example, "The robot takes 2x+5 steps, 5 to arrive at the middle and 2n to count the rest").
|
|
167
|
+6. Once you have finished your algorithm, and made it correct and efficient, hand it in using Deliverable 1 in Moodle. On the algorithm's header, write and explain the expression you found about the number of rooms the robot should visit to complete its task for a grid of size $$n \times n$$ (For example, "The robot takes 2x+5 steps, 5 to arrive at the middle and 2n to count the rest").
|
168
|
168
|
|
169
|
169
|
|
170
|
170
|
### Exercise 2 - Rectangular grid
|
|
@@ -181,13 +181,13 @@ Suppose that the robot is currently in the upper left room (northwest) of a **sq
|
181
|
181
|
|
182
|
182
|
### Exercise 3 - Rectangular grid, random position
|
183
|
183
|
|
184
|
|
-**Instrucciones**
|
|
184
|
+**Instructions**
|
185
|
185
|
|
186
|
186
|
1. Suppose that now the robot starts its task in any of the rooms in a **rectangular** grid (not necessarily square). Design an algorithm so the robot can compute the number of rooms there are in the grid.
|
187
|
187
|
|
188
|
188
|
2. To test this part of the program you should make sure the `MainGameWindow` object is created using the argument `Mode::RECT_RANDOM`.
|
189
|
189
|
|
190
|
|
-3. Once you have finished your algorithm, and made it correct and efficient, implement it in the `main` function. In the header of the program, write and explain the expression you found about the number of rooms the robot should visit to complete its task for a grid of size $$m \times n$$. In this case, the number of rooms to visit will depend on the robot's initial position, so express the worst case, i.e. according to your algorithm, how many rooms should the robot visit if it starts in the *worst* room.
|
|
190
|
+3. Once you have finished your algorithm, and made it correctly and efficiently, implement it in the `main` function. In the header of the program, write and explain the expression you found about the number of rooms the robot should visit to complete its task for a grid of size $$m \times n$$. In this case, the number of rooms to visit will depend on the robot's initial position, so express the worst case, i.e. according to your algorithm, how many rooms should the robot visit if it starts in the *worst* room.
|
191
|
191
|
|
192
|
192
|
4. Hand in the `main.cpp` file with the code to calculate the number of rooms in a rectangular grid with the robot in a random position using Deliverable 3 in Moodle.
|
193
|
193
|
|
|
@@ -223,4 +223,6 @@ Use the "Deliverable" links in Moodle to hand in the algorithm for Exercise 1 an
|
223
|
223
|
|
224
|
224
|
## References
|
225
|
225
|
|
226
|
|
-[1] Luther A. Tychonievich, Mark S. Sherriff, and Ryan M. Layer, http://nifty.stanford.edu/2015/tychonievich-sherriff-layer-counting-squares/
|
|
226
|
+[1] Luther A. Tychonievich, Mark S. Sherriff, and Ryan M. Layer, http://nifty.stanford.edu/2015/tychonievich-sherriff-layer-counting-squares/
|
|
227
|
+
|
|
228
|
+
|