[img_right]
http://bisqwit.iki.fi/kala/snap/manufactoria-officers-machine2.png[/img_right]Sleeping over the night, I thought of an optimization to
Officers! that allows me to reduce the number of functional components in the scene. However, as it turned out, the change was over-compensated by the explosion in the number of conveyer belts needed.
You need tons of conveyer belts if you want two ends of the branch to go in same target. Bleh. I hate this game. Result shown on the right.
?lvl=13&code=c12:11f3;c12:12f3;g12:2f3;c12:3f3;c13:2f0;q14:2f1;b14:3f0;q14:4f1;p15:2f0;r15:3f1;y15:4f1;r10:4f2;c11:4f2;c11:5f3;c12:4f3;p12:5f7;c14:5f1;i13:3f2;y13:4f1;c13:5f2;c10:5f1;c12:10f3;c10:6f1;c10:7f1;c10:8f1;c11:6f2;b11:7f3;i11:8f1;c11:9f2;c12:6f3;q12:7f7;c12:8f0;q12:9f7;b13:7f3;r13:8f3;p13:9f4;
Here is the description of the algorithm used above. This is all
spoilers, of course.
It is described as a substring replacing engine resembling regular expressions.
1 is blue
0 is red
$ means end, indicated by green symbol
Y means 2 ("carry", indicated by yellow symbol).
x means red or blue (not Y or $)
vertical line indicates a point of entry (top: label; bottom: actions)
begin
|
$ loop
| _
0x --> 0 <loop> \_ transcribe until $/Y
1x --> 1 <loop> _/
0$ --> 1 <end> --trivial +1 and done.
1$ --> Y <begin> --make carry
0Y --> 10 <red-only transcriber> <eat $> <end> --carry mixed safely
1Y --> Y0 <red-only transcriber> <eat $> <begin> --propagate carry
$ --> 1 <end> --string is empty
Y --> 10 <red-only transcriber> <eat $> <end> --string begins with Y; add 1 decimal
The previous version of this parsed "x" by using the red-blue branch (which eats the symbol), necessiting complicated jumps directly to the second part of the loop. In this version, the "x" condition is detected as the default branch of the yellow-green branch.
[img_right]
http://bisqwit.iki.fi/kala/snap/manufactoria-officers-machine3.png[/img_right]Now as I think of it (again, teaching is the best way to learn), I think it can be rewritten by doing the parsing in two parts. This allows to discard checking for green value in loop2, because now the main loop is all about getting rid of carry. We can assume that as long as the loop runs, carry exists:
begin
|
$0 loop
| _
0$ --> 1 <end> \
0x --> 0 <loop> \_ if string ends in red, trivial +1 and done.
1x --> 1 <loop> / if it ends in blue, propagate carry as below.
1$ --> Y begin2 _/
|
$ loop2
| _
0x --> 0 <loop2> \_ transcribe until $/Y
1x --> 1 <loop2> _/
0Y --> 10 <red-only transcriber> <eat $> <end> --carry mixed safely
1Y --> Y0 <red-only transcriber> <eat $> <begin2> --propagate carry
// Y --> 10 <red-only transcriber> <eat $> <end> --string begins with Y; add 1 decimal (this rule is not needed because of explicitly added leading zero in the beginning)
Result shown on the right.
?lvl=13&code=g12:2f3;p7:5f6;r7:6f1;y7:7f1;q8:5f5;b8:6f2;q8:7f5;y9:4f3;g9:5f3;c9:6f3;p9:7f3;b10:3f2;q10:4f1;r10:6f0;q10:7f1;c11:3f3;p11:4f5;r12:3f0;q12:4f5;c12:9f3;c12:10f3;c12:11f3;c13:5f3;c13:6f3;c13:7f3;q12:12f3;r11:6f2;p12:6f7;c12:8f3;c13:8f0;b13:4f3;q12:7f6;b11:7f1;
It is better than the second version (above), but still not as good as the attempt in my previous post. Hmpf.
Next I consider this change in order to merge all the red-only transcribers together, taking advantage of the fact that the main loop is all about carry removal; as long as a carry is found, the loop is not complete. If EOF marker (green) is found, it is to be terminated. But reintroducing the green checks actually makes everything worse, again:
[img_right]
http://bisqwit.iki.fi/kala/snap/manufactoria-officers-machine4.png[/img_right]
begin
|
$ loop
| _
0$ --> 1 <end> \
0x --> 0 <loop> \_ if string ends in red, trivial +1 and done.
1x --> 1 <loop> / if it ends in blue, propagate carry as below.
1$ --> Y begin2 _/
|
$ loop2
| _
0x --> 0 <loop2> \_ transcribe until $/Y
1x --> 1 <loop2> _/
0Y --> 10 <red-only transcriber> <eat $> <begin2> --carry mixed safely
1Y --> Y0 <red-only transcriber> <eat $> <begin2> --propagate carry
Y --> 10 <red-only transcriber> <eat $> <begin2> --string begins with Y
0$ --> 0 <end>
1$ --> 1 <end>
?lvl=13&code=q11:9f0;g12:5f3;i12:6f7;c12:8f3;p12:9f3;q13:9f6;y11:7f1;b13:7f1;i11:8f4;i13:8f0;q12:7f7;c11:10f2;b12:10f3;c12:11f3;i13:10f6;r13:11f0;c14:10f0;c12:12f3;c15:4f3;c15:5f3;c15:6f3;c15:7f3;c15:8f3;c15:9f3;c15:10f0;b10:8f2;r14:8f0;c10:9f1;c14:9f1;y11:4f3;b12:3f2;q12:4f1;g13:2f3;c13:3f3;p13:4f5;r14:3f0;q14:4f5;c12:2f2;c11:5f2;c11:6f2;q13:5f1;p14:5f0;r14:6f1;c13:6f2;
[img_right]
http://bisqwit.iki.fi/kala/snap/manufactoria-officers-machine3b.png[/img_right]EDIT: Thanks for the
Academics! guide Pointless Boy. I could not figure out the merging those two types of repeaters.
But at least I know you can remove the green-eater before the last repeater in the bottom of your final solution. Seeing as how the yellow-eater that follows it does the very same thing. It does not reduce the number of parts, though. Annoying conveyer belts.
EDIT 2: Conveyer belts can sometimes be substituted with other items. Here's
Officers! in 32 parts. Not something to be proud of, though! It is a variant of version 3.
?lvl=13&code=g12:2f3;p7:5f6;r7:6f1;y7:7f1;q8:5f5;b8:6f2;q8:7f5;y9:4f3;g9:5f3;c9:6f3;p9:7f3;b10:3f2;q10:4f1;r10:6f0;q10:7f1;c11:3f3;r12:3f0;q12:4f5;r11:6f2;p12:6f7;b13:4f3;b11:7f1;q12:8f3;p11:4f3;q12:9f3;q12:12f3;q12:11f3;q12:10f3;q13:5f3;q13:6f3;q12:7f3;q13:7f0;