Genome validation
The domain model checks P, Y, B and G genes, preserves a rules version and returns a new genome when one slot is replaced.
A farming and genetics simulation where laboratory decisions influence plant growth, water consumption, yield and crop stability. The eight-gene genome and derived traits connect experimentation with the gameplay lifecycle.
Eight validated slots compose the wheat genome. Adjacent Y genes influence crop yield; B/G sequences activate an adaptation modifier. Trait calculations are deterministic and can be tested independently of the Unity scene.
The domain model checks P, Y, B and G genes, preserves a rules version and returns a new genome when one slot is replaced.
The wheat evaluator computes growth duration, yield, water demand, stability and visual variants from the eight-gene sequence.
Plots progress through Empty, Planted, Growing and Mature states; planting and harvest results are explicit enums and can be tested with an injected clock.
Unity scene controllers connect input, selection, scissor-arm animation and the trait panel to the genetics state without mixing DNA rules into UI scripts.
Progress is persisted to Unity’s application data directory. Failed reads do not overwrite invalid save files; backup recovery is a documented path.
Edit-mode NUnit tests cover genome immutability, trait evaluation, persistence, farm field operations and validation of DNA-laboratory workflows.
How this connects to gameplay: the genome is validated before the trait calculation is performed. The evaluator derives growth, yield and water requirements from the gene sequence. A farm plot moves between lifecycle states, so a harvest request should only succeed when its state allows it. Keeping the calculation in the C# domain layer lets edit-mode tests check outcomes without requiring the Unity scene to run.
The game-vision and genetics specifications define a deliberately small Android prototype: one wheat crop, a fictional eight-segment genome and reproducible experimentation.
Four colour-coded game genes represent Growth, Yield, Drought Resistance and Stability. The schema and rules version travel with a seed; these are fictional mechanics, not a real CRISPR or biological DNA model.
The same genome, crop data, rules version and environment should produce the same base traits. Balancing should expose trade-offs such as water demand versus yield, not arbitrary rarity rolls.
The roadmap targets a scissor-based editor, one test pot, visible growth and harvest results, seed catalogue and a simple offline selling loop on Android.
Farm plots, a fictional newspaper marketplace and economy tuning belong to later sprints. Asynchronous farms, visits and player trade are explicitly deferred.
Documentation: GitHub repository / project specification. The content describes documented behaviour or plans; deployment readiness is not inferred.
Static visualizations of documented systems, not screenshots from a released application.
A proposed editor presents individual positions in the genome; the code validates the replacement and evaluates crop traits.
Derived crop traits can be displayed together so players compare harvest, growth time and water use before planting.
Farm plots can expose their lifecycle explicitly so planting, update and harvest actions align with the tested state machine used in the domain layer.
The original genome stays unchanged; replacement returns a new validated instance.
public Genome Replace(int index, char gene)
{
if (index < 0 || index >= Length)
throw new ArgumentOutOfRangeException(nameof(index));
ValidateGene(gene);
char[] edited = Sequence.ToCharArray();
edited[index] = gene;
return new Genome(new string(edited), RulesVersion);
}
Adjacent gene sequences activate bonuses; the resulting crop characteristics are deterministic.
bool highYield = sequence.Contains("YY");
bool adaptation = sequence.Contains("BG") || sequence.Contains("GB");
int time = Math.Max(1, 60 - 4 * purple + 3 * yellow + 2 * blue + (highYield ? 3 : 0));
int harvest = Math.Max(1, 4 + yellow - purple / 2 + (highYield ? 1 : 0));
int water = Math.Max(1, 6 + yellow - blue - (adaptation ? 1 : 0));
NUnit checks that changing one gene does not mutate the original sequence.
var original = new Genome("PYBGPYBG");
Genome edited = original.Replace(2, 'Y');
Assert.That(original.Sequence, Is.EqualTo("PYBGPYBG"));
Assert.That(edited.Sequence, Is.EqualTo("PYYGPYBG"));
These excerpts are from the existing Unity/C# codebase. The immutable edit returns a new genome, keeping the source instance unchanged. The calculation example derives traits from the validated sequence, while the tests illustrate how rules can be checked independently of runtime rendering. A code excerpt alone does not establish that an APK or desktop release is available.
Code samples are excerpts or documented illustrations; surrounding project files, configuration and dependencies may be required to compile or run them.
This is a team project hosted in a collaborator-owned repository. The connected repository’s commit history identifies the account below.
The Unity project has a real codebase and edit-mode tests. No public APK, desktop build or interactive browser deployment has been supplied for this portfolio.
← Personal Projects