SCHUIF.BAS

Go back

Below you'll find the source for the QBasic file SCHUIF.BAS.

I've been in doubt if I'd republish this file again. Mainly for a few reasons;
1. The stuff I made as a kid is very childish (which kinda makes sense)
2. Times have changed; what was funny/innovative or sharable in 1997 doesn't meet standards in 2024.
3. Most of the code doesn't run natively anymore on modern operating systems.
4. It's in the Dutch language, where most of my shared content is in English.

Still, I've decided to share this file. Keep in mind the age of this content though.

Download SCHUIF.BAS for QBasic

DIM Vakje$(5, 5)
DIM a(25)
DIM a$(5)
RANDOMIZE TIMER
NieuwSpel:
Einde = 0
CLS
trnd = 25
FOR b = 1 TO 25
   c = INT(RND * trnd) + 1
   IF a(c) > 0 THEN
      FOR t = 25 TO 1 STEP -1
         IF a(t) = 0 THEN c = t: t = 1
      NEXT t
   END IF
   a(c) = b
   trnd = trnd - 1
NEXT b
a$ = ""
RESTORE
FOR a = 1 TO 5
   READ b$
   a$ = a$ + b$
NEXT a
a$ = a$ + SPACE$(25 - LEN(a$))
b$ = a$
FOR a = 1 TO 25
   b = a(a)
   MID$(b$, a, 1) = MID$(a$, b, 1)
NEXT a
b = 0
FOR a = 1 TO 25 STEP 5
   b = b + 1
   a$(b) = MID$(b$, a, 5)
NEXT a
FOR a = 1 TO 5
   a$ = a$(a)
   FOR b = 1 TO 5
      b$ = MID$(a$, b, 1)
      Vakje$(a, b) = b$
   NEXT b
NEXT a
CLS
COLOR 1, 14
PRINT "╔═══╦═══╦═══╦═══╦═══╗  S=Save      "
PRINT "║   ║   ║   ║   ║   ║  L=Load      "
PRINT "╠═══╬═══╬═══╬═══╬═══╣              "
PRINT "║   ║   ║   ║   ║   ║              "
PRINT "╠═══╬═══╬═══╬═══╬═══╣              "
PRINT "║   ║   ║   ║   ║   ║              "
PRINT "╠═══╬═══╬═══╬═══╬═══╣              "
PRINT "║   ║   ║   ║   ║   ║              "
PRINT "╠═══╬═══╬═══╬═══╬═══╣              "
PRINT "║   ║   ║   ║   ║   ║              "
PRINT "╚═══╩═══╩═══╩═══╩═══╝              "
COLOR 15
DO
   c = 0
   FOR a = 2 TO 10 STEP 2
      c = c + 1
      d = 0
      FOR b = 2 TO 18 STEP 4
         d = d + 1
         LOCATE a, b: PRINT " "; Vakje$(c, d); " "
         IF Vakje$(c, d) = " " THEN x = c: y = d
      NEXT b
   NEXT a
   p = 0
   RESTORE
   FOR a = 1 TO 5
      READ a$
      FOR b = 1 TO 5
         b$ = MID$(a$, b, 1)
         IF Vakje$(a, b) = b$ THEN p = p + 1
      NEXT b
   NEXT a
   IF p = 25 THEN Einde = 1
   DO
      Rea = 0
      DO: a$ = UCASE$(INKEY$): LOOP WHILE a$ = "" AND Einde = 0
      IF Einde = 1 THEN Rea = 1
      IF a$ = CHR$(0) + "P" THEN
         IF x - 1 > 0 THEN
            Vakje$(x, y) = Vakje$(x - 1, y)
            x = x - 1
            Vakje$(x, y) = " "
            Rea = 1
         END IF
      END IF
      IF a$ = CHR$(0) + "H" THEN
         IF x + 1 < 6 THEN
            Vakje$(x, y) = Vakje$(x + 1, y)
            x = x + 1
            Vakje$(x, y) = " "
            Rea = 1
         END IF
      END IF
      IF a$ = CHR$(0) + "K" THEN
         IF y + 1 < 6 THEN
            Vakje$(x, y) = Vakje$(x, y + 1)
            y = y + 1
            Vakje$(x, y) = " "
            Rea = 1
         END IF
      END IF
      IF a$ = CHR$(0) + "M" THEN
         IF y - 1 > 0 THEN
            Vakje$(x, y) = Vakje$(x, y - 1)
            y = y - 1
            Vakje$(x, y) = " "
            Rea = 1
         END IF
      END IF
      IF a$ = "S" THEN
         OPEN "SCHUIF.SAV" FOR OUTPUT AS #1
            FOR a = 1 TO 5
               FOR b = 1 TO 5
                  a$ = Vakje$(a, b)
                  PRINT #1, a$
               NEXT b
            NEXT a
         CLOSE #1
      END IF
      IF a$ = "L" THEN
         OPEN "SCHUIF.SAV" FOR INPUT AS #1
            FOR a = 1 TO 5
               FOR b = 1 TO 5
                  LINE INPUT #1, a$
                  Vakje$(a, b) = a$
               NEXT b
            NEXT a
         CLOSE #1
         Rea = 1
      END IF
      IF a$ = CHR$(27) THEN Rea = 1
   LOOP WHILE Rea = 0
LOOP WHILE Einde = 0 AND a$ <> CHR$(27)
COLOR 7, 0
PRINT
IF Einde = 1 THEN PRINT "U heeft deze puzzel opgelost" ELSE PRINT "U drukte op Esc."
PRINT "Nog een keer: [J/N]? ";
x = CSRLIN
y = POS(1)
LOCATE x, y, 1
a$ = ""
DO
   IF a$ <> "" THEN BEEP
   a$ = UCASE$(INPUT$(1))
   LOCATE x, y: PRINT a$;
LOOP WHILE a$ <> "J" AND a$ <> "N"
LOCATE , , 0
IF a$ = "J" GOTO NieuwSpel
CLS

'Antwoord
DATA "ABCDE"
DATA "FGHIJ"
DATA "KLMNO"
DATA "PQRST"
DATA "UVWX "