CounterScript: Difference between revisions

From BusyBeaverWiki
Jump to navigation Jump to search
Azerty (talk | contribs)
Azerty (talk | contribs)
→Champions: Explained BBCS
Line 37: Line 37:
|}
|}


= Program size =
== BBCS ==
<div class="toccolours mw-collapsible">
The Busy Beaver function for CounterScript, denoted '''BBCS(n)''', returns the largest score a CounterScript program of length ''n'' can have when halting.
 
The '''score''' of a program is the maximum value of its counters.
 
The '''length''' of a CounterScript program is defined as the total number of instructions.
The '''length''' of a CounterScript program is defined as the total number of instructions.


By example, <code>A++; while A {A--; B++;}</code> has length 4.
By example, <code>A++; B++; while A {A--; C++; C++;}</code> has length 6 and its score is 2.
 
== Champions ==
<div class="toccolours mw-collapsible">
{| class="wikitable"
{| class="wikitable"
!n
!n

Revision as of 12:30, 20 May 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

BBCS

The Busy Beaver function for CounterScript, denoted BBCS(n), returns the largest score a CounterScript program of length n can have when halting.

The score of a program is the maximum value of its counters.

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

By example, A++; B++; while A {A--; C++; C++;} has length 6 and its score is 2.

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++;}