Author Topic: PUZZLE GAME / FREE - WRITTEN BY ME.. ORIGINAL CODE  (Read 3892 times)

0 Members and 1 Guest are viewing this topic.

Offline PMACKAY

  • Forum Regular
  • Posts: 188
  • LIFE is Temporary
    • View Profile
PUZZLE GAME / FREE - WRITTEN BY ME.. ORIGINAL CODE
« on: January 20, 2019, 06:33:46 am »
dOWNLOAD THE ZIP FILE... cONTAINS BOTH TEXT AND GRAPHIC VERSION.. (GRAPHIC HAS SOUND AND MUSIC)

USE NUMBER PAD TO MOVE (8 = UP    2 = DOWN    4 = LEFT AND 6 = RIGHT


THIS GAME ONLY SWAPS THE LETTERS IN THE STRING FROM A-G... 3 X 3 MATRIX

HOPE ITS OK... NOTHING FANCY JUST REMEMBER PLAYING THIS ON A MICROBEE 128K PREMIUM WITH HARDDISK... SO HAD TO MAKE MY OWN..
 




' *******************************************************
'
'   ****************
'    aLPHABET PUZZLE
'   ****************
'   wRITTEN bY          Paul Mackay
'   May or May not work / this is how my brain sees LOGIC
'  Wednesday 2,2019 Text Only / No move counter, No sound
' *******************************************************
_TITLE "aLPHABET PUZZLE": RANDOMIZE VAL(RIGHT$(TIME$, 2)): S& = _SNDOPEN(".\data\tick.mp3"): GL& = _SNDOPEN(".\data\ingame.ogg"): _SNDVOL S&, 1: A& = _LOADIMAGE(".\data\a.jpg", 32): B& = _LOADIMAGE(".\data\b.jpg", 32): C& = _LOADIMAGE(".\data\c.jpg", 32): D& = _LOADIMAGE(".\data\d.jpg", 32): E& = _LOADIMAGE(".\data\e.jpg", 32): F& = _LOADIMAGE(".\data\f.jpg", 32): G& = _LOADIMAGE(".\data\g.jpg", 32): H& = _LOADIMAGE(".\data\h.jpg", 32): I& = _LOADIMAGE(".\data\i.jpg", 32): SCREEN _NEWIMAGE(264, 281, 32): _DISPLAY: SQUARE$ = "123456789": GOSUB RANDOMSTART
_SNDLOOP GL&
START: GOSUB SHOWSQUARES: GOSUB KEYINPUT: IF SQUARE$ = "123456789" THEN GOSUB SHOWSQUARES: END ELSE GOTO START
SHOWSQUARES: FOR I = 1 TO 9: CURRENT$ = MID$(SQUARE$, I, 1): CURRENT = VAL(CURRENT$): SELECT CASE I: CASE 1: X = 1: Y = 1: CASE 2: X = 88: Y = 1: CASE 3: X = 175: Y = 1: CASE 4: X = 1: Y = 95: CASE 5: X = 88: Y = 95: CASE 6: X = 175: Y = 95: CASE 7: X = 1: Y = 189: CASE 8: X = 88: Y = 189: CASE 9: X = 175: Y = 189: END SELECT: GOSUB DISPSHOW: NEXT I: _DISPLAY: RETURN
SWAPPED: SWAP SW2$, SW1$: _SNDPLAYCOPY S&, 1: RETURN
OVER: _SNDSTOP GL&: _FREEIMAGE A&: _FREEIMAGE B&: _FREEIMAGE C&: _FREEIMAGE D&: _FREEIMAGE E&: _FREEIMAGE F&: _FREEIMAGE G&: _FREEIMAGE H&: _FREEIMAGE I&: END
DISPSHOW: SELECT CASE CURRENT: CASE 1: _PUTIMAGE (X, Y), A&: CASE 2: _PUTIMAGE (X, Y), B&: CASE 3: _PUTIMAGE (X, Y), C&: CASE 4: _PUTIMAGE (X, Y), D&: CASE 5: _PUTIMAGE (X, Y), E&: CASE 6: _PUTIMAGE (X, Y), F&: CASE 7: _PUTIMAGE (X, Y), G&: CASE 8: _PUTIMAGE (X, Y), H&: CASE 9: _PUTIMAGE (X, Y), I&: END SELECT: RETURN
RANDOMSTART: S1$ = "": FOR I = 1 TO 9: DO: X = INT(RND(1) * 9) + 1: IF MID$(SQUARE$, X, 1) <> "0" THEN S1$ = S1$ + MID$(SQUARE$, X, 1): MID$(SQUARE$, X, 1) = "0" ELSE IF SQUARE$ = "000000000" THEN EXIT DO
LOOP: NEXT I: SQUARE$ = S1$: RETURN
KEYINPUT: I$ = INKEY$: IF I$ = "" THEN GOTO KEYINPUT ELSE IF I$ = "+" THEN SQUARE$ = "123456789": GOSUB RANDOMSTART: RETURN
Z = 1: DO: IF MID$(SQUARE$, Z, 1) = "9" THEN EXIT DO ELSE Z = Z + 1
    LOOP: SELECT CASE Z
    CASE 1: IF I$ = "8" THEN SW1$ = MID$(SQUARE$, 1, 1): SW2$ = MID$(SQUARE$, 4, 1): GOSUB SWAPPED: MID$(SQUARE$, 1, 1) = SW1$: MID$(SQUARE$, 4, 1) = SW2$ ELSE IF I$ = "4" THEN SW1$ = MID$(SQUARE$, 1, 1): SW2$ = MID$(SQUARE$, 2, 1): GOSUB SWAPPED: MID$(SQUARE$, 1, 1) = SW1$: MID$(SQUARE$, 2, 1) = SW2$
    CASE 2: IF I$ = "8" THEN SW1$ = MID$(SQUARE$, 2, 1): SW2$ = MID$(SQUARE$, 5, 1): GOSUB SWAPPED: MID$(SQUARE$, 2, 1) = SW1$: MID$(SQUARE$, 5, 1) = SW2$ ELSE IF I$ = "4" THEN SW1$ = MID$(SQUARE$, 2, 1): SW2$ = MID$(SQUARE$, 3, 1): GOSUB SWAPPED: MID$(SQUARE$, 2, 1) = SW1$: MID$(SQUARE$, 3, 1) = SW2$ ELSE IF I$ = "6" THEN SW1$ = MID$(SQUARE$, 2, 1): SW2$ = MID$(SQUARE$, 1, 1): GOSUB SWAPPED: MID$(SQUARE$, 2, 1) = SW1$: MID$(SQUARE$, 1, 1) = SW2$
    CASE 3: IF I$ = "6" THEN SW1$ = MID$(SQUARE$, 3, 1): SW2$ = MID$(SQUARE$, 2, 1): GOSUB SWAPPED: MID$(SQUARE$, 3, 1) = SW1$: MID$(SQUARE$, 2, 1) = SW2$ ELSE IF I$ = "8" THEN SW1$ = MID$(SQUARE$, 3, 1): SW2$ = MID$(SQUARE$, 6, 1): GOSUB SWAPPED: MID$(SQUARE$, 3, 1) = SW1$: MID$(SQUARE$, 6, 1) = SW2$
    CASE 4: IF I$ = "2" THEN SW1$ = MID$(SQUARE$, 4, 1): SW2$ = MID$(SQUARE$, 1, 1): GOSUB SWAPPED: MID$(SQUARE$, 4, 1) = SW1$: MID$(SQUARE$, 1, 1) = SW2$ ELSE IF I$ = "4" THEN SW1$ = MID$(SQUARE$, 5, 1): SW2$ = MID$(SQUARE$, 4, 1): GOSUB SWAPPED: MID$(SQUARE$, 5, 1) = SW1$: MID$(SQUARE$, 4, 1) = SW2$ ELSE IF I$ = "8" THEN SW1$ = MID$(SQUARE$, 4, 1): SW2$ = MID$(SQUARE$, 7, 1): GOSUB SWAPPED: MID$(SQUARE$, 4, 1) = SW1$: MID$(SQUARE$, 7, 1) = SW2$
    CASE 5: IF I$ = "2" THEN SW1$ = MID$(SQUARE$, 5, 1): SW2$ = MID$(SQUARE$, 2, 1): GOSUB SWAPPED: MID$(SQUARE$, 5, 1) = SW1$: MID$(SQUARE$, 2, 1) = SW2$ ELSE IF I$ = "4" THEN SW1$ = MID$(SQUARE$, 5, 1): SW2$ = MID$(SQUARE$, 6, 1): GOSUB SWAPPED: MID$(SQUARE$, 5, 1) = SW1$: MID$(SQUARE$, 6, 1) = SW2$ ELSE IF I$ = "6" THEN SW1$ = MID$(SQUARE$, 5, 1): SW2$ = MID$(SQUARE$, 4, 1): GOSUB SWAPPED: MID$(SQUARE$, 5, 1) = SW1$: MID$(SQUARE$, 4, 1) = SW2$ ELSE IF I$ = "8" THEN SW1$ = MID$(SQUARE$, 5, 1): SW2$ = MID$(SQUARE$, 8, 1): GOSUB SWAPPED: MID$(SQUARE$, 5, 1) = SW1$: MID$(SQUARE$, 8, 1) = SW2$
    CASE 6: IF I$ = "2" THEN SW1$ = MID$(SQUARE$, 6, 1): SW2$ = MID$(SQUARE$, 3, 1): GOSUB SWAPPED: MID$(SQUARE$, 6, 1) = SW1$: MID$(SQUARE$, 3, 1) = SW2$ ELSE IF I$ = "6" THEN SW1$ = MID$(SQUARE$, 6, 1): SW2$ = MID$(SQUARE$, 5, 1): GOSUB SWAPPED: MID$(SQUARE$, 6, 1) = SW1$: MID$(SQUARE$, 5, 1) = SW2$ ELSE IF I$ = "8" THEN SW1$ = MID$(SQUARE$, 6, 1): SW2$ = MID$(SQUARE$, 9, 1): GOSUB SWAPPED: MID$(SQUARE$, 6, 1) = SW1$: MID$(SQUARE$, 9, 1) = SW2$
    CASE 7: IF I$ = "2" THEN SW1$ = MID$(SQUARE$, 7, 1): SW2$ = MID$(SQUARE$, 4, 1): GOSUB SWAPPED: MID$(SQUARE$, 7, 1) = SW1$: MID$(SQUARE$, 4, 1) = SW2$ ELSE IF I$ = "4" THEN SW1$ = MID$(SQUARE$, 7, 1): SW2$ = MID$(SQUARE$, 8, 1): GOSUB SWAPPED: MID$(SQUARE$, 7, 1) = SW1$: MID$(SQUARE$, 8, 1) = SW2$
    CASE 8: IF I$ = "2" THEN SW1$ = MID$(SQUARE$, 8, 1): SW2$ = MID$(SQUARE$, 5, 1): GOSUB SWAPPED: MID$(SQUARE$, 8, 1) = SW1$: MID$(SQUARE$, 5, 1) = SW2$ ELSE IF I$ = "4" THEN SW1$ = MID$(SQUARE$, 8, 1): SW2$ = MID$(SQUARE$, 9, 1): GOSUB SWAPPED: MID$(SQUARE$, 8, 1) = SW1$: MID$(SQUARE$, 9, 1) = SW2$ ELSE IF I$ = "6" THEN SW1$ = MID$(SQUARE$, 8, 1): SW2$ = MID$(SQUARE$, 7, 1): GOSUB SWAPPED: MID$(SQUARE$, 8, 1) = SW1$: MID$(SQUARE$, 7, 1) = SW2$
    CASE 9: IF I$ = "2" THEN SW1$ = MID$(SQUARE$, 9, 1): SW2$ = MID$(SQUARE$, 6, 1): GOSUB SWAPPED: MID$(SQUARE$, 9, 1) = SW1$: MID$(SQUARE$, 6, 1) = SW2$ ELSE IF I$ = "6" THEN SW1$ = MID$(SQUARE$, 9, 1): SW2$ = MID$(SQUARE$, 8, 1): GOSUB SWAPPED: MID$(SQUARE$, 9, 1) = SW1$: MID$(SQUARE$, 8, 1) = SW2$
END SELECT: RETURN
* squares.tar.gz (Filesize: 10.11 MB, Downloads: 290)
MackyWhite