This repository was archived by the owner on Apr 25, 2026. It is now read-only.
feat: Safe Breeding View#1
Merged
frankieg33 merged 4 commits intofrankieg33:mainfrom Mar 3, 2026
Merged
Conversation
bcc44c5 to
6b082bf
Compare
Contributor
Author
|
@frankieg33 I've added a fix for the gender assignment logic in this PR just now |
byronaltice
referenced
this pull request
in byronaltice/MewgenicsBreedingManager
Apr 20, 2026
byronaltice
referenced
this pull request
in byronaltice/MewgenicsBreedingManager
Apr 20, 2026
byronaltice
referenced
this pull request
in byronaltice/MewgenicsBreedingManager
Apr 20, 2026
… investigation notes
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Branch Notes
This PR adds a clearer way to evaluate breeding pairs by introducing a relation/risk percentage, a dedicated Safe Breeding screen, and UI zoom/accessibility improvements.
What changed
0-19%: Not Inbred20-49%: Slightly Inbred50-99%: Moderately Inbred100%+(clamped to 100): Highly InbredCtrl+=/Ctrl++)Ctrl+-)Ctrl+0)Math logic
The branch calculates inbreeding risk using ancestry paths and converts that to a percentage for the UI.
1) Build ancestor data
_ancestor_depths(cat)finds how many generations away each ancestor is._ancestor_paths(cat)builds all unique upward paths from a cat to each ancestor.2) Compute raw CoI (Coefficient of Inbreeding)
For each common ancestor between Cat A and Cat B:
0.5 ** (sa + sb + 1)Where:
sa= number of edges from A to ancestorsb= number of edges from B to ancestorSo closer shared ancestors contribute more; farther ones contribute less.
3) Convert raw CoI to UI Risk%
Risk percent is normalized as:
Risk% = clamp((raw_coi / 0.25) * 100, 0, 100)Meaning:
0.25maps to100%risk4) Shared ancestor metrics used in ranking
shared_ancestor_counts(a, b)returns:total_shared: all common ancestors found (within depth limit)recent_shared: common ancestors where both cats are within 3 generationsIn Safe Breeding sorting:
Risk%first (safest on top)recent_shared * 1000 + total_shared) to penalize recent shared ancestry more heavilySafe Breeding view behavior