Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Mendelian Inheritance Simulator

License GitHub Pages HTML

An interactive, browser-based biology tool for exploring how physical traits are inherited across generations using the principles of Mendelian genetics. No installation, no dependencies — just open and explore.


Features

  • Five trait simulators — Eye color, blood type, skin tone, height, and hair color
  • Punnett square visualization — A live 2×2 grid showing every possible offspring genotype and phenotype after each calculation
  • Offspring result cards — Randomized children rendered as color-coded cards with swatches
  • Dark mode — Persistent light/dark theme toggle with smooth CSS variable transitions
  • Responsive layout — Works on desktop, tablet, and mobile; mobile navigation collapses to a hamburger menu
  • No build step — Pure HTML, CSS, and JavaScript; served directly from the docs/ folder via GitHub Pages

Live Demo

aponder-dev.github.io/Mendelian-Inheritance-Simulator


Project Structure

All source files live in docs/, which is the GitHub Pages root.

docs/
├── css/
│   ├── style.css          # Full design system — CSS custom properties, light theme
│   ├── darkmode.css        # Dark theme variable overrides (body[data-theme="dark"])
│   └── layout.css          # Compatibility stub
├── js/
│   ├── darkmode.js         # Theme persistence and toggle (no stylesheet swapping)
│   ├── nav.js              # Sticky navigation bar injection
│   ├── footer.js           # Footer injection
│   ├── script.js           # Shared utilities
│   └── alleles/
│       ├── bloodType.js    # ABO blood type inheritance logic + Punnett square
│       ├── eyeColor.js     # Eye color logic + Punnett square
│       ├── hairColor.js    # Hair color logic + Punnett square
│       ├── height.js       # Mid-parent height estimation
│       └── skinColor.js    # Polygenic skin tone simulation
├── pages/
│   ├── blood-types.html
│   ├── eye-color.html
│   ├── hair-color.html
│   ├── height.html
│   └── skin-color.html
├── images/
│   └── mendel-diagram.png
└── index.html              # Home page — hero, trait cards, about section

Running Locally

This is a static site — no build tools required.

Option A — Python (recommended):

cd docs
python -m http.server 8080
# Open http://localhost:8080

Option B — Node.js:

npx serve docs -p 8080
# Open http://localhost:8080

Opening index.html directly via file:// will work for most content, but the navigation uses absolute paths (/pages/...) that require an HTTP server.


Usage

  1. Navigate to a trait page from the nav bar or home page cards.
  2. Set the alleles (or phenotype) for each parent using the dropdown selectors.
  3. Choose the number of children to simulate (1–12).
  4. Click Calculate Offspring to generate results and a Punnett square.
  5. Re-run as many times as needed — each run produces a new random sample from the possible outcomes.

Roadmap

  • Punnett square visualization
  • Offspring result cards with color swatches
  • Dark mode with CSS custom properties
  • Responsive mobile layout with hamburger navigation
  • Additional traits (widow's peak, dimples, tongue rolling)
  • Probability percentages shown on Punnett square cells
  • Export / share simulation results
  • Multi-generational inheritance chains

Contributing

Pull requests are welcome. For significant changes, please open an issue first to discuss the proposed update.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/your-feature)
  3. Commit your changes (git commit -m 'Add your feature')
  4. Push to the branch (git push origin feature/your-feature)
  5. Open a pull request against main

Repository: github.com/APonder-Dev/Mendelian-Inheritance-Simulator


License

This project is distributed under a custom No-Resale license. You are free to use, copy, modify, and share this software for personal or educational purposes. Commercial resale or redistribution for profit is not permitted without prior written consent from the author.

See the LICENSE file for full terms.


Contact

Anthony Ponder
Website: aponder.dev
Email: Anthony@aponder.dev
GitHub: @APonder-Dev

About

A web application that allows users to explore and simulate the inheritance patterns of traits based on Mendelian genetics. Users can predict offspring traits for various characteristics, including blood type, eye color, and height, all through a user-friendly interface with dark mode support.

Topics

Resources

Stars

Watchers

Forks

Used by

Contributors