Sheepdog Trials


There's no getting away from it, sheep are dumb. The pen in the middle of the screen is large enough for them all to be housed in comfort, but the wretched creatures are demonstrating an unpalatable degree of reticence. Your trusty collie is doing the best he can, but he requires a firm handling from you and your cursor control keys. As in life, time is running out, and this unusually difficult game will defeat you unless you manage to get all the sheep into the pen before the last second ticks away. If your best efforts are to no avail never fear . . . there's always the slaughter house!

    1  REM **SHEEPDOG TRIALS** *BBC VERSION**
    2  REM**@ ERSKINE ** CONVERSION BY I.THOM
AS***
   10 *FX12 2
   20 *FX11 10
   30 GOSUB820:GOSUB720:*FX4 1
   40 CLS:INPUTTAB(0,20)"How many players ? "
A
   50 DIMP(A),S(4,2):DX=15:DY=15
   60 DD=1:RR=1:DIMR(2):R(1)=-1:R(2)=1
   70 GOTO160
   80 MODE1:COLOUR130:CLS:VDU28,4,27,35,4,19,
2,2;0;:COLOUR0
   90 FORX=0TO21:PRINTTAB(0,X)CHR$229;TAB(31,
X)CHR$228:NEXT
  100 FORX=6TO9:PRINTTAB(10,X)CHR$229;TAB(20,
X)CHR$228:NEXT
  110 FORX=11TO19:PRINTTAB(X,5)CHR$230;TAB(X,
10)"_":NEXT
  120 COLOUR2::PRINTTAB(15,10)"  "
  130 COLOUR0:PRINTTAB(10,5)CHR$231;TAB(20,5)
CHR$232;TAB(10,10)CHR$233;TAB(20,10)CHR$234
  140 FORX=0TO31:PRINTTAB(X,0)"_";TAB(X,21)CH
R$230:NEXT
  150 RETURN
  160 FORT=1TOA:*FX15
  170   GOSUB80
  180   SC=0:S(1,1)=3:S(1,2)=15:S(2,1)=3:S(2,
2)=16:S(3,1)=4:S(3,2)=15:S(4,1)=4:S(4,2)=16
  190   COLOUR3:PRINTTAB(0,22)"Player ";T
  200   GOTO310
  210   I=INKEY(5)
  220   IFI=32 GOTO630
  230   LX=DX:LY=DY
  240   IFI=136 AND FNAT(DY-1,DX)=32 DY=DY-1:
DD=2
  250   IFI=138 AND FNAT(DY,DX+1)=32 DX=DX+1
  260   IFI=139 AND FNAT(DY,DX-1)=32 DX=DX-1
  270   IFI=137 AND FNAT(DY+1,DX)=32 DY=DY+1:
DD=1
  280   COLOUR2:PRINTTAB(LY,LX)" ":COLOUR0:*F
X15
  290   IFDD=1 PRINTTAB(DY,DX)CHR$224 ELSEPRI
NTTAB(DY,DX)CHR$225
  300   RETURN
  310   FORZ=1TO4
  320     SX=S(Z,1):SY=S(Z,2)
  330     GOSUB210
  340     IFRND(1)>.75 GOTO390
  350     IFRND(1)>.5 SX=S(Z,1)+R(2):GOTO370
  360     SX=S(Z,1)+R(1)
  370     IFRND(1)>.5 SY=S(Z,2)+R(2):GOTO390
  380     SY=S(Z,2)+R(1)
  390     E=(ABS(DX-S(Z,1)))/10:F=(ABS(DY-S(Z
,2)))/10:G=S(Z,1)-DX:H=S(Z,2)-DY
  400     O=0:Q=RND(1):IFQ>E AND Q>F O=1
  410     IFO<>1 GOTO460
  420     IFG>0 SX=S(Z,1)+1
  430     IFH>0 SY=S(Z,2)+1:RR=1
  440     IFG<0 SX=S(Z,1)-1
  450     IFH<0 SY=S(Z,2)-1:RR=2
  460     PRINTTAB(S(Z,2),S(Z,1))" "
  470     IFFNAT(SY,SX)<>32 GOTO490
  480     S(Z,1)=SX:S(Z,2)=SY
  490     COLOUR3:IFRR=1PRINTTAB(S(Z,2),S(Z,1
))CHR$226 ELSEPRINTTAB(S(Z,2),S(Z,1))CHR$227
  500     RR=RND(2)
  510   NEXTZ
  520   SC=SC+1:PRINTTAB(12,22)"Score ";300-S
C"   ":IFSC=300 GOTO630
  530   GOTO310
  540 NEXTT
  550 MODE7
  560 PRINTCHR$141;TAB(15)"RESULTS"'CHR$141;T
AB(15)"RESULTS"'''
  570 FORX=1TOA
  580   PRINTCHR$(&80+RND(6));TAB(12)"Player 
";X": ";P(X)
  590 NEXT
  600 PRINTTAB(0,22)CHR$136;CHR$&82"Press Spa
ce to Restart"
  610 REPEATUNTILGET=32
  620 RUN
  630 COLOUR0:PRINTTAB(15,10)"__"
  640 P(T)=300-SC
  650 C=0
  660 FORX=1TO4
  670   IFS(X,1)>5 AND S(X,1)<10 AND S(X,2)>1
0 AND S(X,2)<20 C=C+1
  680 NEXTX
  690 COLOUR7:IFC<4 PRINTTAB(0,22)"You failed
 to pen the sheep    "'"Your score is zero";:
P(T)=0:C=0
  700 IFC=4 PRINTTAB(0,22)"Your score was ";P
(T)"        "
  710 TIME=0:REPEAT:UNTILTIME>300:CLS:GOTO540
  720 MODE7:PRINT'CHR$141;CHR$&82;CHR$157;CHR
$&84"        SHEEPDOG  TRIALS          "CHR$1
56'CHR$141;CHR$&82;CHR$157;CHR$&84"        SH
EEPDOG  TRIALS          "CHR$156
  730 PRINT''CHR$&86"    The object of the ga
me is to herd"'CHR$&86" all four sheep into t
he pen within a"
  740 PRINTCHR$&86" fixed time  limit using  
the  cursor"'CHR$&86" keys."'CHR$&86"    When
 the  sheep have been penned,"
  750 PRINTCHR$&86" close the  gate with  the
 space bar"'CHR$&86" and your score will be  
displayed."
  760 PRINTCHR$&86"    Less than four sheep  
in the pen,"'CHR$&86" or running over the tim
e, results in"
  770 PRINTCHR$&86" a score of zero"
  780 PRINT'''CHR$&85"Any number of players c
an play,in turn"
  790 PRINT'''CHR$136;CHR$&82"   Press Space 
to start the game"
  800 REPEATUNTILGET=32
  810 RETURN
  820 FORI=224TO234:VDU23,I:FORJ=0TO7:READA:V
DUA:NEXT,:RETURN
  830   DATA0,0,2,135,126,124,230,149,0,0,64,
225,126,62,103,169,0,0,0,6,127,254,126,37,0,0
,0,96,254,127,126,164
  840   DATA1,1,1,1,1,1,1,1,128,128,128,128,1
28,128,128,128,255,0,0,0,0,0,0,0
  850   DATA255,128,128,128,128,128,128,128,2
55,1,1,1,1,1,1,1,128,128,128,128,128,128,128,
255,1,1,1,1,1,1,1,255
  860   DEFFNAT(X,Y)
  870   VDU31,X,Y:A%=135:C=USR&FFF4
  880   =(C AND&FFFF)DIV256