Wie zähle ich die Zeichen?

How do I count characters?

Integraler Bestandteil des Wettbewerbs ist das Zählen von Zeichen, um das Programm zu kategorisieren.

Man versteht es am besten, wenn man Beispiele sieht. Teilnehmer vergangener Jahre haben zum Teil schon den Nachweis geliefert, ohne dass er ausdrücklich gefordert war. Dabei gibt es durchaus systemspezifische Unterschiede.

Integral part of the competition is counting characters to categorize the program.

 

It is best understood by seeing examples. Participants of past years have sometimes already provided the proof without it being explicitly required. There are definitely system-specific differences.

Jeder Buchstabe, der sich am Anfang einer neuen Zeile oder unmittelbar nach einem Doppelpunkt
":" oder der Anweisung "THEN" befindet, wird vom ZX-Spectrum-Interpreter sofort durch den entsprechenden Befehl durch den ZX-Spectrum-Interpreter ersetzt, wie folgt:

Every letter that is at the beginning of a new line or immediately after a colon ":" or the statement "THEN" is immediately replaced by the corresponding command by the ZX Spectrum interpreter, as follows:

a = NEW     n = NEXT     b = BORDER     o = POKE     c = CONTINUE     p = PRINT     d = DIM     q = PLOT  e = REM     r = RUN      f = FOR        s = SAVE     g = GO TO        t = RANDOMIZE h = GO SUB  u = IF    i = INPUT   v = CLS      j = LOAD       w = DRAW     k = LIST         x = CLEAR     l = LET     y = RETURN m = PAUSE   z = COPY

Jeder dieser Befehle zählt also ein Zeichen.

Man gibt folgendes ein:

So each of these commands counts one character.

 

One enters the following:

1x:dt(91):i"Players (1-2)?";f:RESTORE:READ n,t(41),t(42),t(50),t(51),t(1),z,p,z$

2lp=3-p:lq=z>1:dc(3):fa=1 TO 8:fb=1 TO 8:lk=t(a*9+b+1):pAT 18,3*b+2;b

3pAT a+a,2;a;PAPER k+p*p*(a*9+b+1=z);AT a+a,3*b+1;"/ ";AT a+a+1,3*b+1;"___"

4lc(k+1)=c(k+1)+1:nb:na:p''" BLUE ";c(2);"x";c(3);" RED",:bp

5le=c(1)*c(p+1)>0:i':ue*f>=p THEN i"Row (0-8)? ";a'"Col (0-8)? ";b

6fi=1 TO 62*e:lz=CODE z$(i)-32+(a*9+b)*(a*b>0)*(b<9)

7BEEP .01,i:fj=0 TO 9*(t(z)=0)-1:ld=j+INT (j/3)*6-10:lw=z+d

8on-2,8:ut(w)=3-p THEN lw=w+d:o(t(w)<>p)*n,1:lw=w-d:lt(w)=p:o(w<>z)*n,4

9nj:g2+(8*(i*q<62)-5*(z>1=i))*(t(z)*j=0):DATA 23620,2,1,1,2,3,2,2

10ni:b7:DATA "!2j+qX=0-ol_D?ZB]HT\@[QAKOF/.nmVMYPG>^ULC9876fedcka4,ph;1:bg5!"

Dieses Spiel "Othello" von Einar Saukas aus dem Jahr 2016 wird in die Kategorie "PUR-80" eingruppiert. Die längste Zeile ist die Zeile 1 mit genau 80 eingegebenen Zeichen.

Listet man das Spiel, erhält man das vollständige Listing:

This game "Othello" by Einar Saukas from 2016 is grouped in the category "PUR-80". The longest line is line 1 with exactly 80 characters entered.

 

If you list the game, you get the full listing:

1 CLEAR : DIM t(91): INPUT "Players (1-2)?";f: RESTORE : READ n,t(41),t(42),t(50),t(51),t(1),z,p,z$

2 LET p=3-p: LET q=z>1: DIM c(3): FOR a=1 TO 8: FOR b=1 TO 8: LET k=t(a*9+b+1): PRINT AT 18,3*b+2;b     

3 PRINT AT a+a,2;a; PAPER k+p*p*(a*9+b+1=z);AT a+a,3*b+1;"/ ";AT a+a+1,3*b+1;"___"

4 LET c(k+1)=c(k+1)+1: NEXT b: NEXT a: PRINT ''" BLUE ";c(2);"x";c(3);" RED",: BORDER p

5 LET e=c(1)*c(p+1)>0: INPUT ': IF e*f>=p THEN INPUT "Row (0-8)? ";a'"Col (0-8)? ";b

6 FOR i=1 TO 62*e: LET z=CODE z$(i)-32+(a*9+b)*(a*b>0)*(b<9)

7 BEEP .01,i: FOR j=0 TO 9*(t(z)=0)-1: LET d=j+INT (j/3)*6-10: LET w=z+d

8 POKE n-2,8: IF t(w)=3-p THEN LET w=w+d: POKE (t(w)<>p)*n,1: LET w=w-d: LET t(w)=p: POKE (w<>z)*n,4

9 NEXT j: GO TO 2+(8*(i*q<62)-5*(z>1=i))*(t(z)*j=0): DATA 23620,2,1,1,2,3,2,2

10 NEXT i: BORDER 7: DATA "!2j+qX=0-ol_D?ZB]HT\@[QAKOF/.nmVMYPG>^ULC9876fedcka4,ph;1:bg5!"

 

 

 

This is the game "PETSCII Jetski" from 2020. This listing demonstrates how you can proove that the game is within the 80 character limit.

 

0dIl$,i,a(2):p=rN(-ti):s=40740:f=54287:c=56215:a(1)=-1:a(2)=1:q=40:t=.:w=.:gO6
1pOo+t,w+48:pOs+rN(1)*q,32:pOs+rN(1)*q,32:pOc+rN(1)*q,7:pOc+rN(1)*q,7
2fOi=.to4:pOc+rN(1)*q,13:pOc+rN(1)*q,1:nE:ifrN(1)<.4tHpOs+rN(1)*q,q+rN(1)*83
3h=(h=.)*-q:ifp=ttHpO53280,5:t=(t=.)*-39:w=w+1:pO53280,0:ifw>9gO8
4gEi:p=p+a(i):p=p-(p<0)+(p=q):pOr+p,160:i=pE(n+p):ifi<>32tHifi=.ori>26gO8
5fOi=-w/2to.:?l$;:nE:pOf,p*4+h:gO1
6pO646,5:fOp=.to9:pO53281-p/5,.:l$=l$+" ":?sP120):nE:o=1024:r=o+q:n=r+q
7pOf,80:pOf+4,213:pOf+5,202:pOf+9,15:pOf+3,129:h=.:x=32:y=26:ti$="000000":gO1
8?:ifw<10tHc=pE(46)*256+pE(45)+3:pOc+1,8:fOi=.to22:pOc,rN(1)*256:?l$;:nE:pO646,1
9pOf+3,128:pO198,0:?:?"↓time"ti,"score"w:ifw>9tHpO53281,13:?"↓you won!"


In this text, a lowercase letter means this letter was typed in without SHIFT held down.
An uppercase letter was typed in with SHIFT held down.

 


Keyword Abbreviations
The Commodore 64 allows BASIC programmers to use keyword abbreviations. For
instance instead of typing in “dim” for the dimension statement, one can enter “dI”
(unshifted D, shifted I). BASIC tokens are stored using a single byte no matter what, but
keyword abbreviations allow programmers to pack more code into a line. We used all
available keyword abbreviations.

Here is another possibility for C64 to prove. Made with Bas.Edit.

The game "Gravity Snake" from 2016:

Yes, it's an EXTREM-256 game.

SINCLAIR ZX Spectrum

COMMODORE 64