10
\$\begingroup\$

This puzzle is the next in my series of Manufactoria challenges.

Background

Manufactoria is a game / two-dimensional programming language. The player must create programs that will manipulate a queue to arrive at the desired output. It is easy to learn but hard to master, so it lends itself to creating a wide variety of challenges. If you don't know what I am talking about, I advise that you play the first few tutorial levels of the game.

Challenge

Your challenge is to create a machine that will return the very last element of the input string. To make this even more challenging, the input string can be any combination of all four colors.

The official custom level to be used is found here:

http://pleasingfungus.com/Manufactoria/?ctm=Last_in_Line!;IN:_a_series_of_colors_OUT:_the_very_last_color;byrgyrbyrrgry:y|bbrrbryyyrrbr:r|ggryybrryr:r|b:b|:|gyrbrygbrygbyrb:b|brbrbryyrygbrg:g|rrrrrrrrrr:r;13;3;0;

This week's challenge is mostly focused on the idea of compression. I chose this challenge to require a huge mess of conveyor belts. The fact that all four colors appear in the input means that it is very hard to store information.

Although I did not attempt compression, my first working prototype had 114 parts and fit into the 13x13 space with almost no room to spare.

Scoring

The goal of this challenge is to use a few parts as possible. The score is the number of parts placed, and the lowest score wins.

Although there are only 8 test cases, your creation should be able to theoretically function under any test case. The test cases provided are for debugging purposes.

Examples

in:  byrgyrbyrrgry
out: y
in:  ggryybrryr
out: r
in:         #don't you love degenerate cases?
out:
in:  gyrbrygbrygbyrb
out: b
\$\endgroup\$
6
\$\begingroup\$

65 parts

enter image description here To be honest I couldn't even come up with the idea of putting pairs of readers directly against each other until I saw it in the already-posted solutions. But later I started to come up with a lot of optimization tricks.

Link

\$\endgroup\$
  • \$\begingroup\$ ...you can put conveyor belts on top of eachother? \$\endgroup\$ – SuperJedi224 Apr 15 '16 at 13:58
4
\$\begingroup\$

99 90 84 81 Parts

last in line - further optimizations

Yes - this is a mess of conveyer belts. But finally considerably less than 100 parts - also thanks to Volatility.

http://pleasingfungus.com/Manufactoria/?lvl=33&code=p12:9f3;i12:2f1;c11:9f0;c9:8f2;c10:8f2;i11:8f7;i12:8f5;i12:4f5;i12:5f5;c12:6f3;i12:7f1;i13:9f3;c14:8f3;i13:8f3;q12:3f3;q15:4f7;p15:5f7;c14:5f3;i14:6f1;i14:7f1;i13:7f0;i13:6f0;i13:5f4;c11:7f3;c10:7f2;c15:7f0;c16:5f3;c16:7f0;c11:2f3;c13:2f0;c14:2f0;c15:2f0;c16:3f1;c16:4f1;c16:2f0;c17:4f0;c17:5f1;c17:7f1;c17:8f1;c8:8f1;c8:7f1;c8:5f1;c8:4f2;c16:6f3;c17:6f1;g15:6f0;c8:6f1;c8:9f1;c8:10f1;c9:9f1;c9:10f0;p10:9f7;q10:10f3;b10:11f2;c11:10f2;c11:11f2;i12:10f5;c12:11f3;c13:10f1;c13:11f0;c16:10f2;c17:9f1;c17:10f1;c12:12f3;p14:9f7;q14:10f7;r14:11f0;c15:9f1;c15:8f1;c15:10f2;c11:3f3;q11:4f3;p11:5f3;y11:6f2;c10:5f3;c10:6f3;c9:4f2;c10:4f2;c13:3f3;c13:4f2;c14:4f2;&ctm=Last_in_Line!;IN:_a_series_of_colors_OUT:_the_very_last_color;byrgyrbyrrgry:y|bbrrbryyyrrbr:r|ggryybrryr:r|b:b|:|gyrbrygbrygbyrb:b|brbrbryyrygbrg:g|rrrrrrrrrr:r;13;3;0;

\$\endgroup\$
  • \$\begingroup\$ A little rearranging of conveyor belts reduced this down to 81 parts. See here. Also, changing the colours around seems to make it faster (although it really doesn't matter) from 6:23 to 5:38. See this paste for the URL. \$\endgroup\$ – Volatility Jun 15 '13 at 7:14
  • \$\begingroup\$ @Volatility Thank you for the 3 parts. The seems faster totally depends on the test cases, so it really doesn't matter ;-) \$\endgroup\$ – Howard Jun 15 '13 at 7:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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