# Research:Weigh

Using a combination of uncut gems fragments and cigarette papers it is possible to determine the weight of an item to two decimal places, or if 10 instances of the item are available, to 3 decimal places.

Item | Weight [g] |
---|---|

Small cigarette paper | 0.1 |

Large cigarette paper | 0.2 |

Gem Fragment | Weight [g] |
---|---|

Sapphire | 2.91 |

Ruby | 2.92 |

Ankhstone | 1.93 |

Malachite | 2.84 |

Tiger's Eye | 1.95 |

Tourmaline | 2.26 |

Turquoise | 1.97 |

Aquamarine | 1.98 |

Emerald | 1.99 |

In general, the goal is to get an exact reading from the AoA jewellery balance by combining cigarette papers (for first decimal) and gem fragments (second decimal). If the balance returns an exact reading (i.e. not a range) subract the weight of the auxiliary items from the reported value to the item weight.

For items with a weight having one significant decimal place one combination of item + 0..9 small papers should result in an accurate reading. For items with two significant decimal places, one combination of item + gem fragment + 0..9 small papers should result in an accurate reading.

The approach is to figure out the first decimal place with item + papers, then use the gems to figure out the second decimal place; binary algorithm, start with a Tiger's eye fragment (1.95g) and if the range switch happens with the same number of papers, try with an ankhstone (1.93g) or with a turquoise (1.97g) if not. Until the balance returns an exact reading.

## Aliases

Example aliases to get the weight of an item to two decimal places.

alias m0 get small paper from box; get gems&small papers; weigh gems&papers on balance; $*$ alias mx get $*$ from box; get item & gems & papers; weigh gems on balance; weigh gems & papers on balance;put $*$ into box; drop item; $*$ alias m1 mx 2.91; $*$ alias m2 mx 2.92; $*$ alias m3 mx 1.93; $*$ alias m4 mx 2.84; $*$ alias m5 mx 1.95; $*$ alias m6 mx 2.26; $*$ alias m7 mx 1.97; $*$ alias m8 mx 1.98; $*$ alias m9 mx 1.99; $*$

The aliases have to be called in the smithy of the AoA and require 10 small cigarette papers and one piece of each of the gems fragments listed above, identified by their weight.

Identify the item to weigh as "item". Abort whenever an exact weight is reported, continue if a weight range is reported.

To determine the first decimal, repeatedly call alias m0 until the reported weight of the object plus papers is higher than that of the object alone.

To determine the second decimal, perform a binary search using the cigarette papers from before and one of the gem fragments with a known weight. Whenever the reported weight of item + gem fragment is lower or equal to the weight of item + gem fragment + papers, try again with the alias for the middle of the lower range, and with the alias of the upper range if not:

Start with alias m5. If the weight of the object plus gem is smaller or equal to the weight of the object plus gem and papers call m3 next, otherwise call m7. Based on the result continue with m2, m4, m6, or m8 and in a next step with m1 or m9. When an exact weight is shown, subtract the weight of the papers and the weight of the gem to get the item weight.

Haven't found good items for 0.04 and 0.06 yet; for m4 add one paper before calling the alias, for m6 remove 3 papers before calling the alias.