02 / Software + probabilityNov - Dec 2025

Markov Chain Text Generator

This project turned sample text into a probability model, then used that model to create output that balanced recognizable patterns with controlled randomness.

  • C++
  • Visual Studio
  • Markov Chains
  • N-Grams
  • Probability
StatusCompleted
FocusSoftware + probability
Core toolsC++ · Visual Studio · Markov Chains

Project overview

I developed a C++ program that learns character patterns from training text using Markov chains and n-gram modeling. It calculates possible next-character probabilities and samples from those distributions to generate new text.

Engineering approach

From idea to working system.

01

Model the context

The program uses an n-gram as its current context, allowing recent characters to influence the next generated character.

02

Build probabilities

I calculated next-character probabilities from the training text so frequently observed transitions were more likely to be selected.

03

Tune the output

I tested different n-gram orders to compare coherence and randomness, using the results to understand the model's tradeoffs.

Technical highlights

What this project demonstrates.

01

Character-level probability modeling

02

N-gram context generation

03

Weighted probability sampling

04

Comparative testing across n-gram orders

What I learned

The project gave me practical experience translating a mathematical model into a working C++ system and evaluating behavior that is probabilistic rather than fixed.
Next projectMicrocontroller Tic-Tac-Toe