Skip to content

ObsidianHonorCoders/ArithmetOHC

ArithmetOHC

The official OHC playground for competitive, high-precision arithmetic bot tournaments.

πŸ“– Overview

ArithmetOHC is a C++ project that serves as a competitive platform for arithmetic bot implementations. The project provides a framework where multiple developers can create and test their arithmetic calculation bots in a standardized environment.

πŸ—οΈ Project Structure

ArithmetOHC/
β”œβ”€β”€ .github/                       # GitHub workflows and templates
β”‚   β”œβ”€β”€ workflows/
β”‚   β”‚   └── integration-test.yml   # CI/CD pipeline for multi-platform testing
β”‚   └── pull_request_template.md   # Standardized PR template
β”œβ”€β”€ aritmetic_bot_luis/            # Luis's arithmetic bot implementation
β”‚   β”œβ”€β”€ bot_header.hpp             # Header file with function declarations
β”‚   └── bot_functions.cpp          # Implementation of calculation functions
β”œβ”€β”€ aritmetic_bot_marco/           # Marco's arithmetic bot implementation
β”‚   β”œβ”€β”€ bot_header.hpp             # Header file with function declarations
β”‚   └── bot_functions.cpp          # Implementation of calculation functions
β”œβ”€β”€ aritmetic_bot_calileus/        # Calileus's arithmetic bot implementation
β”‚   β”œβ”€β”€ bot_header.hpp             # Header file with function declarations
β”‚   └── bot_functions.cpp          # Implementation of calculation functions
β”œβ”€β”€ cmakehelpers/                  # CMake helper utilities
β”‚   └── detect_generator.cmake     # Platform detection for build system
β”œβ”€β”€ tests/                         # Unit test suite
β”‚   β”œβ”€β”€ CMakeLists.txt             # Test configuration with Google Test
β”‚   └── build_gtest/               # Google Test framework (generated, git ignored)
β”œβ”€β”€ build/                         # Build output directory (generated, git ignored)
β”œβ”€β”€ main.cpp                       # Main entry point demonstrating bot usage
β”œβ”€β”€ CMakeLists.txt                 # Main CMake configuration
β”œβ”€β”€ build_and_run_project.cmake    # Cross-platform build automation script
β”œβ”€β”€ Doxyfile                       # Doxygen configuration for documentation
β”œβ”€β”€ .clang-format                  # Code formatting rules
β”œβ”€β”€ .gitignore                     # Git ignore patterns
β”œβ”€β”€ LICENSE                        # Apache License 2.0
β”œβ”€β”€ CODE_OF_CONDUCT.md             # Community guidelines
└── CONTRIBUTING.md                # Contribution guidelines

πŸ€– Bot Implementations

Each arithmetic bot follows a consistent interface:

Luis's Bot (aritmetic_bot_luis)

  • Namespace: luis_aritmetic_bot
  • Function: double calculate(std::string expression)
  • Purpose: Luis's implementation of arithmetic expression evaluation

Marco's Bot (aritmetic_bot_marco)

  • Namespace: marco_aritmetic_bot
  • Function: double calculate(std::string expression)
  • Purpose: Marco's implementation of arithmetic expression evaluation

Calileus's Bot (aritmetic_bot_calileus)

  • Namespace: calileus_aritmetic_bot
  • Function: double calculate(std::string expression)
  • Purpose: Calileus's implementation of arithmetic expression evaluation

πŸš€ Getting Started

Prerequisites

  • CMake 3.28 or higher
  • C++17 compatible compiler (GCC, Clang, MSVC)
  • Git (for cloning)

Building the Project

Option 1: Using the Build Script (Recommended)

cmake -P build_and_run_project.cmake

This script automatically:

  • Detects your platform and available compilers
  • Configures CMake with optimal settings
  • Builds the project using all available CPU cores
  • Runs the executable to demonstrate bot functionality
  • Executes unit tests (if enabled)

Option 2: Manual Build

mkdir build
cd build
cmake ..
cmake --build . --config Release
./arithmet_ohc  # On Windows: arithmet_ohc.exe

Running Tests

cd build
./tests/test_arithmet_ohc  # On Windows: tests/test_arithmet_ohc.exe

Or enable tests in the build script:

cmake -DBUILD_TESTS=ON -P build_and_run_project.cmake

πŸ§ͺ Usage Example

The main function demonstrates how to use each bot:

#include "aritmetic_bot_luis/bot_header.hpp"
#include "aritmetic_bot_marco/bot_header.hpp"
#include "aritmetic_bot_calileus/bot_header.hpp"

int main() {
    double result = luis_aritmetic_bot::calculate("2 + 2");
    std::cout << "Luis Result: " << result << std::endl;
    
    result = marco_aritmetic_bot::calculate("2 + 2");
    std::cout << "Marco Result: " << result << std::endl;
    
    result = calileus_aritmetic_bot::calculate("2 + 2");
    std::cout << "Calileus Result: " << result << std::endl;
    
    return 0;
}

πŸ“š Documentation

The project includes comprehensive Doxygen documentation for all components:

Generating Documentation

doxygen Doxyfile

This will generate HTML documentation in the docs/ directory with:

  • API reference for all bot functions
  • Build system documentation
  • Architecture overview
  • Usage examples

πŸ”§ Development

Adding a New Bot

  1. Create Directory: aritmetic_bot_<name>/
  2. Create Header: bot_header.hpp with namespace and function declaration
  3. Create Implementation: bot_functions.cpp with function implementation
  4. Update CMakeLists.txt: Add new bot library configuration
  5. Update main.cpp: Include and test the new bot
  6. Add Tests: Create unit tests in the tests/ directory

Code Style

All code must follow the project's coding standards:

  • Use .clang-format for code formatting
  • Follow Doxygen documentation style
  • Use C++17 features appropriately
  • Include comprehensive unit tests

Testing

The project uses Google Test for unit testing:

  • Test files should be named test_*.cpp
  • Place test files in the tests/ directory
  • Run tests with cmake -DBUILD_TESTS=ON -P build_and_run_project.cmake

πŸ† Competition Framework

This repository is designed for arithmetic bot competitions where:

  • Each bot implements the same interface
  • Performance and accuracy can be compared
  • Standardized testing ensures fair evaluation
  • Multiple implementations can coexist

🌐 CI/CD

The project includes GitHub Actions for:

  • Multi-platform testing: Ubuntu, Windows, macOS
  • Automated builds: Triggered on push and pull requests
  • Integration testing: Full build and test execution
  • Quality assurance: Consistent environment testing

πŸ“„ License

This project is licensed under the Apache License 2.0. See LICENSE for details.

🀝 Contributing

Please read CONTRIBUTING.md for our contribution guidelines and CODE_OF_CONDUCT.md for our community standards.


Built with passion by the Obsidian Honor Coders community

About

The official OHC playground for competitive, high-precision arithmetic bot tournaments.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors