Classic Computer Magazine Archive PROGRAM LISTING: 88-02/KILLER.ACT


; KILLER CHESS
; BY GREG KNAUSS   
; (c)1987, ANTIC PUBLISHING   

CARD PM,CH
BYTE I,J,K,STK,PLR,LOC,CAP,OK
BYTE ARRAY X(2),Y(2),OX(2),OY(2),
     HOLD(2),PAU(2),SND(2),DIS(2)
INT  X1,Y1,DX,DY,DUM1,DUM2


PROC CURSOR()

; SHAPE FOR CURSORS 
[255 129 129 129 129 129 129 255]


PROC CHRS()

; BOARD EDGE 
[  0   0   0   0   0   0   0   0
   0   0   0   0  15  15  15  15
   0   0   0   0   0   0   0   0
   0   0   0   0 255 255 255 255
   0   0   0   0 240 240 240 240
  15  15  15  15  15  15  15  15
 240 240 240 240 240 240 240 240
  15  15  15  15   0   0   0   0
 255 255 255 255   0   0   0   0
 240 240 240 240   0   0   0   0

; PIECES 
   0   0   0  56  56  16 124   0
   0  84 124  56  56  56 124   0
   0   6  60 124  28  28  60 126
   0  16  24 108 124  56  16 124
   0 214 254 124  56  56 124 254
   0  16  56 146 254 124  56 124

; TITLE 
   0 247 108 112 112 108 246   3
   0  62 102  96  96 102  60   0
  24   0  56  24  24  24  60   0    
 224  96 124 102 102 102 247   0  
  56  24  24  24  24  24  60   0 
   0   0  60 102 126  96  62   0     
   0   0 220 102  96  96 240   0 
   0   0  62  96  60   6 124   0


; "PRESS START"
   0 238 170 238 140 138   0   0
   0 238 136 206 130 238   0   0
   1 225 129 225  33 225   1   0
 255  17 123  27 219  27 255   0
 255  17  85  17  83  85 255   0
 240  16 176 176 176 180 240   0]

PROC SETUP()
GRAPHICS(18) POKE(559,0)
POKE (559,46)

; COLORS
SETBLOCK(706,2,66)
POKE(704,14) POKE(705,8)
POKE(708,10) POKE(710,4)
POKE(709,142) POKE(711,15) ;DO 711

; P/M GRAPHICS 
PM=(PEEK(106)-8)*256
POKE(54279,PM/256) POKE(53277,3)
SETBLOCK(53258,2,3) ZERO(PM,1024)
POKE(623,2) PM==+512 K=51
FOR I=32 TO 95 STEP 8 DO
 FOR J=0 TO 7 DO POKE(PM+I+J+256,K)
  POKE(PM+I+J+384,K) OD K=255-K OD

; REDEFINED CHARACTERS
CH=(PEEK(106)-16)*256
MOVEBLOCK(CH,CHRS,512)
POKE(756,CH/256)

; DRAW BOARD 
POSITION(5,1) PRINTD(6,"")
  FOR I=2 TO 9 DO POSITION(5,I)
  PRINTD(6,"        ") OD
POSITION(5,10) PRINTD(6,"	")
POSITION(6,2) PRINTD(6,"+,-./-,+")
POSITION(6,3) PRINTD(6,"********")
POSITION(7,5) PRINTD(6,"������")
POSITION(7,6) PRINTD(6,"�����")
POSITION(6,8) PRINTD(6,"��������")
POSITION(6,9) PRINTD(6,"��������")
POSITION(7,11) PRINTD(6,"")
POKE(53250,96) POKE(53251,128)
POKE(559,46)

; WAIT FOR [START]
I=0 DO POKE(54282,0) POKE(53273,I)
 I==+3 UNTIL PEEK(53279)=6 OD

; DRAW PIECES
POSITION(6,2) PRINTD(6,"+*    ��")
POSITION(6,3) PRINTD(6,",*    ��")
POSITION(6,4) PRINTD(6,"-*    ��")
POSITION(6,5) PRINTD(6,".*    ��")
POSITION(6,6) PRINTD(6,"/*    ��")
POSITION(6,7) PRINTD(6,"-*    ��")
POSITION(6,8) PRINTD(6,",*    ��")
POSITION(6,9) PRINTD(6,"+*    ��")
POSITION(7,11) PRINTD(6,"      ")
RETURN


PROC MAIN()

; GAME LOOP
DO

SETUP()

X(0)=6 Y(0)=5 X(1)=13 Y(1)=6
HOLD(0)=0 HOLD(1)=0 PAU(0)=0 PAU(1)=0
PLR=1

; PLAYER TURN LOOP
DO

; ALTERNATE PLAYERS 
PLR=1-PLR

; RESET THESE FOR EACH TURN
X1=0 Y1=0 POKE(77,0)
IF PAU(PLR)=0 THEN SOUND(PLR,0,0,0)
 FI

; MOVE WHICH WAY???
STK=STICK(PLR)
IF STK=14 OR STK=10 OR STK=6 THEN
 Y1=-1 FI
IF STK=13 OR STK=9 OR STK=5 THEN Y1=1
 FI
IF STK=11 OR STK=10 OR STK=9 THEN
 X1=-1 FI
IF STK=7 OR STK=6 OR STK=5 THEN X1=1
 FI

; KEEP PLAYER ON BOARD
LOC=LOCATE(X(PLR)+X1,Y(PLR)+Y1)
IF LOC<10 THEN X1=0 Y1=0 FI

; MOVE CURSOR 
IF Y1<>0 THEN
 ZERO(PM+128*PLR+16+8*Y(PLR),8) FI
X(PLR)==+X1 Y(PLR)==+Y1
POKE(53248+PLR,8*X(PLR)+48) 
MOVEBLOCK(PM+128*PLR+16+8*Y(PLR),
 CURSOR,8)

; WAIT! HE'S PLACING A PIECE!     
IF HOLD(PLR)>0 AND STRIG(PLR)=0 AND
 PAU(PLR)=0 THEN CAP=0 OK=0 DX=0 DY=0

; SOMETHING TO CAPTURE!  
 IF LOC<>32 THEN CAP=1 FI

; FIND DELTA VALUES  
 DUM1=X(PLR)
 DUM2=OX(PLR)
 DX=DUM1-DUM2

 DUM1=Y(PLR)
 DUM2=OY(PLR)
 DY=DUM1-DUM2

; FLIP FOR PLAYER 2  
 IF PLR=1 THEN DX=-DX DY=-DY FI

; IS IT LEGAL???

; PAWN  
 IF HOLD(PLR)=1 THEN
  IF DX=1 AND DY=0 AND CAP=0 THEN
   OK=1 FI
  IF DX=2 AND DY=0 AND CAP=0 AND
   OX(PLR)=7+PLR*5 THEN OK=1 FI
  IF DX=1 AND (DY=1 OR DY=-1) AND
   CAP=1 THEN OK=1 FI FI

; ROOK  
 IF HOLD(PLR)=2 THEN
  IF (DX<>0 AND DY=0) OR (DX=0 AND
   DY<>0) THEN OK=1 FI FI

; KNIGHT 
 IF HOLD(PLR)=3 THEN
  IF (DX=2 AND DY=1) OR (DX=-2 AND
   DY=1) THEN OK=1 FI
  IF (DX=2 AND DY=-1) OR
   (DX=-2 AND DY=-1) THEN OK=1 FI
  IF (DX=1 AND DY=2) OR (DX=-1 AND
   DY=2) THEN OK=1 FI
  IF (DX=1 AND DY=-2) OR
   (DX=-1 OR DY=-2) THEN OK=1 FI FI

; BISHOP  
 IF HOLD(PLR)=4 AND (DX=DY OR DX=-DY)
  THEN OK=1 FI

; QUEEN  
 IF HOLD(PLR)=5 THEN
  IF DX=DY OR DX=-DY THEN OK=1 FI
  IF (DX<>0 AND DY=0) OR (DX=0 AND
   DY<>0) THEN OK=1 FI FI

; KING  
 IF HOLD(PLR)=6 THEN
  IF (DX=1 AND DY=1) OR (DX=0 AND 
   DY=1) OR (DX=-1 AND DY=1) THEN
   OK=1 FI
  IF (DX=1 AND DY=0) OR (DX=-1 AND
   DY=0) THEN OK=1 FI
  IF (DX=1 AND DY=-1) OR (DX=0 AND
   DY=-1) OR (DX=-1 AND DY=-1) THEN
   OK=1 FI FI

; CAN'T CAPTURE OWN PIECES OR 
; BORDER  
 IF LOC>128*PLR+41 AND
  LOC<128*PLR+127 OR LOC<10 THEN OK=0
  FI

; DIDN'T MOVE  
 IF DX=0 AND DY=0 THEN OK=1 FI

; MAKE SURE JUMPS WEREN'T MADE, 
; EXCEPT BY KNIGHT 
 IF HOLD(PLR)<>3 THEN
  I=OX(PLR) J=OY(PLR)
  X1=0 Y1=0
  IF DX<0 THEN X1=-1 FI
  IF DX>0 THEN X1=1 FI
  IF DY<0 THEN Y1=-1 FI
  IF DY>0 THEN Y1=1 FI
  IF PLR=1 THEN X1=-X1 Y1=-Y1 FI
  IF (DX<-1 OR DX>1) OR (DY<-1 OR
   DY>1) THEN
    DO
     I==+X1 J==+Y1
     K=LOCATE(I,J)
     IF K<>32 THEN OK=0 FI
     UNTIL (I=X(PLR)-X1 AND
      J=Y(PLR)-Y1) OR K<10 OD FI FI

; LEGAL MOVE! 
 IF OK=1 THEN
  COLOR=32 PLOT(OX(PLR),OY(PLR))
  COLOR=HOLD(PLR)+128*PLR+41

;  QUEEN ME!  
  IF HOLD(PLR)=1 AND
   X(PLR)=7*(1-PLR)+6 THEN
   COLOR=128*PLR+46 FI

;  KILL OTHER PLAYERS HOLD IF THAT'S 
;  WHAT WAS CAPTURED  
  IF X(PLR)=OX(1-PLR) AND 
   Y(PLR)=OY(1-PLR) THEN
   HOLD(1-PLR)=0
   POSITION(11*(1-PLR)+4,2)
   PRINTD(6," ") FI

;  WHO'D HE LAND ON??
  K=LOCATE(X(PLR),Y(PLR))

;  WHOEVER IT WAS, KILL HIM  
  PLOT(X(PLR),Y(PLR))
  COLOR=32 PLOT(11*PLR+4,2)

;  A KING DIED!
  IF K-128*(1-PLR)-41=6 THEN EXIT FI
  HOLD(PLR)=0
  SND(PLR)=100*PLR+100 DIS(PLR)=14 FI

;  ILLEGAL MOVE...  
  IF OK=0 THEN SND(PLR)=255
   DIS(PLR)=2 FI
PAU(PLR)=5 FI

; PICK UP PIECE  
IF HOLD(PLR)=0 AND STRIG(PLR)=0 AND
 PAU(PLR)=0 AND LOC<>32 AND
 LOC>128*PLR+41 AND LOC<128*PLR+127
 THEN

; Grab HOLD  
 HOLD(PLR)=LOC-128*PLR-41
 OX(PLR)=X(PLR) OY(PLR)=Y(PLR)
 COLOR=LOC PLOT(11*PLR+4,2)
 SND(PLR)=100*PLR+100 DIS(PLR)=10
 PAU(PLR)=5 FI

; DELAY  
FOR CH=1 TO 2000 DO OD

; PAUSE FOR HUMANS                 
IF PAU(PLR)>0 THEN PAU(PLR)==-1
 SOUND(PLR,SND(PLR),DIS(PLR),
 PAU(PLR)*2) FI

; NEXT PLAYER   
OD

; VICTORY ROUTINE  
SNDRST() ZERO(PM,256) COLOR=32
FOR I=2 TO 9 DO FOR J=6 TO 13 DO
 LOC=LOCATE(J,I) IF LOC>128*(1-PLR)
 AND LOC<128*(1-PLR)+127 THEN
 PLOT(J,I) FI OD OD PLOT(4,2)
 PLOT(15,2)

; PAUSE  
CH=0 DO CH==+1 FOR I=1 TO 100 DO OD
 UNTIL CH=7500 OR PEEK(53279)=6 OD

; START NEW GAME  
OD



Back to previous page