Table of Contents
Binary tree implementation for royal family genealogy and succession. Manages crown transfer rules, living heir tracking, and family member operations.
ArbolBinario.cpp: Main implementation containing:
- Binary tree structure for family members
- CSV file import/export functionality
- Royal succession line calculation with complex rules
- CRUD operations for family members
- King death and abdication handling
Features:
- Automatic king assignment when current king dies
- Succession line display (living members only)
- Family tree visualization
- Node modification (except id and father_id)
- Support for primogeniture and secondary heir rules
- Automatic crown transfer for kings over 70 years old
To get a local copy up and running, compile the source code natively via GCC/G++.
- GCC / G++ (MinGW on Windows)
- C++11 or higher
- Clone the repo
git clone https://github.com/yourusername/kingdom-binary-tree.git
- Navigate to the project directory
cd kingdom-binary-tree - Compile the project:
g++ src/ArbolBinario.cpp -o bin/ArbolBinario.exe
Execute the binary from the project root directory:
bin/ArbolBinario.exeNote: Always run the program from the repository root to ensure CSV files are found correctly.
- Display family tree - Shows the complete genealogical tree
- Show succession line - Displays current line of succession (living members only)
- Modify a node - Update family member data (except id and father_id)
- Add family member - Add new member to the family tree
- Kill the king - Mark current king as dead (triggers automatic succession)
- Show current king - Display the reigning monarch's information
- Exit - Close the application
Two CSV files are provided in the data/ directory:
family_tree_ordered.csv- Pre-sorted family datafamily_tree_unordered.csv- Random order for testing tree construction
id;name;last_name;gender;age;id_father;is_dead;was_king;is_king
| Column | Description | Values |
|---|---|---|
| id | Unique identifier | Integer |
| name | First name | String |
| last_name | Last name | String |
| gender | Gender | H (Male) / M (Female) |
| age | Age | Integer |
| id_father | Father's ID | Integer (empty for root) |
| is_dead | Is deceased | 0 (No) / 1 (Yes) |
| was_king | Was previously king | 0 (No) / 1 (Yes) |
| is_king | Is current king | 0 (No) / 1 (Yes) |
Example entry:
1;Arthur;Royal;H;80;;0;1;1
Distributed under the MIT License.