Math & Algorithmic Logic — 8 tools
Where classical logic meets computer science: Boolean algebra on a 2D map, recursive calls you can watch grow, and a small Bayesian sandbox where you can poke evidence into the side of a graph and watch the posteriors shift.
Boolean Expression Visualiser
3-variable Boolean function plotted on a 2D Karnaugh-style map. Each cell is a minterm; highlighted cells are the on-set.
Sum of products
Cells are placed on a 4×2 grid: rows for AB, columns for C. Order is Gray-code adjacent so neighbouring cells differ by exactly one variable.
Set Theory Venn Builder
Drop 10 numbers into sets A, B, C — drag chip between bins to define A∪B∪C, A∩C, A−B etc. We label every region.
Set A
Set B
Set C
Region labels
Recursive Call-Stack Visualiser
Pick fib / factorial / hanoi. Watch frames push and pop. Tracked depth shows when a recursion is at risk of stack-overflow.
Hanoi "moves" called recursively to count: M(n) = 2·M(n−1) + 1. Watch the depth grow exponentially — that's the lesson.
Algorithmic Complexity Estimator
Paste a short snippet of code-like logic. Heuristic scorer returns a likely Big-O with a one-line justification.
Heuristic patterns we recognise
- One for → O(n)
- Two nested loops → O(n²)
- Inner loop halves n//=2 → O(log n)
- Recursion with one branch / sub-n size → O(2ⁿ) or O(n log n)
- Hash/dict/Set → O(1) avg
Cellular Automaton Explorer
Wolfram's 1D rules (0–255) and Conway's Game of Life. Seed cells, watch evolution, capture the rule number from observed transitions.
Rule 30 is a classic: chaotic, used in random-number generation. Rule 110 is Turing-complete.
Bayesian Belief-Network Sandbox
A small pre-built network: Rain → Sprinkler → Wet Grass, with priors. Set evidence and see posterior updates via enumeration.
Evidence (set truth or unknown)
| Variable | P(true) | Known? | Value |
|---|---|---|---|
| Rain | 0.20 | ||
| Sprinkler | 0.50 | ||
| Wet Grass | ? |
Joint enumeration
We enumerate 2³ = 8 joint assignments, weight by the conditional probability table, condition on your evidence, and renormalise.
Game Theory Tournament
Iterated Prisoner's Dilemma. Six strategies (TitForTat, Grim, Always Cooperate, Always Defect, Pavlov, Random) play a round-robin. Heatmap of total scores.
Why TitForTat wins (mostly)
Axelrod's tournament famously favoured strategies that were nice (start cooperating), retaliatory (defect when other defects), forgiving (return to cooperation quickly) and clear (predictable). Our implementation uses the standard payoffs (R=3, S=0, T=5, P=1) and shows the champion per scenario.
Noise toggles are in our to-do list; today, simulations are noiseless.
Sudoku Logical Hint
Fill a grid (or load a sample). The hint engine applies only logical techniques: naked single, hidden single, naked pair, box/line reduction. Each step is justified.
If a puzzle is unsolvable by these techniques alone, the solver will stop and tell you. The full backtracking solver is in the dev console for the curious.