Guide

Xenogenetics Survey: Find the Alien Samples

Solve the Xenogenetics Survey contract in Code: Terraform: compare 1,000 collected samples against Earth's 50-sequence reference and transmit only the samples that do not match.

Community-verified contract solution · checked 2026-09-30

Code: Terraform official screenshot showing a resource listing screen where contract samples appear
Guide artwork — not an in-game screenshot.
Advertisement

Quick answer

Earth gives you 50 known gene sequences; the contract carries 1,000 collected samples. Transmit the samples that are NOT in the Earth reference set: convert the reference to a Python set for fast membership checks, filter the samples with a list comprehension, and send the resulting list with the contract ID. Do not print the full result - large prints hit the editor's 10,000-character limit.

Checked September 30, 2026. Sources: the contract’s own interface and a community solution verified across Steam discussions and independently recorded footage. Read your own contract text first - a build update can change details.

The matching problem

The Xenogenetics Survey is the first contract that is really about sets, not locks or sensors. Earth hands you a reference: 50 known Earth gene sequences. The contract carries 1,000 collected DNA samples, and your job is to transmit only the samples that do not appear in the Earth reference set - the ones Earth has never seen.

That is a membership-check problem at scale. Comparing 1,000 samples against 50 references one by one is 50,000 comparisons; converting the reference into a Python set turns each check into a single fast lookup. This is the same instinct as the pressure sensor’s modulo trick - pick the data structure that makes the answer obvious.

The script

This is the solution pattern shared across Steam discussions and community guides:

c = self.contract

earth = set(c.earth_ref)

alien_list = [
    sample
    for sample in c.samples
    if sample not in earth
]

transmitter = get_component("transmitter")
transmitter.connect("earth")
transmitter.transmit(c.id, alien_list)

How it works

  • set(c.earth_ref) rebuilds the 50 Earth sequences as a set. Membership checks against a set do not scan the list - that is what keeps 1,000 lookups instant.
  • The list comprehension walks every sample once and keeps the ones not in the set: those are your alien sequences.
  • The result goes out as a single list under the contract ID - the same key/value shape as every other contract transmission.

The 10,000-character trap

Do not print the full alien_list while testing. The editor stops scripts whose output is too large, with an error like:

string length 10,001 exceeds the current limit of 10,000

A thousand unknown sequences are far too much text for the console. If you want to eyeball the result while developing, print only the count:

print("Alien count:", len(alien_list))

That line is optional - the contract itself only needs the transmitted list.

Common mistakes

  • Running the comparison the wrong way round and sending samples that are in the reference set. The contract wants the ones that are not.
  • Printing the whole list and tripping the output limit. Print len(alien_list) instead.
  • Rebuilding the set inside a loop. Convert earth_ref once, before iterating.
  • Sending the contract object instead of the ID string - the transmitter expects c.id / self.contract.id.
  • Assuming the samples and references are sorted or paired by index. They are independent collections; only membership matters.

After the survey

The survey pays credits like every contract, and it teaches the pair of patterns the later data contracts repeat: reference data into a set, results into a list. If you have not done the relay yet, the Orbital Relay Hack is the other half of this skill set - it is about a lock that reports its own state, where this one is about data that hides among data.

Evidence and version notes

The 50-sequence reference, the 1,000-sample payload, the set-based filter and the output-limit error text are from the contract itself and recorded playthroughs shared in the community (Steam discussions and fan guides, September 2026). Build 0.1.28 (September 24, 2026) did not change contract interfaces. If your build’s contract text differs, your build’s docs win. Related pages: the component reference for the transmitter row, and the common errors reference.