CounterScript

From BusyBeaverWiki
Revision as of 09:09, 12 April 2026 by Polygon (talk | contribs) (Added Category:Functions)
Jump to navigation Jump to search

CounterScript is a minimal counter-based programming language designed for Busy Beaver–style program enumeration and analysis.

It features a very small instruction set operating over an unbounded set of nonnegative integer variables (counters).

BBCS(n) is the Busy Beaver function for CounterScript programs.

Definition

A CounterScript program consists of a finite sequence of instructions drawn from three primitives:

  • Increment a counter
  • Conditional decrement
  • While loop

All counters are initialized to 0 and can grow without bound.

The model is closely related to Minsky register machines, Fractran and Brainfuck, and is therefore Turing-complete.

Instructions

Instructions are executed one by one from left to right.

Name Command Definition
Increment A++ Increment counter A by 1
Decrement A-- Decrement counter A by 1 if A > 0
While loop while A {...} Executes the loop body while x > 0

Program size

The length of a CounterScript program is defined as the total number of instructions.

By example, A++; while A {A--; B++;} has length 4.

Champions

n BBCS(n) Champion
1 1 A++;
2 2 A++; A++;
3 3 A++; A++; A++;
4 4 A++; A++; A++; A++;
5 5 A++; A++; A++; A++; A++;
6 6 A++; A++; A++; A++; A++; A++;
7 7 A++; A++; A++; A++; A++; A++; A++;
8 ≥9 A++; A++; A++; while A {A--; B++; B++; B++;}
9 ≥12 A++; A++; A++; A++; while A {A--; B++; B++; B++;}
10 ≥16 A++; A++; A++; A++; while A {A--; B++; B++; B++; B++;}