CounterScript: Difference between revisions
→Champions: Explained BBCS |
→BBCS: Added two values |
||
| Line 98: | Line 98: | ||
|≥25 | |≥25 | ||
|<code>A++; A++; A++; A++; A++; while A {A--; B++; B++; B++; B++; B++;}</code> | |<code>A++; A++; A++; A++; A++; while A {A--; B++; B++; B++; B++; B++;}</code> | ||
|- | |||
|13 | |||
|≥30 | |||
|<code>A++; A++; A++; A++; A++; A++; while A {A--; B++; B++; B++; B++; B++;}</code> | |||
|- | |||
|14 | |||
|>36 | |||
|<code>A++; A++; A++; A++; A++; A++; while A {A--; B++; B++; B++; B++; B++; B++;}</code> | |||
|} | |} | ||
</div> | </div> | ||
[[Category:Functions]] | [[Category:Functions]] | ||
Revision as of 07:36, 27 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++;}
|
| 13 | ≥30 | A++; A++; A++; A++; A++; A++; while A {A--; B++; B++; B++; B++; B++;}
|
| 14 | >36 | A++; A++; A++; A++; A++; A++; while A {A--; B++; B++; B++; B++; B++; B++;}
|