Help a New Small Robot-Tester
June 29, 2010 1:57 PM   Subscribe

After reading this answer, I tried playing the programming-esque game Manufactoria. I loved it immediately. The first two levels were perfectly simple and didn't require a second of thought, but I keep futzing with level three (Robolamps). I seem to get very close to success over and over, but after 2 days I can't get a proper solution. I have no programming experience at all, but I seem to have an unnatural amount of patience for trying to figure this out, and think the basic concepts aren't challenging at all yet, at this completely basic level-- I just think I might be missing a crucial concept or two.

Any advice on what concepts I might be missing as a total novice? I feel confident about the directions everything should be moving in, but occasionally a robot will go in a direction not anticipated, which seems to suggest that the problem lies in my design.

My main questions are 1) Should my robot-testing machine carry even defective robots all the way through to the end box? 2) Why do the conveyor belts work when placed perpendicularly most of the time, but occasionally a robot will fail to go in the direction which all previous experience suggests that it should? 3) Mystery question, which I don't know enough to ask. 4) Does the secret lie in sticking on a piece of conveyor belt which redirects the robot back through the directional device a couple of extra times? I had some success with that, but not enough apparently.

I tried searching out all of these answers, but of course most of the information is for the more complex levels, and often written in strings of code. Any answers would be appreciated.
posted by thegreatfleecircus to Technology (17 answers total) 15 users marked this as a favorite
 
Best answer: (1) No. Defective robots should be discarded (by falling off the end of a conveyor or selector block).

(2) Robots will always go in the direction of the conveyor belt movement, no matter where they enter the conveyor belt. I wonder if you're having a hard time telling which way a conveyor is pointed?

You can even push a robot onto "out" side of a conveyor belt, if that makes sense - they'll just change directions back "out". This is true for all the blocks, actually - it doesn't matter which side of the block a robot enters - it will always exit on the side matching the next color. This is a pretty advanced technique, and not really necessary until the levels start getting really small.

(4) Yes. It's called a loop. I can't access Manufactoria at work, but I found that searching for "pseudocode" or plain-language solutions for the levels was a big help. If you post the level description, I could write one out for you.
posted by muddgirl at 2:07 PM on June 29, 2010


You can also layer two conveyors, one on perpendicularly on top of the other. I think in this case, the robot will travel along the conveyor parallel to their entrance.

Does this FAQ help at all? It's the first I found that has plain-language hints.
posted by muddgirl at 2:14 PM on June 29, 2010 [1 favorite]


Best answer: Just had a play of the first three levels, and yes, there's a MAJOR jump in difficulty between levels two and three.

Think about the imaginary case where a robot has 5 red dots before the three blue dots that you need to check in order to consider it a correct robot. What if it had 10 red dots first? What about 100? You need a solution which scales to an arbitrary number of dots.

So, you need to think "if the current dot is red, forget about it and focus on the next dot. If it's blue, push it through to the next stage of processing." The next stage of processing is, of course, the same as the first. But in the machine it will have to be a separate unit carrying out the same test.

As muddgirl said, you need to think in loops.

PS, thanks for turning me on to this game. Love it.
posted by godawful at 2:24 PM on June 29, 2010


Best answer: I just gave it a shot, and the key is to redirect the robot through the directional device, as you suspected. The algorithm you're trying to implement is:

Read a color.
Was it red? Ignore it and read again.
Was it blue? Advance to the next station.
Was it empty? Reject the robot.

Your challenge is to do two things. First, you have to build a single 'station' that can discard reds and advance on blues - that's a directional gizmo with the red side having a conveyor pointing straight back in, and the blue side going somewhere else. Second, you have to count to 3, so you need 3 such 'stations', linked by their blue sides, so the position of the robot tells you how many blues you've seen so far.

The key to thinking about this puzzle is to remember that the reds don't matter - you want to read the entire "input" (the whole series of colors) and keep track of how many blues you've seen. Also, don't feel bad about duplicating the same pieces over and over; that's how you keep track of the count of what you've seen ("state", in programming terms.)
posted by pocams at 2:26 PM on June 29, 2010


Best answer: Muddgirl has answered your stated questions. I've put together a solution that demonstrates a looping construct.

Short explanation: the goal is to accept any robot with at least three blue bits. All robots come out to the first R/B branch. Blue ones go off to the left, call those B. Red ones go off to the right, then up, left and down back to the first R/B branch. Now the second bit is tested, again blue ones go off to the left. In my head, this is a loop: go right until you see a blue bit.

Any B robots will approach the second R/B branch and a similar sorting logic is applied. Red bits just keep going around in circles until a blue bit is found (if ever). Call these robots BB, since they will have to have two blue bits to get that far.

Similarly, all BB robots will end up at the third R/B switch. They will either be (eventually) find another blue bit or will fall off. Those that get the third blue bit pass the test and will continue to the exit.

(Muddgirl's point 2 allowed me to optimize my engine significantly - instead of causing red bits to go in a physical loop, they can be bounced right back into the switch like this. I'm positive that further optimizations can be made.)

On preview: others have given pretty complete answers; I'll post mine anyways in case pictures will help.
posted by flipper at 2:30 PM on June 29, 2010


Best answer: Let's talk about the level you're stuck on, Robolamps. You need to pass the robots to the exit if (and only if) they have three blues.

It helps to think through the process and break it down into very small pieces. (In fact this is one of the keys to successful programming - learning to break a problem down into small enough pieces that you can teach the computer to handle them, and then using those bite-sized pieces to build up more complex systems.)

So let's say you get a red one. We don't care about red, so what do we do? Well, basically we just want to skip it and keep going, we only care about blue ones.

Let's say you get a blue one. Yay! But we need two more blue ones. So we need some way of recognizing the fact that we're one-third of the way there and only need to find two more blue ones.

So for the first step, you'll have a red-blue decision widget and exits on either side. When we get a red one, we basically need to just come right back to this widget and check again, so on that side, you can put a conveyor belt pushing us right back into the widget again. This is our way of saying, "Fine, it's red, but I don't care, keep looking." When we get a blue one, we need to move to the next step, so let's put a conveyor belt on that side going down a step while we think about what to do next. What if we get something that's neither red nor blue? Well, at this point the only other option is the end of the tape, and if we hit the end of the tape without hitting any blues, we don't want that robot anyway, so we won't put anything there - we'll just dump those robots to the floor.

So now let's say we've hit that blue dot, and we've exited onto the conveyor belt to head to the next step. What's the next step? Actually it's very much like the first one - we're looking for another blue one, and ignoring any red ones, and dumping any robots that reach the end before they hit another blue one. So we can do exactly the same thing as the first step.

Now you've got a machine that passes robots with two blue dots to the end. You just need to recognize the last blue dot, and by this point you're probably getting it - just replicate your blue-dot-finding-machine one more time. This time, the conveyor belt isn't going to take us through any more widgets - if we find the third blue dot, we have a keeper and just want to drop it into the exit box.

As muddgirl says, these blue-dot-finding-machines are called loops. Basically we're telling the robot/computer/whatever to repeat a process for each item of input. In this case, the "loop" consists of that conveyor belt that we're using to kick the robot back into the red-blue decision widget whenever we see a red dot. We're effectively looping through the input until we see a blue one, and then we're moving to a new loop (to look for more blue ones).

Does this help?

[on preview - sigh. I type too slow.]
posted by Two unicycles and some duct tape at 2:37 PM on June 29, 2010


Best answer: Pocams has the logic right. Just discard the defective robots by letting them fall to the floor. The conveyor belts work like this:

1. You can move a robot onto a conveyor belt from any direction, up/down/left/right. Doesn't matter.

2. The conveyor will will wait for the robot to move onto its square before taking effect.

3. After step 2, the conveyor will move the robot onto the next square in the direction it's pointing.

Red/blue switches work the same way. You can drop a robot onto one from any direction, it will decide what action to take, and then move the robot accordingly. If there is neither a red dot nor a blue one (i.e., no more dots at all in the sequence) it will move the robot in the direction of the gray arrow.

I should warn you though, this game's about to get HARD. I mean, ridiculously hard even for seasoned programmers. It was discussed recently on the Blue.

If you like this sort of game, I recommend Robozzle. It's great fun and another good mental workout. The learning curve for that one is a lot less steep than Manufactoria.
posted by The Winsome Parker Lewis at 2:37 PM on June 29, 2010


(Also, you can swap the colored arrows on switches by pressing space, which may help on the more cramped levels.)
posted by The Winsome Parker Lewis at 2:47 PM on June 29, 2010


Best answer: I solved it as shown here. I've included a highlighted diagram.

What you're actually designing is a finite state machine; each of my four coloured sections is a state; 'no blues seen', 'one blue seen', 'two blues seen' and 'three blues seen' (i.e. 'this robot is acceptable')

Then we have rules to transition between the states; as pocams says, we read a dot and if it's blue we advance a state (for example, from 'no blues seen' to 'one blue seen'), if it's red we don't advance a state, and if we're out of dots, we discard the robot (because we know it doesn't have three blue dots).
posted by Mike1024 at 3:08 PM on June 29, 2010


Response by poster: Thanks so much for all the helpful answers. I've only skimmed them so far, but will read through the information more carefully now and see what I can come up with. Also, I realize that this is a ridiculously difficult game, but I'm pretty insistent on at least figuring out the first jump in intensity level, and then seeing where I can go from there. Thanks again everyone for taking the time to explain these concepts in such detail.
posted by thegreatfleecircus at 3:48 PM on June 29, 2010


I just took a look at it and the biggest difficulty for me was realizing that you can approach a switch from the side with the black line. For some reason I assumed you could only approach it from either the red/blue/blank sides, so I kept having robots go back (since they were approaching from the red arrow side). I don't know if that's part of the problem you're having, but it might have something to do with why you're seeing them go in unexpected ways.

FWIW, it took me a good 10 minutes or so to figure out (and I am a programmer, lol) but once I figured that one out something clicked in my head and I was able to do the next 5 or so with no real difficulty. (Until the one that I just got to and said uh... and turned it off)
posted by cali59 at 3:51 PM on June 29, 2010


cali59: I had a big revelation about the opposite. I'd assumed only one side was the "input" side and the other three were all "outputs." It was liberating to realize I could toss stuff onto it from any side I wanted (and that's a big key to optimizing solutions for time).
posted by The Winsome Parker Lewis at 4:00 PM on June 29, 2010


Best answer: I'm pretty sure the minimal solution for this one is 8 tiles. Once you have it figured out from the clues above you may want to play around a little to try and optimize your solution since space will become an issue at some point.

Also worth noting: although everything enters moving down, the entrance is NOT a down conveyor - returning an item to the entrance fails the level.
posted by ecurtz at 5:19 PM on June 29, 2010


Earlier I recommended Robozzle, which is another great programming game. I just found Lightbot 2.0, which borrows a lot of Robozzle's concepts and might be more up your alley. The original light-Bot is also fun but much simpler than its sequel. Perhaps it would make a good stepping stone to learning the higher concepts? Don't give up after Manufactoria burns you out (I guarantee it'll happen)!
posted by The Winsome Parker Lewis at 8:38 AM on June 30, 2010


Response by poster: Thanks so much all. I was very close, but I somehow thought that one backward-facing conveyor belt piece was sufficient to successfully redirect the robot back through the directional device and let it continue on. Instead, I of course needed to make full loops instead. I am relieved that I wasn't so far off. Also, thanks for the recommendations of other games. I'll give them a whirl as well.
posted by thegreatfleecircus at 9:45 AM on June 30, 2010


Response by poster: Got through the following level painlessly. Success!
posted by thegreatfleecircus at 10:22 AM on June 30, 2010


thegreatfleecircus - I think you need to recheck. A backwards facing conveyor belt works just find to push the robot back into the directional device (at least, it worked when I did it). Agreeing with everyone who thinks that's a big difficulty jump.

This is neat. It's solo Roborally.
posted by It's Never Lurgi at 9:36 AM on July 2, 2010


« Older Kierkegaard n00b   |   Creepy Crawlies on my door Newer »
This thread is closed to new comments.