γ. Attributes, Ordering, & Tiebreakers - Primary attributes are eponymous with the table name, and are primary objectives for each solution listed. The secondary attribute is the same for every table: stability. If a solution is uniquely optimal for its associated primary attribute but will crash after 5 cycles, then a secondary solution that optimizes the primary attribute in the space of solutions that do not exhibit that flaw will also be listed. The tertiary attribute is used solely for tiebreakers. Attributes for the 3 different kinds of tables are as follows:
Every level consists of atom generators which generate an endless supply of atoms and a big dish in the upper middle which the assembled items needs to be placed in. The objective of the game is to assemble 5 of the target items and dump them one by one in the circular dish.
2. The Atoms
The Three Primes
Salt - transmutes to mercury; used in duplication; product of calcination Mercury - transmutes to sulfur; used in projection Sulfur - transmutes to salt
The Four Elements
Fire - can be duplicated with salt, can be calcinated into salt Water - can be duplicated with salt, can be calcinated into salt Earth - can be duplicated with salt, can be calcinated into salt Air - can be duplicated with salt, can be calcinated into salt
The Six Planetary Metals
Gold - inert Silver - upgrades to gold Copper - upgrades to silver Iron - upgrades to copper Tin - upgrades to iron Lead - upgrades to tin
Manipulator - The main tool of the game. Moves and rotates stuff around.
Glyph of Binding - The most annoying tool of the game. Binds 2 adjacent atoms together.
Glyph of Transmutation - Transmutes the 3 primes in a circular fashion. No effect on other atoms.
Glyph of Calcination - Transmutes any elemental atom into a salt atom. No effect on other atoms.
Glyph of Duplication - Duplicates an elemental atom using up a salt atom. No effect on other atoms.
Glyph of Projection - Given a non-gold planetary metal atom and a mercury atom, "upgrades" the planetary metal atom. No effect on other atoms.
4. Programming Notation
That format of the save-load feature is as follows:
id - The type of the tool.
m - Manipulator
b - Glyph of Binding
t - Glyph of Transmutation
c - Glyph of Calcination
d - Glyph of Duplication
p - Glyph of Projection
x, y - Coordinates of the tool.
Both range from 0 to 14.
rotation - When tool is manipulator, this dictates the initial angular position.
Four possible values: 0, 90, 180, 270.
extension - When tool is manipulator, this dictates the initial length of arm minus one.
Three possible values: 1, 2, 3.
program - When tool is manipulator, this dictates the program that the arm will follow, repeatedly.
r - rotate arm clockwise
l - rotate arm counter-clockwise
d - retract arm
u - extend arm
1 - rotate clamp clockwise
2 - rotate clamp counter-clockwise
o - open clamp, releases object
c - close clamp, grabs object
w - wait
j - marker for end of nonrepeating initial commands,
note that this marker will take up an iteration by itself
5. Mechanics & Timing
All atom generators experience a cool-down period of 1 turn after an item has taken from it. During this cool-down the spot where the generator is is considered empty. Any atom can pass through it and even occupy the position altogether. during this kind of occupation, the atom generator will actually not produce an atom. See example (load in level 2):
Atom compounds need 1 turn of clearance to disappear into the tray. On the surface this seems to imply that you can finish 1 compound per turn, but that is not so. This one turn of clearance in fact must occur not at the turn where the correct and correctly oriented compound is fully inside the tray, but at the moment where such a compound is dropped into it. This creates a de facto throughput limit of 1 finished compound every 2 turns, because one would need to move the next compound into position the next turn, before dropping it. However, take note that during the turn where the compound is only in position and not yet dropped, the tray need not be clear of other stuff. Also, the receiving tray does not care if the finished compound is actually part of a larger compound, just as long as only the correct compound is inside the tray. It will truncate the accepted portion off, leaving everything else behind.
Glyph of Binding
Although usually linked atoms cannot be held by two manipulators at the same time, this rule is relaxed when the manipulators are holding stuff on opposite ends of a glyph of binding. However, whenever this happens, one turn must be used up where at least one of the manipulators drop the compound (i.e.: one manipulator cannot just rotate away while the other manipulator drops in the same turn). Demonstration code (load in level 2):
Note that the failure occurs at turn 7.
Glyph of Transmutation, Calcination & Duplication
Note that atoms do not need to be dropped into them for it to activate.
Glyph of Duplication
Note that given the current levels this glyph is almost completely useless.
Glyph of Projection
The metal to be projected does not need to be dropped, but the mercury does. If the metal has been dropped, the upgraded metal can be picked up the same turn the mercury is dropped in. See example (this is my soln to level 12):
commands(symbols) - The counter for symbols in the highscores list only counts the number of commands given to manipulators. If symbols is what you want to optimize, the rest of this section of the guide will not be helpful to you, since it is mostly about squeezing an extra move out of various situations. For those of us who don't think bubblesort is as beautiful as mergesort, read on!
total time(cycles) - The name of the counter in the highscores list is given as "cycles", an unfortunately misleading nomenclature. This this guide it will be referred to as "total time" or "total turns".
throughput(speed) - The number of objects completed per turn after the machine is all loaded up.
path length - The number of turn it takes to assemble 1 object from scratch, disregarding all other objects.
period - The number of turns it takes for all arm positions to repeat.
2. Time Formula
To optimize time, it is critical to know what is taking up the time. Fortunately, that is easy:
total time = path length + 4 / throughput
The critical part of this equation is clearly throughput, since if your machine takes 1 less turn to switch from one object to the next, you've just saved yourself 4 turns worth of total time. The strategy is therefore: first optimize throughput, then try to shorten the path length without impacting the throughput.
Units, as used in this guide, denote groups of manipulators which work together as if one object. Units are the building blocks of your ultimate time solutions to Codex of Alchemical Engineering.
Units of Throughput 1/2
The Double Feeder
This is the most basic of units. It ensures that an atom gets transported diagonally or orthogonally every 2 turns. The following example contains both double feeders: a diagonal version that transports atoms from the generator to the right side of the glyph of binding, and a horizontal version that transports atoms across the glyph of binding (load level 1):
In the example for the compound double feeder, the machinery that transports stuff from the glyph of binding to the finish tray is the triple feeder.
The 4 manipulator mechanism that loads stuff onto the glyph of calcination here is the octopus unit. The octopus can use space that is outside of the table, but only on the right and bottom sides (see bug 1 below). Load level 9 to see the following:
Another modification to the octopus, this time with the output placed not directly opposite of the input. Consequently, the path of the atoms going through different arms of it take different amounts of time. Load level 8 to see:
In the expansion, several levels have atom generators placed conveniently 3 spaces apart. This arrangement almost begs for smacking 2 octopi mechanisms together to crate this. Load in level M13 to see:
Preparations: General outlines you need to keep in mind before even attempting to optimize for time.
α. Trace Atoms
Plan out which atom generator will be responsible for which portions of the final product BEFORE you begin.
Sometimes during procedure α above you will need to use an atom from one end of the lattice on the other side for duplication purposes. Do that first. In the following example in level M14, α and β are both demonstrated:
When the compound is simple enough, when there is enough free space, when there is an equitable number of atom generators, it can be possible to build 2 (and in rare instances, 3) concurrent lines of production. Having multiple production lines gives 2 separate benefits. It allows for each longer period manipulators to mimic the throughput of shorter period manipulators, but retain its ability to make more moves per manipulator. Also, it allows for the selective speed-up of lanes to take advantage of the fact that the production quota is odd. This second benefit will be the central issue of ι. The following example in level 2 has three concurrent lines of production pushed through the single glyph in the middle:
Construction: Stuff you need to check for while building your optimal time solution.
δ. Prefer Arm Rotation
Unless you have multiple binding/transmuting operations to perform per glyph, it is usually inefficient to use too many of either sliding or clamp rotation. Try to always plan your moves between glyphs in terms of arm rotations.
ε. Maximize Work Per Manipulator
Every time you pass from one manipulator to the next you have to use up a turn
ζ. Cluster Manipulators
The large clearance requirements of glyphs means that manipulator positions should be based around them. That's the paradigm behind all those whole octopus mechanism variations.
η. Stagger Arrival Times
Things do not need to arrive at glyphs at the same time. While this may sound trivial, its implications are not. The following example in level M1 as well as the first set of examples for (ι. Parity Spread) both demonstrate this:
Post-Production: Ways you can improve your already existing near-optimal solutions.
ι. Parity Spread
Five is odd. When there are multiple lanes of production it is obvious that shortening the path length of the odd lane reduces total time by the same amount. Extend that further, even when there is only one single line of production, it is sometimes possible to speed up the odd numbered compounds passing through the machine, even if at the cost of the even numbered compounds. In the next three examples on level 9, the odd lane of an already max-throughput machine is progressively sped up by aligning glyphs around the manipulator in the middle:
Five is also congruent to two modulo three, enabling the possibility of a "ternary spread". Section λ below showcases just such an example. In that case, the third lane isn't actually slowed, but completely fails on its second approach.
κ. Path of Final Atom
So your solution already achieved optimal throughput. It might be big and unwieldy, requiring many many atoms to build/refine. How do you optimize the path length part of the equation? Or, alternatively, how do you know if your solution is absolutely optimal? Is there a proof?
Luckily, in some circumstances, there could be such an analysis. This is done by tracing the path of the final atom involved in the production of a compound. When such a path is optimal, the solution is definitively optimal. However, when such a path is non-optimal, there is no good way to determine if the solution using it is optimal or not except by trying (and perhaps failing) all possible ways to optimize that path. At the least, it yields a methodical approach to path length optimization. The 4 following examples are all solutions of M6 at the maximum possible throughput of 1/20:
Observe that in each incremental solution, more incremental effort is made to front-load the bonding moves such that the compound has as clear a path as possible to the tray from the final refinement procedure. As the perfect is the enemy of the good, the improvement 106 cycles to 105 cycles probably took a lot more effort than the improvement from 116 cycles to 108 cycles.
As you may have guessed, I picked this M6 as an example because that 105 cycle solution by Cypher2100 is indeed completely optimal. A 104 solution would have required another glyph of projection at (9,6) and more juggling around than the lattice has room for. There is no easy way to optimize path length as of now. It is an art.
λ. Short Term Planning
In very rare instances it is possible to sacrifice long term viability for an extra cycle. The example below (load in level 3) is designed to fail, but not before dumping enough finished compounds into the tray in record time:
Atoms can be relayed off the right and bottom walls of the area, but not the top and the left. When any atom is dropped off the top or left walls, it cannot be picked up again, but will still collide with other atoms. The origin of this bug seems obvious: the developer implemented bound checking on some functions but not others, and only implemented them on the issue of non-negativity. The right bound and bottom bound do not exist for atoms apparently. Here is a demonstration of the bug on Level 15:
When an atom compound is dropped with some parts of it inside the completion tray and some parts outside, with the portion inside coincidentally fitting the requirements of the level, the compound is truncated. The accepted portion of the compound disappears into the tray while the rest dangles outside. Load level 1 to see:
Sometimes the atoms of a large compound (especially a doubly jointed one such as the finished product of level 14) will collide with each other when the compound is moved. This bug is not easily reproducible but does seem to happen more when swung with a manipulator at max length with the center of the compound as far away from the center of rotation as possible. At this point I suspect that this could be caused by the physics engine possibly being stepwise and detecting a collision between an atom’s previous position and the current position of the atom behind it.
Bug has been patched since CoAE 1.05 and does not appear in CoAE:MO.
This very serious bug deals with the game loading a command list with an impossible command. In this case, the initial length of the manipulator is given as 11+1=12 units long. The game does check for impossible lengths, but unfortunately only after the first turn. Therefore, the arm was able to grab the atom in turn 1 from all the way up there, then immediately drop it into the tray. I suspect most of the seemingly impossible high scores on the first few levels are done with that trick. Load example in level 1:
Close calls sometimes “almost dodge” each other. The cause for this is probably similar to that of bug #4. The current optimal time solution for level 14 suffers from this bug too. Run this simulation until collision on level 1:
It is possible to manually place arms in illegal positions by the following procedure:
a. Place arm in a corner.
b. Pick up and hold arm.
c. While held, rotate arm a few times.
d. Place arm (almost anywhere) facing (almost any position). The boundaries of generators, the completion dish, all glyphs, even the stupid information square no longer apply. Still, no part of the arm can be outside of the screen.
These impossible arm positions cannot be loaded from text, so naturally they cannot be used for any of the optimal solution tables.
Aqua Vitae (Level 1) Arm Length Load Exploit (by catpaw)
In this solution, impossible arm length loading (bug #5) is exploited. It is actually faster than than the regular optimal time, but since it is clearly unintended, it is here instead of the high score lists.
Sal Ammoniac (Level 2) Arm Length Load Crash (by nihilisz)
What is the absolutely quickest and absolutely most efficient way you can crash? This machine uses 1 manipulator, using a total symbol count of 1, generating a crash before it reaches cycle 1. This also uses the arm length loading (bug #5).
Philosopher’s Stone (Level 14) with Duplication Glyph (by nihilisz)
I thought it was pretty slick until I saw Fartan’s solution. But hey, this is still a pretty fast and so far the only sensible use of the duplication glyph in the original levels.
??? (Level 15) with Industrial Waste (by ThirdParty)
Industrial waste is usually not very impressive, as one can simply add it to almost any existing solution. However, this one is actually an admirable attempt at minimizing symbols, within which the production and removal of industrial waste is a necessarily integral part of the machine.
Here is an optimal time solution for Level 11: Black Powder. I’m pretty sure it can still be improved, at least by a cycle or two; I had to waste some steps to avoid collisions in the center of the page.
I have…I had another bug for you. Run this on level 6, aqua fortis:
Very rarely (one in thirty tries or more?) the two atoms will collide when coming into the bottom binder for the first try, and the rest of the time they weren’t. I say had a bug because I remember that when I first built it they collided closer to half the time, so he must have done something to fix it (if not completely)
The bug you found does happen a lot, but mos of the time I thought it was lag. After I tried to run it without any lag whatsoever and it still crashed, I guess it now classified as a bug. Also, I revised your example a bit such that the simulation will not terminate until the bug causes a collision:
Awesome! I tried doing it double sided too but wasn’t very successful at it. I guess this is our first non-integer reciprocal throughput optimal time solution, and the first solution with sub-optimal throughput to actually beat an existing solution with optimal throughput. But there is one caveat: it clearly will crash in the long term if the number of compounds to be constructed is more than 5.
I rather disliked the instability afforded by the 2 differently timed chains, such that it would crash if the simulation went on to produce more compounds. So, I re-timed some stuff and synchronized them, yielding a throughput of 1/4 again:
11: Black Powder – 108 Symbols, 30 Cycles, Throughput 1/4
Ok, let’s try a hand at cycle optimising… Level 9, Aqua Regia 56 31 4 15 4
There’s a 30 cycle high score though….
And that’s much cleaner than my old solution. It doesn’t look like it can be improved upon much though. I fail to see where a cycle can be shaved off. Every move that the most processed atom from the left makes already went to some glyph.
Don’t worry about the high scores table. Many of the high scores were glitched using the methods I mentioned in the bugs section.
How about some new optimisation criteria to freshen this up?
Here’s a new, real-world score criterion: long-term efficiency.
The way I figure it, the measure of efficiency is throughput per unit energy.
If we equate energy expenditure to the number of manipulators, then the criterion (for maximisation) is
(throughput) / (no. of manipulators)
Another example criterion, this one for minimisation, is time * commands
@lackofcheese: I have thought about some kind of combination criteria too, but you’ve put it down so it makes sense ;) Might be better to take commands / throughput, as time is path length + 4 / throughput, and the initial path length matters less in the long run.
@nihilisz: nice job optimising! What can you do with Level 15: ??? 126 75 12 27 12
I can’t seem to get it under 75 cycles, but high scores are in the 60’s. That can’t be just glitches…