Skip to content

A small C program utilizing pthreads simulating different thread "civilizations" interacting

License

Notifications You must be signed in to change notification settings

dja322/DarkForestThreads

Repository files navigation

Dark Forest Threads

A multithreaded simulation of civilizations in a "dark forest" universe, written in C using POSIX threads.

Features

  • Simulates multiple civilizations as threads
  • Civilizations interact, attack, befriend, or hide from each other
  • Tracks development, visibility, and diplomatic/survival states
  • Demonstrates thread synchronization and inter-thread communication
  • Most features are very rudimentary with only basic one way interactions

Project Structure

  • darkForest.c - Main entry point, universe and thread initialization
  • civilizationFunctions.c/h - Civilization thread logic and interactions
  • utilFunctions.c/h - Utility functions
  • dataTypes.h - Shared data types and constants
  • makefile - Build instructions

Build Instructions

To build the project, run:

make

This will produce dark.exe.

To clean up build artifacts:

make clean

Usage

Run the simulation:

./dark.exe

Requirements

  • GCC (with pthread support)
  • POSIX-compliant system (Linux, macOS, WSL, etc.)

Notes

  • Thread behavior and interactions are defined in civilizationFunctions.c.
  • The number of civilizations and universe size are configurable in dataTypes.h.
  • For debugging memory issues, use Valgrind:
valgrind ./dark.exe

Author

dja322

About

A small C program utilizing pthreads simulating different thread "civilizations" interacting

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published