Skip to content

jerichd4c/kingdom-binary-tree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Kingdom Binary Tree

A C++ binary tree implementation for managing royal family succession lines

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. CSV File Format
  5. License

About The Project

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

(back to top)

Built With

  • C++

(back to top)

Getting Started

To get a local copy up and running, compile the source code natively via GCC/G++.

Prerequisites

  • GCC / G++ (MinGW on Windows)
  • C++11 or higher

Installation

  1. Clone the repo
    git clone https://github.com/yourusername/kingdom-binary-tree.git
  2. Navigate to the project directory
    cd kingdom-binary-tree
  3. Compile the project:
    g++ src/ArbolBinario.cpp -o bin/ArbolBinario.exe

(back to top)

Usage

Execute the binary from the project root directory:

bin/ArbolBinario.exe

Note: Always run the program from the repository root to ensure CSV files are found correctly.

Menu Options

  1. Display family tree - Shows the complete genealogical tree
  2. Show succession line - Displays current line of succession (living members only)
  3. Modify a node - Update family member data (except id and father_id)
  4. Add family member - Add new member to the family tree
  5. Kill the king - Mark current king as dead (triggers automatic succession)
  6. Show current king - Display the reigning monarch's information
  7. Exit - Close the application

Sample Data Files

Two CSV files are provided in the data/ directory:

  • family_tree_ordered.csv - Pre-sorted family data
  • family_tree_unordered.csv - Random order for testing tree construction

(back to top)

CSV File Format

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

(back to top)

License

Distributed under the MIT License.

(back to top)

About

Binary tree implementation for royal family genealogy and succession.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages