Lesson / Lección 6: Challenges

Reeborg Progress
90%

Exercise: Storm 1

Guiding Questions:

  • How can while loops help us solve the problem?
  • How many conditions does Reeborg need to check for? What conditions are these?

For this exercise, think about how nested while loops may be helpful for solving the problem.

This exercise might also be a good place to use a pencil/paper to draw out and visualize the solution the functioning components of the code.

  • Notice that this exercise uses the toss() command with the take() command, instead of put(), which was used in previous exercises
  • carries_object() may be another helpful condition to test out
    • It can be used along with many of the other conditions from previous exercises to solve the problem
    • For a refresher on these conditions, look back at the Around 1- variable exercise

Exercise: Storm 2

Guiding Questions:

  • How is this problem similar or different from Storm 1?
  • This exercise gets into problem solving methods that might be more applicable to real world tasks. Can you think of any type of situation that might require this type of code/algorithm to solve?
  • Why might we be concerned about solving this problem in the fastest, most efficient way possible?

This exercise is similar to Harvest 1 in many ways. You can start with Harvest 1 and build off of it to create the solution for Storm 2 if that is helpful for you. Otherwise, it may be useful to simply compare the two worlds and discuss what generalized solution would apply to both.

This is also an excellent place to think about efficiency in code. Though the Storm 2 solution should work on the Storm 1 world as well, it is less efficient. You might want to think about the trade-offs of general versus efficient code and think about other real world problems where this kind of cost benefit analysis applies.

Like in Storm 1, it may be helpful to use a pencil/paper to draw out ideas for navigating the worlds. Think about the best way of going around the world. Because Reeborg can really only see what is going on in the cell it is in, we don’t want to visit the same block twice. So what is a path to minimize the amount of times we go into a cell?

Exercise: Center 1

This problem is very tricky! But it is very satisfying. This problem is difficult but keep going even if you run into obstacles. Ask a mentor if you need help, most of them had to do this problem in their Computer Science Class.

Guiding Questions:

  • How can we use the tokens to keep track of different aspects of the situation: how large the world is, where Reeborg has been?
  • If we don’t know how large the world is, how do we go about finding the center point? (spend some time and try to brainstorm an algorithm on paper)

This problem can be solved using only a few tokens or using many tokens. Try whichever method comes to them first. If you choose to use many tokens, you can then think about how you can solve the problem if you were only able to use two tokens.


Ejercicio: Storm 1

Preguntas orientadoras:

  • ¿Cómo pueden los ciclos while ayudarnos a resolver el problema?
  • ¿Cuántas condiciones debe verificar Reeborg? ¿Qué condiciones son estas?

Para este ejercicio, piense en cómo anidar los ciclos while pueden ser útiles para resolver el problema.

Este ejercicio también podría ser un buen lugar para usar un lápiz / papel para dibujar y visualizar la solución de los componentes funcionales del código.

  • Tenga en cuenta que este ejercicio utiliza la función toss() con la función take(), en lugar de put(), que se utilizó en ejercicios anteriores
  • carry_object() puede ser otra condición útil para probar
  • Se puede usar junto con muchas de las otras condiciones de ejercicios anteriores para resolver el problema
  • Para una actualización de estas condiciones, revise el ejercicio Around 1 – variable

Ejercicio: Storm 2

Preguntas orientadoras:

  • ¿Cómo es este problema similar o diferente de la Storm 1?
  • Este ejercicio aborda los métodos de resolución de problemas que podrían ser más aplicables a las tareas del mundo real. ¿Puedes pensar en algún tipo de situación que requiera este tipo de código / algoritmo para resolver?
  • ¿Por qué deberíamos preocuparnos por resolver este problema de la manera más rápida y eficiente posible?

Este ejercicio es similar a Harvest 1 en muchos sentidos. Puede comenzar con Harvest 1 y construir a partir de él para crear la solución para Storm 2 si eso es útil para usted. De lo contrario, puede ser útil simplemente comparar los dos mundos y discutir qué solución generalizada se aplicaría a ambos.

Este también es un excelente lugar para pensar en la eficiencia en el código. Aunque la solución Storm 2 también debería funcionar en el mundo Storm 1, es menos eficiente. Es posible que desee pensar en las compensaciones del código general versus el código eficiente y pensar en otros problemas del mundo real donde se aplica este tipo de análisis de costo-beneficio.

Al igual que en la Storm 1, puede ser útil usar un lápiz / papel para extraer ideas para navegar por los mundos. Piensa en la mejor manera de dar la vuelta al mundo. Debido a que Reeborg realmente solo puede ver lo que está sucediendo en la celda en la que se encuentra, no queremos visitar el mismo bloque dos veces. Entonces, ¿cuál es un camino para minimizar la cantidad de veces que ingresamos a una celda?

Ejercicio: Center 1

¡Este problema es muy complicado! Pero es muy satisfactorio. Este problema es difícil, pero continúe incluso si se encuentra con obstáculos. Pregúntele a un mentor si necesita ayuda, la mayoría de ellos tuvo que resolver este problema en su clase de informática.

Preguntas orientadoras:

  • ¿Cómo podemos usar los tokens para realizar un seguimiento de diferentes aspectos de la situación: qué tan grande es el mundo, dónde ha estado Reeborg?
  • Si no sabemos qué tan grande es el mundo, ¿cómo hacemos para encontrar el punto central? (Dedique algo de tiempo e intente hacer una lluvia de ideas sobre un algoritmo en papel)

Este problema se puede resolver usando solo unos pocos tokens o usando muchos tokens. Pruebe el método que les llegue primero. Si elige usar muchos tokens, puede pensar en cómo puede resolver el problema si solo pudiera usar dos tokens.