'
'
'
'
'
'
'
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
'!!!!!!!!!!!!!!!!!!!!!!                                      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
'!!!!!!!!!!!!!!!!!!!!!!  F5 drcken, um Programm zu starten  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
'!!!!!!!!!!!!!!!!!!!!!!                                      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
'
'
'(C) by Michael Verhlsdonk
'
'
'********************Hier fngt das Programm an (Nichts ndern!)************************
'$DYNAMIC
'$INCLUDE: 'Editor.lab'
DIM Feld$(200)


OPEN "Data\data.lab" FOR INPUT AS 1
INPUT #1, StartErlaubnis!
INPUT #1, Laufwerk$
INPUT #1, Anwendung$
INPUT #1, Spieler$
INPUT #1, Spielern!
CLOSE 1
IF StartErlaubnis! = 0 THEN END
OPEN Laufwerk$ + "data.lab" FOR INPUT AS #1
INPUT #1, DateiGruppe$
CLOSE 1
IF Spielern! = 1 THEN Spielern$ = "0"
IF Spielern! = 2 THEN Spielern$ = "1"
IF Spielern! = 3 THEN Spielern$ = "2"
IF Spielern! = 4 THEN Spielern$ = "3"
IF Spielern! = 5 THEN Spielern$ = "4"

OPEN "Spieler\Spieler" + Spielern$ + ".lab" FOR INPUT AS 1
INPUT #1, Name$
INPUT #1, Stufe$
CLOSE 1
IF Stufe$ = "Level 01" THEN Stufe! = 1
IF Stufe$ = "Level 02" THEN Stufe! = 2
IF Stufe$ = "Level 03" THEN Stufe! = 3
IF Stufe$ = "Level 04" THEN Stufe! = 4
IF Stufe$ = "Level 05" THEN Stufe! = 5
IF Stufe$ = "Level 06" THEN Stufe! = 6
IF Stufe$ = "Level 07" THEN Stufe! = 7
IF Stufe$ = "Level 08" THEN Stufe! = 8
IF Stufe$ = "Level 09" THEN Stufe! = 9
IF Stufe$ = "Level 10" THEN Stufe! = 10

SCREEN 13
GOSUB DateiGruppeLaden

'FOR NumX! = 0 TO 16
'FOR NumY! = 0 TO 9
'LINE (XAnfang + NumX! * 16, YAnfang + NumY! * 16)-(XAnfang + (NumX! + 1) * 16, YAnfang + (NumY! + 1) * 16), 0, B
'NEXT
'NEXT

sp% = 1: ze% = 0
Kachel! = 1
DO: taste$ = INKEY$: LOOP UNTIL INKEY$ = "": taste$ = ""
DO

IF taste$ = CHR$(0) + "P" AND Rechteck! = 0 THEN sp% = sp% + 1'Runter
IF taste$ = CHR$(0) + "M" AND Rechteck! = 0 THEN ze% = ze% + 1'Rechts
IF taste$ = CHR$(0) + "K" AND Rechteck! = 0 THEN ze% = ze% - 1'Links
IF taste$ = CHR$(0) + "H" AND Rechteck! = 0 THEN sp% = sp% - 1  'Hoch
IF taste$ = CHR$(0) + "P" AND Rechteck! = 1 THEN sp01% = sp01% + 1'Runter
IF taste$ = CHR$(0) + "M" AND Rechteck! = 1 THEN ze01% = ze01% + 1'Rechts
IF taste$ = CHR$(0) + "K" AND Rechteck! = 1 AND ze01% > ze% THEN ze01% = ze01% - 1'Links
IF taste$ = CHR$(0) + "H" AND Rechteck! = 1 AND sp01% > sp% THEN sp01% = sp01% - 1  'Hoch


IF sp% > 10 THEN sp% = 1
IF sp% < 1 THEN sp% = 10
IF ze% < 0 THEN ze% = 18
IF ze% > 18 THEN ze% = 0
IF sp01% > 10 THEN sp01% = 10
IF sp01% < 1 THEN sp01% = 1
IF ze01% < 0 THEN ze01% = 0
IF ze01% > 18 THEN ze01% = 18


IF taste$ = " " AND Kontextmenue! = 0 THEN
IF Rechteck! = 1 THEN
SWAP ze%, ze2%
SWAP sp%, sp2%
FOR sp% = sp2% TO sp01%
 FOR ze% = ze2% TO ze01%
IF Kachel! >= 10 THEN
IF ze% = 0 AND Kachel! = 47 OR ze% = 18 AND Kachel! = 47 THEN
Feld!(sp%, ze%, 0) = Kachel!: Feld!(sp%, ze%, 1) = 0: Feld!(sp%, ze%, 2) = 0: Feld!(sp%, ze%, 3) = 0
ELSEIF ze% > 0 AND Kachel! <> 47 AND ze% < 18 THEN
Feld!(sp%, ze%, 0) = Kachel!: Feld!(sp%, ze%, 1) = 0: Feld!(sp%, ze%, 2) = 0: Feld!(sp%, ze%, 3) = 0
IF Feld(sp%, ze%, 0) >= 41 AND Feld(sp%, ze%, 0) <= 43 OR Feld!(sp%, ze%, 0) = 45 THEN Feld!(sp%, ze%, 2) = 2
END IF
ELSEIF Kachel! < 10 THEN
IF ze% <> 0 AND ze% <> 18 THEN Boden(ze% + (sp% - 1) * 17, 0) = Kachel!
END IF
Spiel
NEXT: NEXT
SWAP ze%, ze2%
SWAP sp%, sp2%
ELSE

IF Kachel! >= 10 THEN
IF ze% = 0 AND Kachel! = 47 OR ze% = 18 AND Kachel! = 47 THEN
Feld!(sp%, ze%, 0) = Kachel!: Feld!(sp%, ze%, 1) = 0: Feld!(sp%, ze%, 2) = 0: Feld!(sp%, ze%, 3) = 0
ELSEIF ze% > 0 AND Kachel! <> 47 AND ze% < 18 THEN
Feld!(sp%, ze%, 0) = Kachel!: Feld!(sp%, ze%, 1) = 0: Feld!(sp%, ze%, 2) = 0: Feld!(sp%, ze%, 3) = 0
IF Feld(sp%, ze%, 0) >= 41 AND Feld(sp%, ze%, 0) <= 43 OR Feld!(sp%, ze%, 0) = 45 THEN Feld!(sp%, ze%, 2) = 2
END IF
ELSEIF Kachel! < 10 THEN
IF ze% <> 0 AND ze% <> 18 THEN Boden(ze% + (sp% - 1) * 17, 0) = Kachel!
END IF
Spiel
END IF
END IF

IF taste$ = CHR$(8) THEN Feld!(sp%, ze%, 0) = 0: Feld!(sp%, ze%, 1) = 0: Feld!(sp%, ze%, 2) = 0: Feld!(sp%, ze%, 3) = 0: Mein! = 1: Spiel: Mein! = 0

IF taste$ = "w" AND Boden(ze% + (sp% - 1) * 17, 0) = 9 THEN
Boden(ze% + (sp% - 1) * 17, 1) = Boden(ze% + (sp% - 1) * 17, 1) + 1
IF Boden(ze% + (sp% - 1) * 17, 1) = 3 THEN Boden(ze% + (sp% - 1) * 17, 1) = 0
Spiel
END IF
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
'IF taste$ = CHR$(13) AND Feld!(sp%, ze%, 0) >= 59 AND Feld!(sp%, ze%, 0) <= 68 THEN
'DO: taste$ = INKEY$: LOOP UNTIL taste$ = ""
'Texte$ = ""
'Word! = 0
'LINE (23, 14)-(294, 173), 0, BF
'  Pfont "Bitte die zu verbindene", 50, 70, 15, 0
'  Pfont "Dateigruppe eingeben:", 50, 80, 15, 0
'FOR Num! = 0 TO 6
'Pfont ".", 50 + Num! * 8, 90, 15, 0
'NEXT
'DO
'IF taste$ = CHR$(8) THEN
' IF Word! = 0 THEN Texte$ = Texte$ + " ": Word! = 1
' Texte$ = LEFT$(Texte$, LEN(Texte$) - 1)
' IF Word < 7 THEN Pfont ".", 50 + Word! * 8, 90, 15, 0
' Word! = Word! - 1
' END IF
'IF taste$ > CHR$(29) AND taste$ < CHR$(255) THEN
' 'taste$ = UCASE$(taste$)
' 'IF taste$ <> "0" OR taste$ <> "1" OR taste$ <> "2" OR taste$ <> "3" OR taste$ <> "4" OR taste$ <> "5" OR taste$ <> "6" OR taste$ <> "7" OR taste$ <> "8" OR taste$ <> "9" THEN taste$ = UCASE$(taste$)
'
' IF Word! = 7 THEN
'  Texte$ = LEFT$(Texte$, LEN(Texte$) - 1) + taste$
' ELSEIF Word! < 7 THEN
'  Texte$ = Texte$ + taste$
'  Word! = Word! + 1
' END IF
'END IF
'Pfont Texte$, 50, 90, 15, 0
'IF Word! < 7 THEN Pfont ".", 50 + Word! * 8, 90, 15, 0
'DO
'taste$ = INKEY$
'LOOP UNTIL taste$ <> ""
'LOOP UNTIL taste$ = CHR$(13) OR taste$ = CHR$(27)
'
'IF taste$ = CHR$(13) THEN Level$(Feld!(sp%, ze%, 0) - 59) = Texte$: Speichern DateiGruppe$
'LINE (23, 14)-(294, 173), 0, BF
'Speicher
'END IF
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

IF taste$ = CHR$(13) AND Feld!(sp%, ze%, 0) >= 41 AND Feld!(sp%, ze%, 0) <= 43 THEN
LINE (23, 14)-(294, 173), 0, BF
Texte = -1
DO: taste$ = INKEY$: LOOP UNTIL taste$ = ""
NO:
IF taste$ = "0" THEN Texte = 0
IF taste$ = "1" THEN Texte = 1
IF taste$ = "2" THEN Texte = 2
IF taste$ = "3" THEN Texte = 3
IF taste$ = "4" THEN Texte = 4
IF taste$ = "5" THEN Texte = 5
IF taste$ = "6" THEN Texte = 6
IF taste$ = "7" THEN Texte = 7
IF taste$ = "8" THEN Texte = 8
IF taste$ = "9" THEN Texte = 9
IF Texte > 0 THEN Feld!(sp%, ze%, 2) = Texte
IF Texte = 0 AND taste$ <> "" THEN Feld!(sp%, ze%, 1) = 1 - Feld!(sp%, ze%, 1)
Pfont "Pfeilgegner Eigenschaften", 60, 40, 15, 0
Pfont "Drehrichtung:", 70, 70, 15, 0
IF Feld(sp%, ze%, 0) = 41 THEN Richtung$ = "Rechts"
IF Feld(sp%, ze%, 0) = 42 THEN Richtung$ = "Links "
IF Feld(sp%, ze%, 0) = 43 THEN Richtung$ = "Zufall"
Pfont Richtung$, 70 + 14 * 8, 70, 15, 0
Pfont "Drehen nach", 70, 90, 15, 0
IF Feld!(sp%, ze%, 1) = 0 THEN art$ = "Schritt(en)"
IF Feld!(sp%, ze%, 1) = 1 THEN art$ = "Sekunde(n) "
ZahlPfont Feld!(sp%, ze%, 2), 70 + 12 * 8, 90, 15, 0
Pfont art$, 70 + 14 * 8, 90, 15, 0
Pfont "Zahlen (0-9) zum verstellen", 60, 110, 15, 0
DO: taste$ = INKEY$: LOOP UNTIL taste$ <> ""
IF taste$ <> CHR$(13) THEN GOTO NO
LINE (23, 14)-(294, 173), 0, BF
Speicher
END IF

IF taste$ = CHR$(13) AND Feld!(sp%, ze%, 0) >= 44 AND Feld!(sp%, ze%, 0) <= 45 THEN
LINE (23, 14)-(294, 173), 0, BF
taste$ = ""
no2:
Texte = -1
IF taste$ = "0" THEN Texte = 0
'IF taste$ = "1" THEN texte = 1
IF taste$ = "2" THEN Texte = 2
IF taste$ = "3" THEN Texte = 3
IF taste$ = "4" THEN Texte = 4
IF taste$ = "5" THEN Texte = 5
IF taste$ = "6" THEN Texte = 6
IF taste$ = "7" THEN Texte = 7
IF taste$ = "8" THEN Texte = 8
IF taste$ = "9" THEN Texte = 9
IF Texte > 0 AND Feld!(sp%, ze%, 0) = 45 THEN Feld!(sp%, ze%, 2) = Texte
IF Texte = 0 AND taste$ <> "" AND Feld!(sp%, ze%, 0) = 45 THEN Feld!(sp%, ze%, 1) = 1 - Feld!(sp%, ze%, 1)
Pfont "Loch Eigenschaften", 60, 40, 15, 0
Pfont "Lochart:", 70, 70, 15, 0
IF Feld(sp%, ze%, 0) = 44 THEN art$ = "Zufall"
IF Feld(sp%, ze%, 0) = 45 THEN art$ = "Vorschrifft"
Pfont art$, 70 + 14 * 8, 70, 15, 0
Pfont "Drehen nach", 70, 90, 15, 0
IF Feld!(sp%, ze%, 1) = 0 THEN art$ = "Schritt(en)"
IF Feld!(sp%, ze%, 1) = 1 THEN art$ = "Sekunde(n) "
IF Feld!(sp%, ze%, 0) = 45 THEN ZahlPfont Feld!(sp%, ze%, 2), 70 + 12 * 8, 90, 15, 0
Pfont art$, 70 + 14 * 8, 90, 15, 0
Pfont "Zahlen (0,2-9) zum verstellen", 60, 110, 15, 0
DO: taste$ = INKEY$: LOOP UNTIL taste$ <> ""
IF taste$ <> CHR$(13) THEN GOTO no2
LINE (23, 14)-(294, 173), 0, BF
Speicher
END IF





IF taste$ = CHR$(13) AND Feld!(sp%, ze%, 0) = 47 AND Kontextmenue! = 0 THEN
Kontextmenue! = 1
LadenFeldsp% = sp%
LadenFeldze% = ze%
LadenSpielFeld! = SpielFeld!
ELSEIF taste$ = CHR$(13) AND Feld!(sp%, ze%, 0) = 47 AND Kontextmenue! = 1 THEN
IF sp% <> LadenFeldsp% OR ze% <> LadenFeldze% OR SpielFeld! <> LadenSpielFeld! THEN
Feld!(sp%, ze%, 1) = LadenFeldsp%
Feld!(sp%, ze%, 2) = LadenFeldze%
Feld!(sp%, ze%, 3) = LadenSpielFeld!
Speichern DateiGruppe$
SWAP LadenSpielFeld!, SpielFeld!
Laden DateiGruppe$, 1
Feld!(LadenFeldsp%, LadenFeldze%, 1) = sp%
Feld!(LadenFeldsp%, LadenFeldze%, 2) = ze%
Feld!(LadenFeldsp%, LadenFeldze%, 3) = LadenSpielFeld!
Speichern DateiGruppe$
SWAP LadenSpielFeld!, SpielFeld!
Laden DateiGruppe$, 1
Kontextmenue! = 0
ELSEIF Kontextmenue! = 1 THEN
ZeitTime! = TIMER
Texte$ = "selbes Feld!"
END IF
END IF

IF taste$ = CHR$(13) AND Feld!(sp%, ze%, 0) = 38 AND Kontextmenue! = 0 THEN
Kontextmenue! = 2
LadenFeldsp% = sp%
LadenFeldze% = ze%
LadenSpielFeld! = SpielFeld!
ELSEIF taste$ = CHR$(13) AND Feld!(sp%, ze%, 0) = 38 AND Kontextmenue! = 2 THEN
IF sp% <> LadenFeldsp% OR ze% <> LadenFeldze% OR SpielFeld! <> LadenSpielFeld! THEN
Feld!(sp%, ze%, 1) = LadenFeldsp%
Feld!(sp%, ze%, 2) = LadenFeldze%
Feld!(sp%, ze%, 3) = LadenSpielFeld!
Speichern DateiGruppe$
SWAP LadenSpielFeld!, SpielFeld!
Laden DateiGruppe$, 1
Feld!(LadenFeldsp%, LadenFeldze%, 1) = sp%
Feld!(LadenFeldsp%, LadenFeldze%, 2) = ze%
Feld!(LadenFeldsp%, LadenFeldze%, 3) = LadenSpielFeld!
Speichern DateiGruppe$
SWAP LadenSpielFeld!, SpielFeld!
Laden DateiGruppe$, 1
Kontextmenue! = 0
ELSEIF Kontextmenue! = 2 THEN
ZeitTime! = TIMER
Texte$ = "selbes Feld!"
END IF
END IF

IF taste$ = CHR$(13) AND Kontextmenue! = 0 THEN
IF Feld!(sp%, ze%, 0) >= 48 AND Feld!(sp%, ze%, 0) <= 57 OR Feld!(sp%, ze%, 0) = 37 THEN
Kontextmenue! = 3
LadenFeldsp% = sp%
LadenFeldze% = ze%
LadenSpielFeld! = SpielFeld!
END IF
ELSEIF taste$ = CHR$(13) AND Kontextmenue! = 3 THEN
IF Feld!(sp%, ze%, 0) >= 48 AND Feld!(sp%, ze%, 0) <= 57 OR Feld!(sp%, ze%, 0) = 37 THEN
IF sp% <> LadenFeldsp% OR ze% <> LadenFeldze% OR SpielFeld! <> LadenSpielFeld! THEN
Feld!(sp%, ze%, 1) = LadenFeldsp%
Feld!(sp%, ze%, 2) = LadenFeldze%
Feld!(sp%, ze%, 3) = LadenSpielFeld!
Speichern DateiGruppe$
SWAP LadenSpielFeld!, SpielFeld!
Laden DateiGruppe$, 1
Feld!(LadenFeldsp%, LadenFeldze%, 1) = sp%
Feld!(LadenFeldsp%, LadenFeldze%, 2) = ze%
Feld!(LadenFeldsp%, LadenFeldze%, 3) = LadenSpielFeld!
Speichern DateiGruppe$
SWAP LadenSpielFeld!, SpielFeld!
Laden DateiGruppe$, 1
Kontextmenue! = 0
ELSEIF Kontextmenue! = 3 THEN
ZeitTime! = TIMER
Texte$ = "selbes Feld!"
END IF
END IF
END IF

IF taste$ = CHR$(13) AND Kontextmenue! = 0 THEN
IF Feld!(sp%, ze%, 0) = 22 OR Feld!(sp%, ze%, 0) = 25 OR Feld!(sp%, ze%, 0) = 36 THEN
Kontextmenue! = 4
LadenFeldsp% = sp%
LadenFeldze% = ze%
LadenSpielFeld! = SpielFeld!
END IF
ELSEIF taste$ = CHR$(13) AND Kontextmenue! = 4 THEN
IF Feld!(sp%, ze%, 0) = 22 OR Feld!(sp%, ze%, 0) = 25 OR Feld!(sp%, ze%, 0) = 36 THEN
IF sp% <> LadenFeldsp% OR ze% <> LadenFeldze% OR SpielFeld! <> LadenSpielFeld! THEN
Feld!(sp%, ze%, 1) = LadenFeldsp%
Feld!(sp%, ze%, 2) = LadenFeldze%
Feld!(sp%, ze%, 3) = LadenSpielFeld!
Speichern DateiGruppe$
SWAP LadenSpielFeld!, SpielFeld!
Laden DateiGruppe$, 1
Feld!(LadenFeldsp%, LadenFeldze%, 1) = sp%
Feld!(LadenFeldsp%, LadenFeldze%, 2) = ze%
Feld!(LadenFeldsp%, LadenFeldze%, 3) = LadenSpielFeld!
Speichern DateiGruppe$
SWAP LadenSpielFeld!, SpielFeld!
Laden DateiGruppe$, 1
Kontextmenue! = 0
ELSEIF Kontextmenue! = 4 THEN
ZeitTime! = TIMER
Texte$ = "selbes Feld!"
END IF
END IF
END IF


IF taste$ = "f" OR taste$ = "F" THEN
Rechteck! = 1 - Rechteck!
sp01% = sp%
ze01% = ze%
IF Rechteck! = 0 THEN
Speicher
END IF
END IF
IF taste$ = "p" AND DateiGruppe$ <> "Versuch" OR taste$ = "P" AND DateiGruppe$ <> "Versuch" THEN GOSUB Startpunkt

IF taste$ = "n" AND DateiGruppe$ <> "Versuch" OR taste$ = "N" AND DateiGruppe$ <> "Versuch" THEN GOSUB NeuFeld

IF taste$ = "l" OR taste$ = "L" THEN GOSUB FeldLaden

IF taste$ = "a" OR taste$ = "A" THEN GOSUB DatenAnzeige

IF taste$ = "s" AND DateiGruppe$ <> "Versuch" OR taste$ = "S" AND DateiGruppe$ <> "Versuch" THEN
Speichern DateiGruppe$
IF Fehler$ <> "" THEN
Texte$ = "zu viele " + Fehler$
Fehler$ = ""
ELSE
Texte$ = "gespeichert!"
END IF
ZeitTime! = TIMER
END IF

IF taste$ = "g" OR taste$ = "G" THEN GOSUB DateiGruppeNeu

IF taste$ = "e" AND DateiGruppe$ <> "Versuch" OR taste$ = "E" AND DateiGruppe$ <> "Versuch" THEN
LINE (23, 14)-(294, 173), 0, BF
Pfont "Wollen sie wirklich das letzte", 30, 60, 15, 0
Pfont "Feld der DateiGruppe loeschen?", 30, 80, 15, 0
Pfont "Feld:", 40, 100, 15, 0
ZahlPfont SpielFelder!, 40 + 7 * 8, 100, 15, 0
Pfont "j - Ja                   n - Nein", 30, 120, 15, 0
DO: taste$ = INKEY$: LOOP UNTIL taste$ = "j" OR taste$ = "J" OR taste$ = "n" OR taste$ = "N"
IF taste$ = "n" OR taste$ = "N" THEN GOTO weitern
IF SpielFelder! = 1 THEN SpielFeld$ = "1"
IF SpielFelder! = 2 THEN SpielFeld$ = "2"
IF SpielFelder! = 3 THEN SpielFeld$ = "3"
IF SpielFelder! = 4 THEN SpielFeld$ = "4"
IF SpielFelder! = 5 THEN SpielFeld$ = "5"
IF SpielFelder! = 6 THEN SpielFeld$ = "6"
IF SpielFelder! = 7 THEN SpielFeld$ = "7"
IF SpielFelder! = 8 THEN SpielFeld$ = "8"
IF SpielFelder! = 9 THEN SpielFeld$ = "9"
IF SpielFelder! = 10 THEN SpielFeld$ = "10"
IF SpielFelder! = 11 THEN SpielFeld$ = "11"
IF SpielFelder! = 12 THEN SpielFeld$ = "12"
IF SpielFelder! = 13 THEN SpielFeld$ = "13"
IF SpielFelder! = 14 THEN SpielFeld$ = "14"
IF SpielFelder! = 15 THEN SpielFeld$ = "15"
IF SpielFelder! = 16 THEN SpielFeld$ = "16"
IF SpielFelder! = 17 THEN SpielFeld$ = "17"
IF SpielFelder! = 18 THEN SpielFeld$ = "18"
IF SpielFelder! = 19 THEN SpielFeld$ = "19"
IF SpielFelder! = 20 THEN SpielFeld$ = "20"

KILL "Felder\" + DateiGruppe$ + SpielFeld$ + ".lab"
SpielFelder! = SpielFelder! - 1
OPEN "Felder\" + DateiGruppe$ + "0.lab" FOR OUTPUT AS 1
WRITE #1, SpielFelder!
WRITE #1, Startsp%
WRITE #1, Startze%
WRITE #1, StartFeld!
WRITE #1, StartZeit!
CLOSE
IF SpielFelder! = 0 THEN
KILL "Score\" + DateiGruppe$ + ".lab"
KILL "Felder\" + DateiGruppe$ + "0.lab"
OPEN "Felder\Inhalt.lab" FOR INPUT AS #1
Num = 0
DO WHILE NOT EOF(1)
Num = Num + 1
INPUT #1, Feld$(Num)
IF Feld$(Num) = DateiGruppe$ THEN Num2 = Num
LOOP
CLOSE 1
FOR Num3 = 1 TO Num
IF Feld$(Num3) = "" THEN
FOR Num4 = Num3 TO Num - 1
Feld$(Num4) = Feld$(Num4 + 1)
NEXT
Num3 = Num3 - 1
Num2 = Num2 - 1
Num = Num - 1
END IF
NEXT
FOR Num3 = Num2 TO Num
Feld$(Num3) = Feld$(Num3 + 1)
NEXT

OPEN "Felder\Inhalt.lab" FOR OUTPUT AS #1
FOR Num3 = 1 TO Num - 1
WRITE #1, Feld$(Num3)
NEXT
CLOSE 1


LINE (23, 14)-(294, 173), 0, BF
Pfont "Dateigruppe geloescht!", 50, 100, 15, 0
StartTime! = TIMER
DO: LOOP UNTIL StartTime! + 2 <= TIMER
CLS
IF Anwendung$ = "Auto" THEN
RUN "menue.bas"
ELSEIF Anwendung$ = "Naricht" THEN
Pfont "starte jetzt menue.bas", 10, 10, 15, 0
SLEEP 2
RUN "menue.bas"
ELSE
Pfont "menue.bas bitte starten", 10, 10, 15, 0
SYSTEM
END IF
END IF
IF SpielFeld! > SpielFelder! THEN SpielFeld! = SpielFelder!: Laden DateiGruppen$, 1
weitern:
LINE (23, 14)-(294, 173), 0, BF
Speicher
END IF

IF Kontextmenue! = 0 THEN
IF taste$ = "+" THEN Kachel! = Kachel! + 1
IF taste$ = "-" THEN Kachel! = Kachel! - 1
IF Kachel! < 0 THEN Kachel = 0
IF Kachel! > 58 THEN Kachel = 58       '+10   fr Level

LINE (162, 177)-(179, 194), 14, B

Bilden! = 1
Bilde! = Kachel!
'IF Bilde! = 0 THEN Bilde! = 100
x% = 162
y% = 177
Spiel
Bilde! = Kachel! - 1
'IF Bilde! = 0 THEN Bilde! = 100
x% = x% - 17
IF Kachel! >= 1 THEN
Spiel
ELSE
LINE (x% + 1, y% + 1)-(x% + 16, y% + 16), 0, BF
END IF
x% = x% + 17 + 17
Bilde! = Kachel! + 1
IF Kachel! <= 57 THEN        '+10 fr Level
Spiel
ELSE
LINE (x% + 1, y% + 1)-(x% + 16, y% + 16), 0, BF
END IF
Bilden! = 0
Bilde! = 0
ELSE
LINE (10, 178)-(310, 193), 4, BF
LINE (100, 177)-(200, 177), 31
LINE (100, 194)-(200, 194), 31
END IF

'FOR Numx! = 0 TO 18
'FOR Numy! = 0 TO 9
'LINE (XAnfang + Numx! * 16, YAnfang + Numy! * 16)-(XAnfang + (Numx! + 1) * 16, YAnfang + (Numy! + 1) * 16), 0, B
'NEXT
'NEXT
IF Rechteck! = 0 THEN
LINE (XAnfang + ze% * 16 + 1, YAnfang + (sp% - 1) * 16 + 1)-(XAnfang + ze% * 16 + 16, YAnfang + (sp% - 1) * 16 + 16), 12, B
ELSE
LINE (XAnfang + ze% * 16 + 1, YAnfang + (sp% - 1) * 16 + 1)-(XAnfang + ze01% * 16 + 16, YAnfang + (sp01% - 1) * 16 + 16), 12, B
END IF
Pfont Texte$, 8, 180, 15, 4

Pfont DateiGruppe$, 240, 180, 15, 4
ZahlPfont SpielFeld!, 240 + LEN(DateiGruppe$) * 8, 180, 15, 4
DO: taste$ = INKEY$: LOOP UNTIL INKEY$ = ""
IF ZeitTime! + 2 <= TIMER THEN Texte$ = "                 "
DO: taste$ = INKEY$: LOOP UNTIL taste$ <> ""
Mein! = 1
IF taste$ = CHR$(0) + "P" OR taste$ = CHR$(0) + "M" OR taste$ = CHR$(0) + "K" OR taste$ = CHR$(0) + "H" OR taste$ = "f" OR taste$ = "F" THEN
IF Rechteck! = 0 THEN
Spiel
ELSE
SWAP ze%, ze2%
SWAP sp%, sp2%
IF taste$ = CHR$(0) + "P" OR taste$ = CHR$(0) + "H" THEN
sp% = sp01%
FOR ze% = ze2% TO ze01%
  Spiel
NEXT
ELSEIF taste$ = CHR$(0) + "K" OR taste$ = CHR$(0) + "M" THEN
ze% = ze01%
FOR sp% = sp2% TO sp01%
  Spiel
NEXT
END IF
SWAP ze%, ze2%
SWAP sp%, sp2%
END IF
END IF

Mein! = 0
IF Kontextmenue! <> 0 AND taste$ = CHR$(27) THEN Kontextmenue! = 0: taste$ = ""
IF taste$ = CHR$(13) AND DateiGruppe$ = "Versuch" THEN taste$ = ""
IF Rechteck! = 1 THEN Kontextmenue! = 0
LOOP UNTIL taste$ = CHR$(27)
CLS
IF Anwendung$ = "Auto" THEN
RUN "menue.bas"
ELSEIF Anwendung$ = "Naricht" THEN
Pfont "starte jetzt menue.bas", 10, 10, 15, 0
SLEEP 2
RUN "menue.bas"
ELSE
Pfont "menue.bas bitte starten", 10, 10, 15, 0
SYSTEM
END IF

FeldLaden:
Texte$ = ""
Word! = 0
DO
LINE (23, 14)-(294, 173), 0, BF
Pfont "Bitte Feldnummer eingeben:", 50, 80, 15, 0
Pfont "Bei Einstelligen Zahlen bitte ", 30, 110, 15, 0
Pfont "eine 0 vorne drann!", 40, 120, 15, 0
IF LEN(DateiGruppen$) < 7 THEN Num2! = 1 ELSE Num2! = 0
FOR Num! = 0 TO Num2!
Pfont ".", 60 + Num! * 8, 90, 15, 0
NEXT
DO
IF taste$ = CHR$(8) THEN
 IF Word! = 0 THEN Texte$ = Texte$ + " ": Word! = 1
 Texte$ = LEFT$(Texte$, LEN(Texte$) - 1)
 IF Word = 1 THEN Pfont ".", 50 + Word! * 8, 90, 15, 0
 Word! = Word! - 1
 END IF
IF taste$ >= CHR$(48) AND taste$ <= CHR$(57) THEN
 'taste$ = UCASE$(taste$)
 IF Word! = 2 THEN
  Texte$ = LEFT$(Texte$, LEN(Texte$) - 1) + taste$

 ELSEIF Word! < 2 THEN
  Texte$ = Texte$ + taste$
  Word! = Word! + 1
 END IF
END IF
IF Texte$ <> "" THEN Pfont Texte$, 60, 90, 14, 0
IF Word! < 2 THEN Pfont ".", 60 + Word! * 8, 90, 15, 0
DO
taste$ = INKEY$
LOOP UNTIL taste$ <> ""
LOOP UNTIL taste$ = CHR$(13) OR taste$ = CHR$(27)

Texte = 0
FOR Num! = 10 TO 1 STEP -9
IF Num! = 10 THEN texten$ = LEFT$(Texte$, 1)
IF Num! = 1 THEN texten$ = RIGHT$(Texte$, 1)
IF texten$ = "0" THEN Texte = Texte + 0 * Num!
IF texten$ = "1" THEN Texte = Texte + 1 * Num!
IF texten$ = "2" THEN Texte = Texte + 2 * Num!
IF texten$ = "3" THEN Texte = Texte + 3 * Num!
IF texten$ = "4" THEN Texte = Texte + 4 * Num!
IF texten$ = "5" THEN Texte = Texte + 5 * Num!
IF texten$ = "6" THEN Texte = Texte + 6 * Num!
IF texten$ = "7" THEN Texte = Texte + 7 * Num!
IF texten$ = "8" THEN Texte = Texte + 8 * Num!
IF texten$ = "9" THEN Texte = Texte + 9 * Num!
NEXT

IF Texte > SpielFelder! OR Texte = 0 THEN EXIT DO
SpielFeld! = Texte
LOOP UNTIL taste$ = CHR$(13)

Laden DateiGruppe$, 1
LINE (23, 14)-(294, 173), 0, BF
Speicher
RETURN

DateiGruppeLaden:
Laden DateiGruppe$, 0
Laden DateiGruppe$, 1
wei:
LINE (23, 14)-(294, 173), 0, BF
Speicher
RETURN

NeuFeld:
DO: taste$ = INKEY$: LOOP UNTIL taste$ = ""
LINE (23, 14)-(294, 173), 0, BF
Pfont "Wollen sie wirklich ein neues", 30, 80, 15, 0
Pfont "      Feld erstellen?", 30, 100, 15, 0
Pfont "j - Ja               n - Nein", 30, 120, 15, 0
DO: taste$ = INKEY$: LOOP UNTIL taste$ = "j" OR taste$ = "J" OR taste$ = "n" OR taste$ = "N"
IF taste$ = "n" OR taste$ = "N" THEN
LINE (23, 14)-(294, 173), 0, BF
Speicher
RETURN
END IF
IF SpielFelder! = 9 AND LEN(DateiGruppe$) = 7 OR SpielFelder! = 20 THEN
Pfont "max. Spielfeldanzahl erreicht!", 30, 120, 30, 0
ZeitTime! = TIMER
DO: LOOP UNTIL ZeitTime! + 2 <= TIMER
RETURN
END IF
LINE (23, 14)-(294, 173), 0, BF
Pfont "Das neu erstellte Spielferld muss", 30, 60, 15, 0
Pfont "zuerst mit der ganzen Dateigruppe", 30, 80, 15, 0
Pfont "      gespeichert werden!", 30, 100, 15, 0
Pfont "j - Ja                   n - Nein", 30, 120, 15, 0
DO: taste$ = INKEY$: LOOP UNTIL taste$ = "j" OR taste$ = "J" OR taste$ = "n" OR taste$ = "N"
IF taste$ = "n" OR taste$ = "N" THEN
LINE (23, 14)-(294, 173), 0, BF
Speicher
RETURN
END IF
SpielFelder! = SpielFelder! + 1
FOR Numx! = 1 TO 10
 FOR Numy! = 1 TO 17
  Feld!(Numx!, Numy!, 0) = 1: Feld!(Numx!, Numy!, 1) = 0: Feld!(Numx!, Numy!, 2) = 0: Feld!(Numx!, Numy!, 3) = 0
 NEXT
NEXT

FOR Num! = 0 TO 3
 FOR Numy! = 0 TO 18 STEP 18
  FOR Numx! = 1 TO 10
  Feld!(Numx!, Numy!, Num!) = 0
  NEXT
 NEXT
NEXT
LINE (23, 14)-(294, 173), 0, BF
SpielFeld! = SpielFelder!
Speichern DateiGruppe$
Speicher
RETURN

DatenAnzeige:
LINE (23, 14)-(294, 173), 0, BF
Pfont "Daten der Dateigruppe ,," + DateiGruppe$ + "''", 30, 20, 15, 0
Pfont "Spielfelder:", 30, 40, 15, 0
Pfont "Muenzen:", 30, 60, 15, 0
Pfont "Gegner:", 30, 80, 15, 0
Pfont "Bomben:", 30, 100, 15, 0

ZahlPfont SpielFelder!, 30 + 9 * 13, 40, 15, 0
ZahlPfont Zahl!(0), 30 + 9 * 8, 60, 15, 0
ZahlPfont Zahl!(1), 30 + 9 * 8, 80, 15, 0
ZahlPfont Zahl!(2), 30 + 9 * 8, 100, 15, 0
DO: taste$ = INKEY$: LOOP UNTIL taste$ = ""
DO: taste$ = INKEY$: LOOP UNTIL taste$ <> ""
LINE (23, 14)-(294, 173), 0, BF
Speicher
RETURN

DateiGruppeNeu:
LINE (23, 14)-(294, 173), 0, BF
Word! = 0
Texte$ = ""
Pfont "Neue Dateigruppenname eingeben:", 30, 80, 15, 0
FOR Num! = 0 TO 6
Pfont ".", 50 + Num! * 8, 90, 15, 0
NEXT
DO
IF taste$ = CHR$(8) THEN
 IF Word! = 0 THEN Texte$ = Texte$ + " ": Word! = 1
 Texte$ = LEFT$(Texte$, LEN(Texte$) - 1)
 IF Word < 7 THEN Pfont ".", 50 + Word! * 8, 90, 15, 0
 Word! = Word! - 1
 END IF
IF taste$ > CHR$(29) AND taste$ < CHR$(255) THEN
 'taste$ = UCASE$(taste$)
 'IF taste$ <> "0" OR taste$ <> "1" OR taste$ <> "2" OR taste$ <> "3" OR taste$ <> "4" OR taste$ <> "5" OR taste$ <> "6" OR taste$ <> "7" OR taste$ <> "8" OR taste$ <> "9" THEN taste$ = UCASE$(taste$)

 IF Word! = 7 THEN
  Texte$ = LEFT$(Texte$, LEN(Texte$) - 1) + taste$
 ELSEIF Word! < 7 THEN
  Texte$ = Texte$ + taste$
  Word! = Word! + 1
 END IF
END IF
Pfont Texte$, 50, 90, 15, 0
IF Word! < 7 THEN Pfont ".", 50 + Word! * 8, 90, 15, 0
DO
taste$ = INKEY$
LOOP UNTIL taste$ <> ""
LOOP UNTIL taste$ = CHR$(13) OR taste$ = CHR$(27)
IF taste$ = CHR$(27) THEN
LINE (23, 14)-(294, 173), 0, BF
Speicher
RETURN
END IF
OPEN "Felder\Inhalt.lab" FOR INPUT AS #1
Num = 0
DO WHILE NOT EOF(1)
Num = Num + 1
INPUT #1, Feld$(Num)
IF Feld$(Num) = DateiGruppe$ THEN Num2 = Num
LOOP
CLOSE 1
FOR Num2 = 1 TO Num
IF UCASE$(Texte$) = UCASE$(Feld$(Num2)) OR UCASE$(Texte$) = "HAUPTS" THEN
Pfont "Dateigruppe bereits vorhanden!", 30, 160, 15, 0
StartTime! = TIMER
DO: LOOP UNTIL StarTime! + 2 <= TIMER
GOTO DateiGruppeNeu
END IF
NEXT
DateiGruppe$ = Texte$
StartZeit! = 600
Startsp% = 1
Startze% = 1
StartFeld! = 1
SpielFelder! = 1
SpielFeld! = 1

FOR Numx! = 1 TO 10
 FOR Numy! = 1 TO 17
  Feld!(Numx!, Numy!, 0) = 1: Feld!(Numx!, Numy!, 1) = 0: Feld!(Numx!, Numy!, 2) = 0: Feld!(Numx!, Numy!, 3) = 0
 NEXT
NEXT

FOR Num! = 0 TO 3
 FOR Numy! = 0 TO 18 STEP 18
  FOR Numx! = 1 TO 10
  Feld!(Numx!, Numy!, Num!) = 0
  NEXT
 NEXT
NEXT

Speichern DateiGruppe$
OPEN "Score\" + DateiGruppe$ + ".lab" FOR OUTPUT AS #1
FOR Num = 1 TO 10
WRITE #1, "----------", 0, "--.--.----"
NEXT
CLOSE 1
Laden DateiGruppe$, 0
Laden DateiGruppe$, 1
LINE (23, 14)-(294, 173), 0, BF
Speicher

OPEN "Felder\Inhalt.lab" FOR APPEND AS #1
WRITE #1, DateiGruppe$
CLOSE 1
RETURN

Startpunkt:
LINE (23, 14)-(294, 173), 0, BF
Pfont "Startpunkt", 60, 30, 15, 0

Pfont "Spalte:", 70, 60, 15, 0
Pfont "Zeile:", 70, 70, 15, 0
Pfont "Spielfeld:", 70, 80, 15, 0
Pfont "Spielzeit:", 70, 100, 15, 0
Pfont "Pfeiltasten hoch/runter; +/-", 50, 120, 15, 0
Startsp! = Startsp%
Startze! = Startze%
StartFeld2! = StartFeld!
StartZeit2! = StartZeit!
menu = 1
DO
IF taste$ = "+" THEN
IF menu = 1 THEN Startsp! = Startsp! + 1
IF menu = 2 THEN Startze! = Startze! + 1
IF menu = 3 THEN StartFeld2! = StartFeld2! + 1
IF menu = 5 THEN StartZeit2! = StartZeit2! + 1
ELSEIF taste$ = "-" THEN
IF menu = 1 THEN Startsp! = Startsp! - 1
IF menu = 2 THEN Startze! = Startze! - 1
IF menu = 3 THEN StartFeld2! = StartFeld2! - 1
IF menu = 5 THEN StartZeit2! = StartZeit2! - 1
END IF

IF Startsp! > 10 THEN Startsp! = 10
IF Startsp! < 1 THEN Startsp! = 1
IF Startze! > 17 THEN Startze! = 17
IF Startze! < 1 THEN Startze! = 1

IF StartFeld2! < 1 THEN StartFeld! = 1
IF StartFeld2! > SpielFelder! THEN StartFeld2! = SpielFelder!
IF StartZeit2! < 60 THEN StartZeit2! = 60
IF StartZeit2! > 3600 THEN StartZeit2! = 3600

Pfont "    ", 150, 60, 15, 0
Pfont "    ", 150, 70, 15, 0
Pfont "    ", 150, 80, 15, 0
Pfont "    ", 150, 100, 15, 0

ZahlPfont Startsp!, 150, 60, 15, 0
ZahlPfont Startze!, 150, 70, 15, 0
ZahlPfont StartFeld2!, 150, 80, 15, 0
ZahlPfont StartZeit2!, 150, 100, 15, 0

Pfont " ", 190, 50 + menu * 10, 15, 0

IF taste$ = CHR$(0) + "P" THEN
menu = menu + 1
IF menu = 4 THEN menu = 5
ELSEIF taste$ = CHR$(0) + "H" THEN
menu = menu - 1
IF menu = 4 THEN menu = 3
END IF
IF menu < 1 THEN menu = 5
IF menu > 5 THEN menu = 1
Pfont CHR$(27), 190, 50 + menu * 10, 15, 0


DO: taste$ = INKEY$: LOOP WHILE taste$ = ""
LOOP UNTIL taste$ = CHR$(27) OR taste$ = CHR$(13)
IF taste$ = CHR$(13) THEN

Startsp% = Startsp!
Startze% = Startze!
StartZeit! = StartZeit2!
StartFeld! = StartFeld2!
OPEN "Felder/" + DateiGruppe$ + "0.lab" FOR OUTPUT AS 1
WRITE #1, SpielFelder!
WRITE #1, Startsp%
WRITE #1, Startze%
WRITE #1, StartFeld!
WRITE #1, StartZeit!
WRITE #1, Level$(0)
WRITE #1, Level$(1)
WRITE #1, Level$(2)
WRITE #1, Level$(3)
WRITE #1, Level$(4)
WRITE #1, Level$(5)
WRITE #1, Level$(6)
WRITE #1, Level$(7)
WRITE #1, Level$(8)
WRITE #1, Level$(9)
CLOSE 1
END IF


DO: taste$ = INKEY$: LOOP UNTIL taste$ = ""
LINE (23, 14)-(294, 173), 0, BF
Speicher


RETURN

REM $STATIC
SUB Laden (Datei$, art!)

IF art! = 0 THEN
Zahl!(0) = 0
Zahl!(1) = 0
Zahl!(2) = 0
OPEN "Felder\" + Datei$ + "0.lab" FOR INPUT AS 1
INPUT #1, SpielFelder!
INPUT #1, Startsp%
INPUT #1, Startze%
INPUT #1, StartFeld!
INPUT #1, StartZeit!
INPUT #1, Level$(0)
INPUT #1, Level$(1)
INPUT #1, Level$(2)
INPUT #1, Level$(3)
INPUT #1, Level$(4)
INPUT #1, Level$(5)
INPUT #1, Level$(6)
INPUT #1, Level$(7)
INPUT #1, Level$(8)
INPUT #1, Level$(9)
CLOSE
FOR SpielFeld! = 1 TO SpielFelder!
GOSUB SpielfeldLaden
FOR sp2% = 1 TO 10
 FOR ze2% = 1 TO 17
  IF Feld!(sp2%, ze2%, 0) = 35 THEN Zahl!(0) = Zahl!(0) + 1: Muenzen(Num1!, 1) = sp2%: Muenzen(Num!, 2) = ze2%
  IF Feld!(sp2%, ze2%, 0) >= 41 AND Feld!(sp2%, ze2%, 0) <= 43 THEN Zahl!(1) = Zahl!(1) + 1: GegnerSpiel!(Num2!, 1) = sp2%: GegnerSpiel!(Num!, 2) = ze2%: GegnerSpiel!(Num!, 0) = 1
  IF Feld!(sp2%, ze2%, 0) = 46 THEN Zahl!(2) = Zahl!(2) + 1: BombeSpiel!(Num2!, 1) = sp2%: BombeSpiel!(Num!, 2) = ze2%
  IF Feld!(sp2%, ze2%, 0) >= 44 AND Feld!(sp2%, ze2%, 0) <= 45 THEN Zahl!(3) = Zahl!(3) + 1: SpielLoch!(Num2!, 1) = sp2%: SpielLoch!(Num!, 2) = ze2%
 NEXT
NEXT
NEXT
SpielFeld! = StartFeld!
ELSEIF art! = 1 THEN
GOSUB SpielfeldLaden
END IF


EXIT SUB
SpielfeldLaden:
IF SpielFeld! = 1 THEN SpielFeld$ = "1"
IF SpielFeld! = 2 THEN SpielFeld$ = "2"
IF SpielFeld! = 3 THEN SpielFeld$ = "3"
IF SpielFeld! = 4 THEN SpielFeld$ = "4"
IF SpielFeld! = 5 THEN SpielFeld$ = "5"
IF SpielFeld! = 6 THEN SpielFeld$ = "6"
IF SpielFeld! = 7 THEN SpielFeld$ = "7"
IF SpielFeld! = 8 THEN SpielFeld$ = "8"
IF SpielFeld! = 9 THEN SpielFeld$ = "9"
IF SpielFeld! = 10 THEN SpielFeld$ = "10"
IF SpielFeld! = 11 THEN SpielFeld$ = "11"
IF SpielFeld! = 12 THEN SpielFeld$ = "12"
IF SpielFeld! = 13 THEN SpielFeld$ = "13"
IF SpielFeld! = 14 THEN SpielFeld$ = "14"
IF SpielFeld! = 15 THEN SpielFeld$ = "15"
IF SpielFeld! = 16 THEN SpielFeld$ = "16"
IF SpielFeld! = 17 THEN SpielFeld$ = "17"
IF SpielFeld! = 18 THEN SpielFeld$ = "18"
IF SpielFeld! = 19 THEN SpielFeld$ = "19"
IF SpielFeld! = 20 THEN SpielFeld$ = "20"
IF SpielFeld$ = "" THEN EXIT SUB
OPEN "Felder\" + Datei$ + SpielFeld$ + ".lab" FOR INPUT AS 1
FOR Numx! = 1 TO 170
 INPUT #1, Boden(Numx!, 0), Boden(Numx!, 1)
NEXT

FOR Numx! = 1 TO 10
 FOR Numy! = 0 TO 18
  INPUT #1, Feld!(Numx!, Numy!, 0), Feld!(Numx!, Numy!, 1), Feld!(Numx!, Numy!, 2), Feld!(Numx!, Numy!, 3)
 NEXT
NEXT
CLOSE
RETURN

END SUB

DEFINT A-Z
SUB Pfont (TEXTES$, x, y, Farbe, HFarbe)
IF HFarbe = 500 THEN TEST = 1:

DEF SEG = &HFFA6
FOR PIECE = 1 TO LEN(TEXTES$)
        ADRESSE = (8 * ASC(MID$(TEXTES$, PIECE))) + 14
    
FOR HL = 0 TO 7
                MASK = PEEK(ADRESSE + HL) * 128
                IF Farbe = 400 THEN GOTO 743
                IF TEST <> 1 THEN LINE (x + KERNX, y + HL)-(x + 8 + KERNX, y + HL), HFarbe, BF, 0
                IF MASK >= 16384 THEN MASK = MASK - 16384: PSET (x + KERNX, y + HL), Farbe - HL + 16
                IF MASK >= 8192 THEN MASK = MASK - 8192: PSET (x + KERNX + 1, y + HL), Farbe - HL + 15
                IF MASK >= 4096 THEN MASK = MASK - 4096: PSET (x + KERNX + 2, y + HL), Farbe - HL + 14
                IF MASK >= 2048 THEN MASK = MASK - 2048: PSET (x + KERNX + 3, y + HL), Farbe - HL + 13
                IF MASK >= 1024 THEN MASK = MASK - 1024: PSET (x + KERNX + 4, y + HL), Farbe - HL + 12
                IF MASK >= 512 THEN MASK = MASK - 512: PSET (x + KERNX + 5, y + HL), Farbe - HL + 11
                IF MASK >= 256 THEN MASK = MASK - 256: PSET (x + KERNX + 6, y + HL), Farbe - HL + 10
                GOTO 744
743
                IF MASK >= 16384 THEN MASK = MASK - 16384: PSET (x + KERNX, y + HL), 0
                IF MASK >= 8192 THEN MASK = MASK - 8192: PSET (x + KERNX + 1, y + HL), 0
                IF MASK >= 4096 THEN MASK = MASK - 4096: PSET (x + KERNX + 2, y + HL), 0
                IF MASK >= 2048 THEN MASK = MASK - 2048: PSET (x + KERNX + 3, y + HL), 0
                IF MASK >= 1024 THEN MASK = MASK - 1024: PSET (x + KERNX + 4, y + HL), 0
                IF MASK >= 512 THEN MASK = MASK - 512: PSET (x + KERNX + 5, y + HL), 0
                IF MASK >= 256 THEN MASK = MASK - 256: PSET (x + KERNX + 6, y + HL), 0

744
        NEXT
 KERNX = KERNX + 8
NEXT
x = 0
DEF SEG

END SUB

DEFSNG A-Z
SUB Speicher
SCREEN 13
LINE (1, 1)-(318, 198), 112, B
LINE (2, 2)-(317, 197), 4, BF
LINE (3, 3)-(316, 196), 40, B
LINE (4, 4)-(315, 195), 42, B
LINE (5, 5)-(314, 194), 31, B

LINE (19, 10)-(298, 177), 0, BF
LINE (19, 10)-(298, 177), 31, B
LINE (20, 11)-(297, 176), 29, B
LINE (21, 12)-(296, 175), 27, B
LINE (22, 13)-(295, 174), 25, B

LINE (137, 0)-(192, 15), 0, BF
FOR Num1! = 1 TO 48
 FOR Num2! = 1 TO 8
  PSET (140 + Num1!, 3 + Num2!), Schrifft(2, Num1!, Num2!)
 NEXT
NEXT
LINE (137, 0)-(192, 15), 31, B
LINE (138, 1)-(191, 14), 29, B
LINE (139, 2)-(190, 13), 27, B
LINE (140, 3)-(189, 12), 25, B

sp2% = sp%
ze2% = ze%
FOR Numx = 1 TO 10
 FOR Numy = 0 TO 18
 sp% = Numx
 ze% = Numy
 Spiel
NEXT: NEXT
sp% = sp2%
ze% = ze2%
END SUB

SUB Speichern (Datei$)
DIM Zah!(5)
FOR Numx! = 1 TO 10
 FOR Numy! = 0 TO 18
    IF Feld!(Numx!, Numy!, 0) = 35 THEN Zah!(0) = Zah!(0) + 1
    IF Feld!(Numx!, Numy!, 0) = 41 OR Feld!(Numx!, Numy!, 0) = 42 OR Feld!(Numx!, Numy!, 0) = 43 THEN Zah!(1) = Zah!(1) + 1
    IF Feld!(Numx!, Numy!, 0) = 44 OR Feld!(Numx!, Numy!, 0) = 45 THEN Zah!(2) = Zah!(2) + 1
    IF Feld!(Numx!, Numy!, 0) = 46 THEN Zah!(3) = Zah!(3) + 1
  IF Zah!(0) > 100 THEN Fehler$ = "Muenzen"
  IF Zah!(1) > 30 THEN Fehler$ = "Pfeilg."
  IF Zah!(2) > 20 THEN Fehler$ = "Gruben"
  IF Zah!(3) > 10 THEN Fehler$ = "Bomben"
  NEXT
NEXT
CLOSE
IF Fehler$ <> "" THEN EXIT SUB


OPEN "Felder\" + Datei$ + "0.lab" FOR OUTPUT AS 1
WRITE #1, SpielFelder!
WRITE #1, Startsp%
WRITE #1, Startze%
WRITE #1, StartFeld!
WRITE #1, StartZeit!
WRITE #1, Level$(0)
WRITE #1, Level$(1)
WRITE #1, Level$(2)
WRITE #1, Level$(3)
WRITE #1, Level$(4)
WRITE #1, Level$(5)
WRITE #1, Level$(6)
WRITE #1, Level$(7)
WRITE #1, Level$(8)
WRITE #1, Level$(9)
CLOSE

SpielfeldSpeichern:
IF SpielFeld! = 1 THEN SpielFeld$ = "1"
IF SpielFeld! = 2 THEN SpielFeld$ = "2"
IF SpielFeld! = 3 THEN SpielFeld$ = "3"
IF SpielFeld! = 4 THEN SpielFeld$ = "4"
IF SpielFeld! = 5 THEN SpielFeld$ = "5"
IF SpielFeld! = 6 THEN SpielFeld$ = "6"
IF SpielFeld! = 7 THEN SpielFeld$ = "7"
IF SpielFeld! = 8 THEN SpielFeld$ = "8"
IF SpielFeld! = 9 THEN SpielFeld$ = "9"
IF SpielFeld! = 10 THEN SpielFeld$ = "10"
IF SpielFeld! = 11 THEN SpielFeld$ = "11"
IF SpielFeld! = 12 THEN SpielFeld$ = "12"
IF SpielFeld! = 13 THEN SpielFeld$ = "13"
IF SpielFeld! = 14 THEN SpielFeld$ = "14"
IF SpielFeld! = 15 THEN SpielFeld$ = "15"
IF SpielFeld! = 16 THEN SpielFeld$ = "16"
IF SpielFeld! = 17 THEN SpielFeld$ = "17"
IF SpielFeld! = 18 THEN SpielFeld$ = "18"
IF SpielFeld! = 19 THEN SpielFeld$ = "19"
IF SpielFeld! = 20 THEN SpielFeld$ = "20"

OPEN "Felder\" + Datei$ + SpielFeld$ + ".lab" FOR OUTPUT AS 1
FOR Numx! = 1 TO 170
 WRITE #1, Boden(Numx!, 0), Boden(Numx!, 1)
NEXT

FOR Numx! = 1 TO 10
 FOR Numy! = 0 TO 18
  WRITE #1, Feld!(Numx!, Numy!, 0), Feld!(Numx!, Numy!, 1), Feld!(Numx!, Numy!, 2), Feld!(Numx!, Numy!, 3)
 NEXT
NEXT
CLOSE


END SUB

SUB Spiel
XBild = XAnfang
YBild = YAnfang
    SCREEN 13
 
  IF Bilden! = 1 THEN
  Feldz! = Feld!(sp%, ze%, 0)
  Feld!(sp%, ze%, 0) = -1
  Za! = Bilde!
  ELSE
  Bilde! = -1
  Za! = Feld(sp%, ze%, 0)
  END IF
FOR Xachse = 1 TO 16
 FOR YAchse = 1 TO 16
   
  IF Bilde! >= 0 AND Bilde! <= 9 THEN
  Za! = -1: Pixel! = Bode(1 + Bilde!, Xachse, YAchse)
  ELSEIF Za! >= 10 AND Za! <= 19 THEN
  Pixel! = Wande(Za! - 9, Xachse, YAchse)
  ELSEIF Za! >= 20 AND Za! <= 29 THEN
  Pixel! = Rohr(Za! - 19, Xachse, YAchse)
  ELSEIF Za! >= 30 AND Za! <= 35 THEN
  Pixel! = Rohr2(Za! - 29, Xachse, YAchse)
  ELSEIF Za! = 36 THEN
  Pixel! = Rohr2(8, Xachse, YAchse)
  ELSEIF Za! = 37 THEN
  Pixel! = Rohr2(10, Xachse, YAchse)
  ELSEIF Za! = 38 THEN
  Pixel! = Rohr2(9, Xachse, YAchse)
  ELSEIF Feld!(sp%, ze%, 0) = 39 OR Bilde! = 39 THEN
  Pixel! = Gegner2(6, Xachse, YAchse)
  ELSEIF Feld!(sp%, ze%, 0) = 40 OR Bilde! = 40 THEN
  Pixel! = Gegner2(5, Xachse, YAchse)
  ELSEIF Feld!(sp%, ze%, 0) = 41 OR Bilde! = 41 THEN
  Pixel! = Feuer(6, Xachse, YAchse)
  ELSEIF Feld!(sp%, ze%, 0) = 42 OR Bilde! = 42 THEN
  Pixel! = Feuer(7, Xachse, YAchse)
  ELSEIF Feld!(sp%, ze%, 0) = 43 OR Bilde! = 43 THEN
  Pixel! = Feuer(8, Xachse, YAchse)
  ELSEIF Feld!(sp%, ze%, 0) = 44 OR Bilde! = 44 THEN
  Pixel! = Feuer(9, Xachse, YAchse)
  ELSEIF Feld!(sp%, ze%, 0) = 45 OR Bilde! = 45 THEN
  Pixel! = Feuer(10, Xachse, YAchse)
  ELSEIF Za! = 46 THEN
   Pixel! = Bombe2(1, Xachse, YAchse)
  ELSEIF Za! = 47 THEN
   IF ze% = 0 AND Bilden! = 0 THEN
    Pixel! = Gegner2(10, Xachse, YAchse)
   ELSEIF ze% = 18 AND Bilden! = 0 THEN
    Pixel! = Bombe2(7, Xachse, YAchse)
   ELSEIF Bilden! = 1 THEN
    IF Xachse <= 8 THEN
     Pixel! = Gegner2(10, Xachse, YAchse)
    ELSE
     Pixel! = Bombe2(7, Xachse, YAchse)
    END IF
   END IF
  ELSEIF Za! >= 48 AND Za! <= 57 THEN
   Pixel! = Tuer(Za! - 47, Xachse, YAchse)
  ELSEIF Za! = 58 THEN
   Pixel! = Bombe2(8, Xachse, YAchse)
  ELSEIF Za! >= 59 AND Za! <= 68 THEN
   Pixel! = Level2(Za! - 58, Xachse, YAchse)
  END IF

IF Za! >= 10 AND Za! <> 58 AND Za! <> 35 AND Za! <> 47 THEN
 IF Stufe! = 1 THEN
 Pixel! = Bombe2(10, Xachse, YAchse)
 ELSEIF Stufe! >= 2 AND Za! <> 11 AND Za! < 20 OR Stufe! >= 2 AND Za! > 34 THEN
  IF Stufe! = 2 THEN
  Pixel! = Bombe2(10, Xachse, YAchse)
  ELSEIF Stufe! >= 3 AND Za! <> 10 AND Za! <> 39 AND Za! <> 40 THEN
   IF Stufe! = 3 THEN
   Pixel! = Bombe2(10, Xachse, YAchse)
   ELSEIF Stufe! >= 4 AND Za! <> 36 AND Za! <> 38 AND Za! <> 15 THEN
    IF Stufe! = 4 THEN
    Pixel! = Bombe2(10, Xachse, YAchse)
    ELSEIF Stufe! >= 5 AND Za! <> 19 AND Za! <> 37 AND Za! <> 48 AND Za! <> 53 AND Za! <> 50 AND Za! <> 54 THEN
     IF Stufe! = 5 THEN
     Pixel! = Bombe2(10, Xachse, YAchse)
     ELSEIF Stufe! >= 6 AND Za! <> 18 AND Za! <> 41 AND Za! <> 42 AND Za! <> 43 AND Za! <> 49 THEN
      IF Stufe! = 6 THEN
      Pixel! = Bombe2(10, Xachse, YAchse)
      ELSEIF Stufe! >= 7 AND Za! <> 12 AND Za! <> 46 AND Za! <> 56 THEN
       IF Stufe! = 7 THEN
       Pixel! = Bombe2(10, Xachse, YAchse)
       ELSEIF Stufe! >= 8 AND Za! <> 13 AND Za! <> 52 THEN
        IF Stufe! = 8 THEN
        Pixel! = Bombe2(10, Xachse, YAchse)
        ELSEIF Stufe! >= 9 AND Za! <> 14 AND Za! <> 44 AND Za! <> 45 AND Za! <> 51 THEN
         IF Stufe! = 9 THEN
         Pixel! = Bombe2(10, Xachse, YAchse)
         ELSEIF Stufe! = 10 AND Za! <> 16 AND Za! <> 57 THEN
         Pixel! = Bombe2(10, Xachse, YAchse)
         END IF
        END IF
       END IF
      END IF
     END IF
    END IF
   END IF
  END IF
 END IF
END IF

IF Pixel! = 0 AND Za! >= 10 AND Stufe! >= 1 THEN
IF ze% <> 0 AND ze% <> 18 AND Bilden! = 0 OR Bilden! = 1 THEN
IF Stufe! = 1 THEN
Pixel! = Bombe2(9, Xachse, YAchse)
ELSEIF Stufe! >= 2 AND Boden(ze% + (sp% - 1) * 17, 0) <> 1 THEN
 IF Stufe! = 2 THEN
 Pixel! = Bombe2(9, Xachse, YAchse)
 ELSEIF Stufe! >= 3 AND Boden(ze% + (sp% - 1) * 17, 0) <> 0 THEN
  IF Stufe! = 3 THEN
  Pixel! = Bombe2(9, Xachse, YAchse)
  ELSEIF Stufe! >= 4 AND Boden(ze% + (sp% - 1) * 17, 0) <> 6 THEN
   IF Stufe! = 4 THEN
   Pixel! = Bombe2(9, Xachse, YAchse)
   ELSEIF Stufe! >= 5 AND Boden(ze% + (sp% - 1) * 17, 0) <> 7 THEN
    IF Stufe! = 5 THEN
    Pixel! = Bombe2(9, Xachse, YAchse)
    ELSEIF Stufe! >= 6 AND Boden(ze% + (sp% - 1) * 17, 0) <> 8 THEN
     IF Stufe! = 6 THEN
     Pixel! = Bombe2(9, Xachse, YAchse)
     ELSEIF Stufe! >= 7 AND Boden(ze% + (sp% - 1) * 17, 0) <> 2 THEN
      IF Stufe! = 7 THEN
      Pixel! = Bombe2(9, Xachse, YAchse)
      ELSEIF Stufe! >= 8 AND Boden(ze% + (sp% - 1) * 17, 0) <> 3 THEN
       IF Stufe! = 8 THEN
       Pixel! = Bombe2(9, Xachse, YAchse)
       ELSEIF Stufe! >= 9 AND Boden(ze% + (sp% - 1) * 17, 0) <> 4 THEN
        IF Stufe! = 9 THEN
        Pixel! = Bombe2(9, Xachse, YAchse)
        ELSEIF Stufe! = 10 AND Boden(ze% + (sp% - 1) * 17, 0) <> 9 THEN
        Pixel! = Bombe2(9, Xachse, YAchse)
        END IF
       END IF
      END IF
     END IF
    END IF
   END IF
  END IF
 END IF
END IF
END IF
END IF

IF Pixel! = 0 AND Za! >= 10 AND ze% <> 0 AND ze% <> 18 THEN
 IF Boden(ze% + (sp% - 1) * 17, 0) = 9 THEN
  Senkr! = 0
  Wager! = 0
  IF Boden(ze% + (sp% - 1) * 17, 1) = 0 OR Boden(ze% + (sp% - 1) * 17, 1) = 2 THEN Wager! = 1
  IF Boden(ze% + (sp% - 1) * 17, 1) = 1 OR Boden(ze% + (sp% - 1) * 17, 1) = 2 THEN Senkr! = 1
  IF Bode(1 + Boden(ze% + (sp% - 1) * 17, 0), Xachse, YAchse) = 40 THEN
   Bo! = Boden(ze% - Wager! + (sp% + Senkr! - 1) * 17, 0)
   Pixel! = Bode(1 + Bo!, Xachse, YAchse)
  ELSEIF Bode(1 + Boden(ze% + (sp% - 1) * 17, 0), Xachse, YAchse) = 47 THEN
   Bo! = Boden(ze% - Wager! + (sp% - Senkr! - 1) * 17, 0)
   Pixel! = Bode(1 + Bo!, Xachse, YAchse)
  ELSEIF Bode(1 + Boden(ze% + (sp% - 1) * 17, 0), Xachse, YAchse) = 32 THEN
   Bo! = Boden(ze% + Wager! + (sp% - Senkr! - 1) * 17, 0)
   Pixel! = Bode(1 + Bo!, Xachse, YAchse)
  ELSEIF Bode(1 + Boden(ze% + (sp% - 1) * 17, 0), Xachse, YAchse) = 31 THEN
   Bo! = Boden(ze% + Wager! + (sp% + Senkr! - 1) * 17, 0)
   Pixel! = Bode(1 + Bo!, Xachse, YAchse)
  END IF
 ELSE
  Pixel! = Bode(1 + Boden(ze% + (sp% - 1) * 17, 0), Xachse, YAchse)
 END IF
ELSEIF Za! <= 9 AND Bilden! = 0 AND ze% <> 0 AND ze% <> 18 THEN
 IF Boden(ze% + (sp% - 1) * 17, 0) = 9 THEN
  Senkr! = 0
  Wager! = 0
  IF Boden(ze% + (sp% - 1) * 17, 1) = 0 OR Boden(ze% + (sp% - 1) * 17, 1) = 2 THEN Wager! = 1
  IF Boden(ze% + (sp% - 1) * 17, 1) = 1 OR Boden(ze% + (sp% - 1) * 17, 1) = 2 THEN Senkr! = 1
  IF Bode(1 + Boden(ze% + (sp% - 1) * 17, 0), Xachse, YAchse) = 40 THEN
   Bo! = Boden(ze% - Wager! + (sp% + Senkr! - 1) * 17, 0)
   Pixel! = Bode(1 + Bo!, Xachse, YAchse)
  ELSEIF Bode(1 + Boden(ze% + (sp% - 1) * 17, 0), Xachse, YAchse) = 47 THEN
   Bo! = Boden(ze% - Wager! + (sp% - Senkr! - 1) * 17, 0)
   Pixel! = Bode(1 + Bo!, Xachse, YAchse)
  ELSEIF Bode(1 + Boden(ze% + (sp% - 1) * 17, 0), Xachse, YAchse) = 32 THEN
   Bo! = Boden(ze% + Wager! + (sp% - Senkr! - 1) * 17, 0)
   Pixel! = Bode(1 + Bo!, Xachse, YAchse)
  ELSEIF Bode(1 + Boden(ze% + (sp% - 1) * 17, 0), Xachse, YAchse) = 31 THEN
   Bo! = Boden(ze% + Wager! + (sp% + Senkr! - 1) * 17, 0)
   Pixel! = Bode(1 + Bo!, Xachse, YAchse)
  END IF
 ELSE
  Pixel! = Bode(1 + Boden(ze% + (sp% - 1) * 17, 0), Xachse, YAchse)
 END IF
END IF

IF Za! <= 9 AND Stufe! >= 1 AND ze% <> 0 AND ze% <> 18 AND Bilden! = 0 THEN
IF Stufe! = 1 THEN
Pixel! = Bombe2(9, Xachse, YAchse)
ELSEIF Stufe! >= 2 AND Boden(ze% + (sp% - 1) * 17, 0) <> 1 THEN
 IF Stufe! = 2 THEN
 Pixel! = Bombe2(9, Xachse, YAchse)
 ELSEIF Stufe! >= 3 AND Boden(ze% + (sp% - 1) * 17, 0) <> 0 THEN
  IF Stufe! = 3 THEN
  Pixel! = Bombe2(9, Xachse, YAchse)
  ELSEIF Stufe! >= 4 AND Boden(ze% + (sp% - 1) * 17, 0) <> 6 THEN
   IF Stufe! = 4 THEN
   Pixel! = Bombe2(9, Xachse, YAchse)
   ELSEIF Stufe! >= 5 AND Boden(ze% + (sp% - 1) * 17, 0) <> 7 THEN
    IF Stufe! = 5 THEN
    Pixel! = Bombe2(9, Xachse, YAchse)
    ELSEIF Stufe! >= 6 AND Boden(ze% + (sp% - 1) * 17, 0) <> 8 THEN
     IF Stufe! = 6 THEN
     Pixel! = Bombe2(9, Xachse, YAchse)
     ELSEIF Stufe! >= 7 AND Boden(ze% + (sp% - 1) * 17, 0) <> 2 THEN
      IF Stufe! = 7 THEN
      Pixel! = Bombe2(9, Xachse, YAchse)
      ELSEIF Stufe! >= 8 AND Boden(ze% + (sp% - 1) * 17, 0) <> 3 THEN
       IF Stufe! = 8 THEN
       Pixel! = Bombe2(9, Xachse, YAchse)
       ELSEIF Stufe! >= 9 AND Boden(ze% + (sp% - 1) * 17, 0) <> 4 THEN
        IF Stufe! = 9 THEN
        Pixel! = Bombe2(9, Xachse, YAchse)
        ELSEIF Stufe! = 10 AND Boden(ze% + (sp% - 1) * 17, 0) <> 9 THEN
        Pixel! = Bombe2(9, Xachse, YAchse)
        END IF
       END IF
      END IF
     END IF
    END IF
   END IF
  END IF
 END IF
END IF
ELSEIF Bilde! <= 9 AND Bilden! = 1 THEN
IF Stufe! = 1 THEN
Pixel! = Bombe2(9, Xachse, YAchse)
ELSEIF Stufe! >= 2 AND Bilde! <> 1 THEN
 IF Stufe! = 2 THEN
 Pixel! = Bombe2(9, Xachse, YAchse)
 ELSEIF Stufe! >= 3 AND Bilde! <> 0 THEN
  IF Stufe! = 3 THEN
  Pixel! = Bombe2(9, Xachse, YAchse)
  ELSEIF Stufe! >= 4 AND Bilde! <> 6 THEN
   IF Stufe! = 4 THEN
   Pixel! = Bombe2(9, Xachse, YAchse)
   ELSEIF Stufe! >= 5 AND Bilde! <> 7 THEN
    IF Stufe! = 5 THEN
    Pixel! = Bombe2(9, Xachse, YAchse)
    ELSEIF Stufe! >= 6 AND Bilde! <> 8 THEN
     IF Stufe! = 6 THEN
     Pixel! = Bombe2(9, Xachse, YAchse)
     ELSEIF Stufe! >= 7 AND Bilde! <> 2 THEN
      IF Stufe! = 7 THEN
      Pixel! = Bombe2(9, Xachse, YAchse)
      ELSEIF Stufe! >= 8 AND Bilde! <> 3 THEN
       IF Stufe! = 8 THEN
       Pixel! = Bombe2(9, Xachse, YAchse)
       ELSEIF Stufe! >= 9 AND Bilde! <> 4 THEN
        IF Stufe! = 9 THEN
        Pixel! = Bombe2(9, Xachse, YAchse)
        ELSEIF Stufe! = 10 AND Bilde! <> 9 THEN
        Pixel! = Bombe2(9, Xachse, YAchse)
        END IF
       END IF
      END IF
     END IF
    END IF
   END IF
  END IF
 END IF
END IF
END IF








'IF Pixel! = 0 AND Bilden! = 0 AND Ze% <> 0 AND Ze% <> 18 THEN
'Pixel! = Bode!(1 + Boden!(Ze% + (sp% - 1) * 17), XAchse, YAchse)
'ELSEIF Feld!(sp%, Ze%, 0) < 10 AND Bilden! = 0 AND Ze% <> 0 AND Ze% <> 18 THEN
'Pixel! = Bode!(1 + Boden!(Ze% + (sp% - 1) * 17), XAchse, YAchse)
'END IF

IF Mein! = 1 AND ze% = 0 AND Za! <> 47 OR Za! <> 47 AND Mein! = 1 AND ze% = 18 THEN
LINE (XAnfang + ze% * 16 + 1, YAnfang + sp% * 16 - 15)-(XAnfang + ze% * 16 + 16, YAnfang + sp% * 16), 4, BF
IF ze% = 0 THEN
LINE (XAnfang + ze% * 16 + 13, YAnfang + sp% * 16 - 16)-(XAnfang + ze% * 16 + 13, YAnfang + sp% * 16), 31
LINE (XAnfang + ze% * 16 + 14, YAnfang + sp% * 16 - 16)-(XAnfang + ze% * 16 + 14, YAnfang + sp% * 16), 29
LINE (XAnfang + ze% * 16 + 15, YAnfang + sp% * 16 - 16)-(XAnfang + ze% * 16 + 15, YAnfang + sp% * 16), 27
LINE (XAnfang + ze% * 16 + 16, YAnfang + sp% * 16 - 16)-(XAnfang + ze% * 16 + 16, YAnfang + sp% * 16), 25
ELSE
LINE (XAnfang + ze% * 16 + 4, YAnfang + sp% * 16 - 16)-(XAnfang + ze% * 16 + 4, YAnfang + sp% * 16), 31
LINE (XAnfang + ze% * 16 + 3, YAnfang + sp% * 16 - 16)-(XAnfang + ze% * 16 + 3, YAnfang + sp% * 16), 29
LINE (XAnfang + ze% * 16 + 2, YAnfang + sp% * 16 - 16)-(XAnfang + ze% * 16 + 2, YAnfang + sp% * 16), 27
LINE (XAnfang + ze% * 16 + 1, YAnfang + sp% * 16 - 16)-(XAnfang + ze% * 16 + 1, YAnfang + sp% * 16), 25
END IF
END IF
IF Bilden! = 0 THEN IF Pixel! <> 0 OR ze% <> 0 AND ze% <> 18 THEN PSET (Xachse + 16 + 16 * (ze% - 1) + XBild, YAchse + 16 * (sp% - 1) + YBild), Pixel!
IF Bilden! = 1 THEN PSET (Xachse + x%, YAchse + y%), Pixel!
 NEXT
NEXT
IF Feldz! <> 0 THEN Feld!(sp%, ze%, 0) = Feldz!
Feldz! = 0
'TimeZeit! = TIMER
'DO: LOOP UNTIL TimeZeit! + .5 < TIMER
END SUB

SUB ZahlPfont (Zahl!, x%, y%, Farbe%, HFarbe%)
Num! = Zahl
 IF Num! >= 9000 THEN Num1$ = "9": Num! = Num - 9000
 IF Num! >= 8000 THEN Num1$ = "8": Num! = Num - 8000
 IF Num! >= 7000 THEN Num1$ = "7": Num! = Num - 7000
 IF Num! >= 6000 THEN Num1$ = "6": Num! = Num - 6000
 IF Num! >= 5000 THEN Num1$ = "5": Num! = Num - 5000
 IF Num! >= 4000 THEN Num1$ = "4": Num! = Num - 4000
 IF Num! >= 3000 THEN Num1$ = "3": Num! = Num - 3000
 IF Num! >= 2000 THEN Num1$ = "2": Num! = Num - 2000
 IF Num! >= 1000 THEN Num1$ = "1": Num! = Num - 1000

 IF Num1$ <> "" AND Num! < 100 THEN Num2$ = "0"
 IF Num! >= 900 THEN Num2$ = "9": Num! = Num - 900
 IF Num! >= 800 THEN Num2$ = "8": Num! = Num - 800
 IF Num! >= 700 THEN Num2$ = "7": Num! = Num - 700
 IF Num! >= 600 THEN Num2$ = "6": Num! = Num - 600
 IF Num! >= 500 THEN Num2$ = "5": Num! = Num - 500
 IF Num! >= 400 THEN Num2$ = "4": Num! = Num - 400
 IF Num! >= 300 THEN Num2$ = "3": Num! = Num - 300
 IF Num! >= 200 THEN Num2$ = "2": Num! = Num - 200
 IF Num! >= 100 THEN Num2$ = "1": Num! = Num - 100

 IF Num2$ <> "" AND Num! < 10 THEN Num3$ = "0"
 IF Num! >= 90 THEN Num3$ = "9": Num! = Num - 90
 IF Num! >= 80 THEN Num3$ = "8": Num! = Num - 80
 IF Num! >= 70 THEN Num3$ = "7": Num! = Num - 70
 IF Num! >= 60 THEN Num3$ = "6": Num! = Num - 60
 IF Num! >= 50 THEN Num3$ = "5": Num! = Num - 50
 IF Num! >= 40 THEN Num3$ = "4": Num! = Num - 40
 IF Num! >= 30 THEN Num3$ = "3": Num! = Num - 30
 IF Num! >= 20 THEN Num3$ = "2": Num! = Num - 20
 IF Num! >= 10 THEN Num3$ = "1": Num! = Num - 10

 IF Num! = 0 THEN Num4$ = "0"
 IF Num! = 9 THEN Num4$ = "9": Num! = Num - 9
 IF Num! = 8 THEN Num4$ = "8": Num! = Num - 8
 IF Num! = 7 THEN Num4$ = "7": Num! = Num - 7
 IF Num! = 6 THEN Num4$ = "6": Num! = Num - 6
 IF Num! = 5 THEN Num4$ = "5": Num! = Num - 5
 IF Num! = 4 THEN Num4$ = "4": Num! = Num - 4
 IF Num! = 3 THEN Num4$ = "3": Num! = Num - 3
 IF Num! = 2 THEN Num4$ = "2": Num! = Num - 2
 IF Num! = 1 THEN Num4$ = "1": Num! = Num - 1

Num$ = Num1$ + Num2$ + Num3$ + Num4$

Pfont Num$, x%, y%, Farbe%, HFarbe%

END SUB

