C++ algorithmic solution for the Bitdefender Programming Contest 2026. The project simulates and optimizes a dynamic data center network on a hexagonal grid under randomized resource constraints. I applied OOP, BFS graph pathfinding for connectivity, and custom greedy heuristics to maximize dynamic resource allocation and infrastructure growth.
This project was developed for Bitdefender Programming Contest (BPC) 2026. The scenario involves saving a human colony on a dying planet by building an Artificial General Intelligence (AGI) network. The infrastructure must be built on a 19-hexagon grid map, utilizing the unpredictable solar energy of the planet's two suns.
- Hexagonal Grid: The map consists of 54 interconnected nodes across 19 hexagons.
- Resource Generation: Factories produce 5 types of components: Energy, Water, Data, RAM, and GPU. Production depends on random daily solar energy levels (ranging from 2 to 12).
- Infrastructure Constraints: Data centers cannot be built adjacent to each other due to electromagnetic interference. Cables must be built along the hexagon edges to connect the network.
- Component Conversion: Converters allow trading excess resources for needed ones at different exchange rates (2:1, 3:1, or 4:1).
Since random daily resource generation prevents a static pre-computed solution, I developed a dynamic simulation engine that reacts to the environment day by day.
- Object-Oriented Programming (OOP): The system state is managed through custom structures (
Hex,Resource,Node,Edge) and a centralBoardclass that handles the simulation logic cleanly. - Greedy Heuristics: The placement of Data Centers and Cables is determined by a custom scoring function (
scoreNode). Nodes are evaluated dynamically based on:- Adjacent resource diversity and volume.
- Statistical probability of the adjacent factories activating (based on solar energy distribution).
- Access to high-tier converters.
- Graph Theory (BFS): Implemented Breadth-First Search (
findPath) to calculate the most efficient cable routing from the existing infrastructure grid to high-value, unbuilt target nodes. - Resource Management: Automated conversion logic (
doConvert) trades surplus components efficiently using the best available converters on the grid to continuously fund network upgrades.
- A standard C++ compiler (e.g.,
g++,clang++) supporting C++17 or higher.
Open your terminal and compile the solution using:
g++ -O3 -std=c++17 main.cpp -o bpc_solution