CounterScript: Difference between revisions

From BusyBeaverWiki
Jump to navigation Jump to search
Polygon (talk | contribs)
Added Category:Functions
Azerty (talk | contribs)
Champions: Set BBCS(8) and BBCS(9) status to proven.
 
Line 78: Line 78:
|-
|-
|8
|8
|≥9
|9
|<code>A++; A++; A++; while A {A--; B++; B++; B++;}</code>
|<code>A++; A++; A++; while A {A--; B++; B++; B++;}</code>
|-
|-
|9
|9
|≥12
|12
|<code>A++; A++; A++; A++; while A {A--; B++; B++; B++;}</code>
|<code>A++; A++; A++; A++; while A {A--; B++; B++; B++;}</code>
|-
|-
Line 88: Line 88:
|≥16
|≥16
|<code>A++; A++; A++; A++; while A {A--; B++; B++; B++; B++;}</code>
|<code>A++; A++; A++; A++; while A {A--; B++; B++; B++; B++;}</code>
|-
|11
|≥20
|<code>A++; A++; A++; A++; A++; while A {A--; B++; B++; B++; B++;}</code>
|-
|12
|≥25
|<code>A++; A++; A++; A++; A++; while A {A--; B++; B++; B++; B++; B++;}</code>
|}
|}
</div>
</div>


[[Category:Functions]]
[[Category:Functions]]

Latest revision as of 19:03, 22 April 2026

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++;}
11 ≥20 A++; A++; A++; A++; A++; while A {A--; B++; B++; B++; B++;}
12 ≥25 A++; A++; A++; A++; A++; while A {A--; B++; B++; B++; B++; B++;}