5
$\begingroup$

I want to solve Robozzle puzzle number 291 - Huh? Part 2.

You can see it raw in the image below. You need to collect the stars without falling out of the given grid. You are the rocket on top-left corner of the grid; starting point is red cell here.

Robozzle 291 raw

You give certain commands to the rocket and it obeys them. The less command, the better. Commands for this puzzle are shown below.

Robozzle 291 given commands

Commands are displayed on right side. From top to down they are: go straight, turn left, turn right; call F1 function, call F2 function, call F3 function; change colour of the current cell to green, change colour of the current cell to blue; execute this command no matter what the colour of cell is, execute this command in red cell, execute this command in green cell and execute this command in blue cell.

Each time it starts with F1 function. If you don't call F2 function in F1 then it will not execute commands in F2. Same applies for F3; if you don't call it, it won't be executed.

Let me show you how to play this game in another easy puzzle.

robozzle stairs blank

This puzzle is called "Stairs." You can see the commands and given function on the bottom right corner again. They are blank. If I click on Go! nothing happens because there are no commands given in function.

Now, let's fill in the function with some necessary commands.

Robozzle Stairs with commands but no iteration or recursion

You can see where robot stays. It hasn't collected all the stars. Function was called but it was executed just once. Why? Because there is no iteration (or recursion) or repetition of commands.

Remember we need to collect all the stars, so let's call F1 function again at the end of commands so that it iterates (or recurses) or repeats itself.

stairs completed

The rocket has collected all the stars because F1 was called again at the end so that it repeatedly goes beginning when it finishes executing all the commands. At the bottom you can see what the next steps are such as turn left, go, turn right and F1. This was completed in 5 commands.

Now, hoping that you understood how to solve this puzzle I'm returning back to my puzzle in question; I was able to collect only one star in the centre (in green cell) by calling only 2 functions: F1 and F3. However, that's not enough to solve the puzzle. Remember, I needed to collect all the stars.

Robozzle 291 only green star collected

Now, with the image below, there is still no solution. It just does repetitious U-turn between the green cells in the centre. What I did was to turn right after red cell and colour the cell to green on the corner. I wanted to utilise those green cells on the corners when I return back from the star in the middle. I need to collect the star on the upper left corner also. But, it didn't work.

291 still no solution

There are a lot of possible solutions for this puzzle. One way is to collect the star behind the rocket (on the upper left corner) first and then collect the star in the middle. For this one you don't need to use colour changes as far as I know because I have read the comments in that website: comments for Robozzle 291.

And there is another solution: you collect the star in the middle and colouring the corners (or just the cell near the corner, like red one was) to utilise them when returning back. I thought about colouring the cell after you turn right, so that it acts as milestone when returning back. So that you turn left after green when returning back from the middle; as you did turn right after red when going forward to the middle. It is shown below.

291 green after turn

Still, I couldn't solve it. I have been dealing with this puzzle for more than 3 days and I think more than when a person spends more than a day or two is enough for asking help from others. There are a lot of solutions for these puzzles and they are fun. You can see my another question in this website where I got a lot of nice answers each of them being quite different: Shorter solution for Robozzle puzzle no 132 - Split. Thanks beforehand.

$\endgroup$
1
  • 1
    $\begingroup$ Dear users, thanks for your efforts and solutions. I wish I could give you all +50 bounty. I can reward +50 bounty for only 1 user and I rewarded @Rick since he was the first one to submit the correct answer. Thank you all for your efforts. I appreciate your hard work. $\endgroup$
    – garakchy
    Feb 13, 2023 at 11:49

3 Answers 3

3
+50
$\begingroup$

I've spent a couple minutes trying to figure this out.

It's a fun, nice challenge. Thanks for posting this. I've come up with this solution:

solution

It gets the star behind the player first, then turns around again. The rest is just straight ahead and it turns right when the tile isn't blue.

$\endgroup$
1
  • 1
    $\begingroup$ What a nice solution, Thanks sir. Turn back, go, repeat it if blue; if red then starting point of puzzle, (and I know how to do the rest). Simple yet intriguing :) $\endgroup$
    – garakchy
    Feb 9, 2023 at 15:10
3
$\begingroup$

And here are some variations. In both cases you turn around to get the nearby star first.

enter image description here

and

enter image description here

$\endgroup$
2
  • 1
    $\begingroup$ More ways to solve this cool puzzle are always welcome. $\endgroup$
    – Nautilus
    Feb 13, 2023 at 8:28
  • $\begingroup$ Thanks for the solutions. I never thought about your first solution but I was expecting the second one. Because U-turn go and U-turn go is enough to get the star behind. And then F2 is enough to go forward and collect the star in the middle. I couldn't put it in correct commands. Thanks again for providing two different solutions. $\endgroup$
    – garakchy
    Feb 13, 2023 at 12:07
2
$\begingroup$

Another possible solution (turn back later):

enter image description here

$\endgroup$
2
  • $\begingroup$ I was expecting this solution :) I knew that green cell was not on the corner but after just turning the corner. Because green in the middle gave it up, you can turn left after the green in the middle. Thanks for the alternative solution. $\endgroup$
    – garakchy
    Feb 13, 2023 at 11:21
  • 1
    $\begingroup$ You're welcome. It looks like you were going for this kind of a solution with your attempts. I tried going back early but couldn't make it work, so went forward first. $\endgroup$
    – Nautilus
    Feb 13, 2023 at 11:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.