(* The hardest part of this submission was figuring out how to get rid of the five mercury pulled to figure out what the metal was. I eventually had to pull them off with the metal atom. *)
let element_duplicator x =
	while true do
		let s = new_atom (saltlike salt) in
		duplicate x s
		deposit s
	done;;
let project_or_bond x =
	let m = new_atom mercury in
	project m x
	bond m x;;
let metal_duplicator x =
	project_or_bond x
	project_or_bond x
	project_or_bond x
	project_or_bond x
	project_or_bond x
	while true do
		let l = new_atom (metal lead) in
		let f a = 
			let m = atom_wheel mercury in
			bond a m
			if connected x m then
				debond a m
				project m l
			else () in
		List.iter f (neighbors x)
		deposit l
	done;;
let duplicator x =
	match type x with
	| saltlike e => element_duplicator x
	| metal r => metal_duplicator x
	| mercury | vitae | mors => metal_duplicator x (* treated as gold *);;
(* It would be possible to treat mercury differently, but it'd be difficult. Vitae and mors are indistinguishable from gold without RM (gold splittable), TA (though it might take two of the same to know they're not gold), or UE (Au+3Hg → U). *)