home *** CD-ROM | disk | FTP | other *** search
/ 8bitfiles.net/archives / archives.tar / archives / genie-commodore-file-library / C64Games / FIFTEEN-PUZZLE (.txt) < prev    next >
Encoding:
Commodore BASIC  |  2019-04-13  |  3.3 KB  |  76 lines

  1. 1 REM FIFTEEN PUZZLE BY W.L.COLSHER
  2. 30 POKE53281,13:POKE53280,2:PRINT"ôÉ            FIFTEEN PUZZLE."
  3. 40 PRINT"            ╕╕╕╕╕╕╕╕╕╕╕╕╕╕╕"
  4. 50 PRINT"  **DO YOU NEED INSTRUCTIONS?"
  5. 60 PRINT"    PRESS 'Y', OR ANY OTHER KEY FOR NO."
  6. 70 GETA$:IFA$=""THEN70
  7. 80 IFA$="Y"THENGOSUB1310
  8. 100 DIMA(20):M=0:S=54272:PRINT"ô"
  9. 110 A$=" ╒├├├├▓├├├├▓├├├├▓├├├├╔"
  10. 130 B$=" ½└└└└█└└└└█└└└└█└└└└│"
  11. 150 C$=" ┬ ááá▌áááá▌áááá▌áááá┬"
  12. 170 D$=" ╩├├├├▒├├├├▒├├├├▒├├├├╦"
  13. 190 PRINTA$:FORI=1TO3
  14. 200 PRINTC$:PRINTC$:PRINTB$:NEXTI
  15. 210 PRINTC$:PRINTC$:PRINTD$:IFQ=1THENRETURN
  16. 220 PRINT"**WAIT PLEASE"
  17. 230 FORX=1TO16:A(X)=0:NEXT
  18. 240 FORI=1TO16
  19. 250 X=INT(16*RND(RND(0)))+1:IFA(X)THEN250
  20. 260 A(X)=I:NEXT
  21. 270 GOSUB510:TI$="000000":IFF=0THEN230
  22. 280 PRINT:GOSUB610:PRINT:PRINT"                "
  23. 290 PRINT"æ  *YOUR MOVE";:X$="":X1$=""
  24. 300 GETX$:IFX$=""THEN300
  25. 310 IFX$="_"THENX=1:GOTO350
  26. 320 IFX$<>"1"GOTO340
  27. 330 GETX1$:IFX1$=""GOTO330
  28. 340 X$=X$+X1$:X=VAL(X$)
  29. 350 PRINTX:GOSUB410:GOSUB710:IFF THEN370
  30. 360 PRINT"  *ILLEGAL MOVE,RE-ENTER":GOTO280
  31. 370 A(X+F)=A(X):A(X)=16:GOTO910
  32. 380 M=M+1:GOTO280
  33. 390 REM
  34. 400 REM
  35. 410 FORI=1TO16:IFA(I)=XTHEN430
  36. 420 NEXT
  37. 430 X=I:RETURN
  38. 440 :
  39. 510 F=0:SU=0:FORI=1TO15:FORJ=I+1TO16
  40. 520 IFA(I)>A(J)THENSU=SU+1
  41. 530 NEXTJ:NEXTI:RESTORE
  42. 540 FORI=1TO8:READX:IFA(X)=16THENSU=SU+1
  43. 550 NEXTI
  44. 560 A=INT(SU/2):IFA*2=SUTHENF=1
  45. 570 RETURN
  46. 580 DATA2,4,5,7,10,12,13,16
  47. 590 REM
  48. 600 REM GAME BOARD
  49. 610 PRINT"":PRINT:FORI=1TO4:PRINT
  50. 2412 
  51. 630 IFN<10THENPRINT" ";
  52. 640 IFN=16THENN$="   "
  53. 650 PRINTN$;SPC(1);
  54. 660 NEXTJ:PRINT:PRINT
  55. 670 NEXTI
  56. 680 PRINT:RETURN
  57. 710 F=0:IFX>16THENRETURN
  58. 720 IF(X=4ORX=8ORX=12)ANDA(X+1)=16THENRETURN
  59. 730 IF(X=5ORX=9ORX=13)ANDA(X-1)=16THENRETURN
  60. 740 IFX+1>16THEN760
  61. 750 IFA(X+1)=16THENF=1
  62. 760 IFX-1<=0THEN780
  63. 770 IFA(X-1)=16THENF=-1
  64. 780 IFX+4>16THEN800
  65. 790 IFA(X+4)=16THENF=4
  66. 800 IFX-4<0THEN820
  67. 810 IFA(X-4)=16THENF=-4
  68. 820 IFF THEN PRINT"                          "
  69. 830 RETURN
  70. 910 FORI=1TO16
  71. 920 IFA(I)<>ITHEN380
  72. 930 NEXT
  73. 940 GOSUB610:T$=TI$
  74. 950 GOSUB1110:PRINT"ô  *CONGRATULATIONS!!!"
  75. 960 PRINT"   YOU DID IT IN ONLY"M"MOVES!!"
  76.