home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / vmsnet / ayo / part01 < prev    next >
Text File  |  1992-07-15  |  15KB  |  509 lines

  1. Path: uunet!wupost!uwm.edu!ux1.cso.uiuc.edu!umn.edu!news.cs.indiana.edu!bsu-cs!bsu-ucs.uucp!00mjstum
  2. From: 00mjstum@bsu-ucs.uucp (Matthew J. Stum)
  3. Newsgroups: vmsnet.sources.games
  4. Subject: AYO, part 001 OF 002
  5. Message-ID: <1992Jul16.103555.8753@bsu-ucs.uucp>
  6. Date: 16 Jul 92 15:35:55 GMT
  7. Lines: 500
  8.  
  9. $! ------------------ CUT HERE -----------------------
  10. $ v='f$verify(f$trnlnm("SHARE_VERIFY"))'
  11. $!
  12. $! This archive created by VMS_SHARE Version 7.2-010  25-Jun-1992
  13. $!   On 16-JUL-1992 10:31:19.73   By user 00MJSTUM (Matthew J. Stum)
  14. $!
  15. $! This VMS_SHARE Written by:
  16. $!    Andy Harper, Kings College London UK
  17. $!
  18. $! Acknowledgements to:
  19. $!    James Gray       - Original VMS_SHARE
  20. $!    Michael Bednarek - Original Concept and implementation
  21. $!
  22. $!+ THIS PACKAGE DISTRIBUTED IN 2 PARTS, TO KEEP EACH PART
  23. $!  BELOW 30 BLOCKS
  24. $!
  25. $! TO UNPACK THIS SHARE FILE, CONCATENATE ALL PARTS IN ORDER
  26. $! AND EXECUTE AS A COMMAND PROCEDURE  (  @name  )
  27. $!
  28. $! THE FOLLOWING FILE(S) WILL BE CREATED AFTER UNPACKING:
  29. $!       1. AYO.DOC;1
  30. $!       2. AYO.PAS;3
  31. $!
  32. $set="set"
  33. $set symbol/scope=(nolocal,noglobal)
  34. $f=f$parse("SHARE_TEMP","SYS$SCRATCH:.TMP_"+f$getjpi("","PID"))
  35. $e="write sys$error  ""%UNPACK"", "
  36. $w="write sys$output ""%UNPACK"", "
  37. $ if f$trnlnm("SHARE_LOG") then $ w = "!"
  38. $ ve=f$getsyi("version")
  39. $ if ve-f$extract(0,1,ve) .ges. "4.4" then $ goto START
  40. $ e "-E-OLDVER, Must run at least VMS 4.4"
  41. $ v=f$verify(v)
  42. $ exit 44
  43. $UNPACK: SUBROUTINE ! P1=filename, P2=checksum
  44. $ x = P1 - f$parse(P1,,,"version")
  45. $ y = f$search(x)
  46. $ if y .eqs. "" then $ goto file_absent
  47. $ x = f$integer(f$parse(P1,,,"version")-";")
  48. $ y = f$integer(f$parse(y,,,"version")-";")
  49. $ if x .gt. y then $ goto file_absent
  50. $ if f$mode() .eqs. "INTERACTIVE" then $ goto file_interactive
  51. $ if x .eq. y then e "-W-EXISTS, File ''P1' exists. Skipped."
  52. $ if x .ne. y then e "-W-NEWERVERSION, of File ''P1' exists. Skipped."
  53. $file_delete:
  54. $ delete 'f'*
  55. $ exit
  56. $file_interactive:
  57. $ if x .eq. y then e "-W-EXISTS, File ''P1' exists."
  58. $ if x .ne. y then e "-W-NEWERVERSION, of File ''P1' exists."
  59. $ read/error=file_delete/end=file_delete-
  60.   /prompt="Create new version [y/n]: " -
  61.   sys$command x
  62. $ if .not. x then $ e "-W-SKIPPED, File ''P1' skipped."
  63. $ if .not. x then $ goto file_delete
  64. $ P1 = P1 - f$parse(P1,,,"version")
  65. $file_absent:
  66. $ if f$parse(P1) .nes. "" then $ goto dirok
  67. $ dn=f$parse(P1,,,"DIRECTORY")
  68. $ w "-I-CREDIR, Creating directory ''dn'."
  69. $ create/dir 'dn'
  70. $ if $status then $ goto dirok
  71. $ e "-E-CREDIRFAIL, Unable to create ''dn'. File skipped."
  72. $ delete 'f'*
  73. $ exit
  74. $dirok:
  75. $ w "-I-PROCESS, Processing file ''P1'."
  76. $ if .not. f$verify() then $ define/user sys$output nl:
  77. $ EDIT/TPU/NOSEC/NODIS/COM=SYS$INPUT 'f'/OUT='P1'
  78. PROCEDURE Unpacker ON_ERROR ENDON_ERROR;SET(FACILITY_NAME,"UNPACK");SET(
  79. SUCCESS,OFF);SET(INFORMATIONAL,OFF);f:=GET_INFO(COMMAND_LINE,"file_name");b:=
  80. CREATE_BUFFER(f,f);p:=SPAN(" ")@r&LINE_END;POSITION(BEGINNING_OF(b));
  81. LOOP EXITIF SEARCH(p,FORWARD)=0;POSITION(r);ERASE(r);ENDLOOP;POSITION(
  82. BEGINNING_OF(b));g:=0;LOOP EXITIF MARK(NONE)=END_OF(b);x:=ERASE_CHARACTER(1);
  83. IF g=0 THEN IF x="X" THEN MOVE_VERTICAL(1);ENDIF;IF x="V" THEN APPEND_LINE;
  84. MOVE_HORIZONTAL(-CURRENT_OFFSET);MOVE_VERTICAL(1);ENDIF;IF x="+" THEN g:=1;
  85. ERASE_LINE;ENDIF;ELSE IF x="-" THEN IF INDEX(CURRENT_LINE,"+-+-+-+-+-+-+-+")=
  86. 1 THEN g:=0;ENDIF;ENDIF;ERASE_LINE;ENDIF;ENDLOOP;t:="0123456789ABCDEF";
  87. POSITION(BEGINNING_OF(b));LOOP r:=SEARCH("`",FORWARD);EXITIF r=0;POSITION(r);
  88. ERASE(r);x1:=INDEX(t,ERASE_CHARACTER(1))-1;x2:=INDEX(t,ERASE_CHARACTER(1))-1;
  89. COPY_TEXT(ASCII(16*x1+x2));ENDLOOP;WRITE_FILE(b,GET_INFO(COMMAND_LINE,
  90. "output_file"));ENDPROCEDURE;Unpacker;QUIT;
  91. $ delete/nolog 'f'*
  92. $ CHECKSUM 'P1'
  93. $ IF CHECKSUM$CHECKSUM .eqs. P2 THEN $ EXIT
  94. $ e "-E-CHKSMFAIL, Checksum of ''P1' failed."
  95. $ ENDSUBROUTINE
  96. $START:
  97. $ create 'f'
  98. XAYO - West African game of strategy
  99. X
  100. X* Instructions for compiling:
  101. X
  102. X  You will need a Pascal compiler as well as the
  103. X  SYS$LIBRARY:PASCAL$LIB_ROUTINES.PEN environment file.
  104. X
  105. X  $ PAS AYO.PAS
  106. X  $ LINK AYO.OBJ
  107. X  $ RUN AYO
  108. X
  109. X* Game information and instructions:
  110. X
  111. X  Background and instructions are available at the main menu.
  112. X
  113. X
  114. XMatt Stum
  115. X00mjstum@leo.bsuvc.bsu.edu
  116. $ CALL UNPACK AYO.DOC;1 1198855459
  117. $ create 'f'
  118. X`7B
  119. X`09Title:   AYO - West African game of strategy
  120. X`09Author:  Matthew J. Stum
  121. X`09Address: 00mjstum@leo.bsuvc.bsu.edu
  122. X`7D
  123. X
  124. X`5Binherit ('sys$library:starlet','sys$library:pascal$lib_routines')`5D
  125. Xprogram ayo(input,output,logfile);
  126. X
  127. Xconst
  128. X`09esc = chr(27);
  129. X`09rv = esc+'`5B7m';
  130. X`09norm = esc+'`5B0m';
  131. X`09p1 = rv;
  132. X`09p2 = norm;
  133. X`09func = io$_readvblk+io$m_noecho;
  134. X
  135. Xtype
  136. X`09v4string = varying `5B4`5D of char;
  137. X`09v8string = varying `5B8`5D of char;
  138. X`09pocket_type = array `5B'a'..'l'`5D of integer;
  139. X
  140. Xvar
  141. X`09logfile:text;
  142. X`09logging:boolean;
  143. X`09stat:unsigned;
  144. X`09iochan:`5Bword`5D0..65355;
  145. X`09pocket:array `5B'a'..'l'`5D of integer;
  146. X`09owner:array `5B'a'..'l'`5D of v4string;
  147. X`09loc,loc2:array `5B'a'..'l'`5D of v8string;
  148. X`09hand,comp:integer;
  149. X`09comp_start:char;
  150. X`09done,
  151. X`09really_done:boolean;
  152. X`09pocket_choice,
  153. X`09final_pocket:char;
  154. X`09player:v4string;
  155. X`09game:integer;
  156. X`09difficulty_level:integer;
  157. X`09tm:packed array `5B1..11`5D of char;
  158. X`09key,choice:char;
  159. X`09i:integer;
  160. X
  161. Xprocedure logit(scores:pocket_type; choice:char);
  162. Xvar   i:char;
  163. Xbegin
  164. X`09open(file_variable:=logfile,file_name:='ayo.log',
  165. X`09`09history:=unknown);
  166. X`09extend(logfile);
  167. X`09for i:='a' to 'l' do
  168. X`09   begin
  169. X`09`09write(logfile,i,pocket`5Bi`5D:5,'   ');
  170. X`09   end;
  171. X`09writeln(logfile);
  172. X`09for i:='a' to 'l' do
  173. X`09   begin
  174. X`09`09write(logfile,i,scores`5Bi`5D:5,'   ');
  175. X`09   end;
  176. X`09writeln(logfile);
  177. X`09writeln(logfile,'Choice: ',choice);
  178. X`09writeln(logfile);
  179. X`09close(logfile);
  180. Xend;
  181. X
  182. Xprocedure set_ownership;
  183. Xvar i:char;
  184. Xbegin
  185. X`09for i:='a' to pred(comp_start) do
  186. X`09`09owner`5Bi`5D:=esc+'`5B7m';
  187. X`09for i:=comp_start to 'l' do
  188. X`09`09owner`5Bi`5D:=esc+'`5B0m';
  189. Xend;
  190. X
  191. Xprocedure init_pockets;
  192. Xvar i:char;
  193. Xbegin
  194. X`09hand:=0;
  195. X`09comp:=0;
  196. X`09for i:='a' to 'l' do
  197. X`09`09pocket`5Bi`5D:=4;
  198. Xend;
  199. X
  200. Xprocedure init_loc;
  201. Xvar i:char;
  202. Xbegin
  203. X`09for i:='a' to 'f' do
  204. X`09   begin
  205. X`09`09writev(loc`5Bi`5D,esc,'`5B',12:1,';',24+(ord(i)-ord('a'))*6:1,'H');
  206. X`09`09writev(loc2`5Bi`5D,esc,'`5B',14:1,';',25+(ord(i)-ord('a'))*6:1,'H');
  207. X`09   end;
  208. X`09for i:='g' to 'l' do
  209. X`09   begin
  210. X`09`09writev(loc`5Bi`5D,esc,'`5B',9:1,';',24+(ord('l')-ord(i))*6:1,'H');
  211. X`09`09writev(loc2`5Bi`5D,esc,'`5B',7:1,';',25+(ord('l')-ord(i))*6:1,'H');
  212. X`09   end;
  213. Xend;
  214. X
  215. Xprocedure show_seeds;
  216. Xvar i:char;
  217. Xbegin
  218. X`09for i:='l' downto 'g' do
  219. X`09 `09writeln(loc`5Bi`5D,owner`5Bi`5D,pocket`5Bi`5D:2,norm);
  220. X`09for i:='a' to 'f' do
  221. X`09 `09writeln(loc`5Bi`5D,owner`5Bi`5D,pocket`5Bi`5D:2,norm);
  222. Xend;
  223. X
  224. Xprocedure show_captured;
  225. Xbegin
  226. X`09writeln(esc,'`5B16;25HSeeds Captured:');
  227. X`09writeln(esc,'`5B17;27H     You: ',hand:2);
  228. X`09writeln(esc,'`5B18;27HComputer: ',comp:2);
  229. Xend;
  230. X
  231. Xprocedure show_last_game;
  232. Xbegin
  233. X`09writeln(esc,'`5B10;1HLast Round (#',game-1:1,'): ');
  234. X`09writeln('       You: ',hand:2);
  235. X`09writeln('  Computer: ',48-hand:2);
  236. Xend;
  237. X
  238. Xprocedure redraw;
  239. Xbegin
  240. X`09write(esc,'`5B2J');
  241. X`09writeln(rv,esc,'`5B2;35H         ',norm,'\');
  242. X`09writeln(rv,esc,'`5B3;35H  A Y O  ',norm,' `7C');
  243. X`09writeln(rv,esc,'`5B4;35H         ',norm,' `7C');
  244. X`09writeln(   esc,'`5B5;35H\________\`7C');
  245. X`09writeln(esc,'`5B5;66HLevel: ',(difficulty_level) div 2:1);
  246. X`09if player=p1 then
  247. X`09`09writeln(esc,'`5B6;65HFirst: You')
  248. X`09   else
  249. X`09`09writeln(esc,'`5B6;63HFirst: Computer');
  250. X`09writeln( esc,'`5B7;22H   L     K     J     I     H     G');
  251. X`09writeln( esc,'`5B8;22H/----\/----\/----\/----\/----\/----\     Ctrl-W = R
  252. Vedraw');
  253. X`09writeln( esc,'`5B9;22H`7C    `7C`7C    `7C`7C    `7C`7C    `7C`7C    `7C`
  254. V7C    `7C       the screen.');
  255. X`09writeln(esc,'`5B10;22H\----/\----/\----/\----/\----/\----/');
  256. X`09writeln(esc,'`5B11;22H/----\/----\/----\/----\/----\/----\        Q = Qui
  257. Vt.');
  258. X`09writeln(esc,'`5B12;22H`7C    `7C`7C    `7C`7C    `7C`7C    `7C`7C    `7C`
  259. V7C    `7C');
  260. X`09writeln(esc,'`5B13;22H\----/\----/\----/\----/\----/\----/        M = Ans
  261. Vwer');
  262. X`09writeln(esc,'`5B14;22H   A     B     C     D     E     F          your ma
  263. Vil.');
  264. X`09show_seeds;
  265. X`09show_captured;
  266. X`09if game>1 then show_last_game;
  267. Xend;
  268. X
  269. Xprocedure move_seeds(pkt:char; var final:char);
  270. Xvar i,j:integer;
  271. Xbegin
  272. X`09j:=pocket`5Bpkt`5D;
  273. X`09pocket`5Bpkt`5D:=0;
  274. X`09writeln(loc`5Bpkt`5D,owner`5Bpkt`5D,pocket`5Bpkt`5D:2,norm);
  275. X`09writeln(rv,loc2`5Bpkt`5D,chr(ord(pkt)-ord('a')+ord('A')),norm);
  276. X`09writeln(loc2`5Bpkt`5D,chr(ord(pkt)-ord('a')+ord('A')));
  277. X`09for i:=1 to j do
  278. X`09   begin
  279. X`09`09pkt:=succ(pkt);
  280. X`09`09if pkt>'l' then pkt:='a';
  281. X`09`09pocket`5Bpkt`5D:=pocket`5Bpkt`5D+1;
  282. X`09`09writeln(loc`5Bpkt`5D,owner`5Bpkt`5D,pocket`5Bpkt`5D:2,norm);
  283. X`09`09writeln(rv,loc2`5Bpkt`5D,chr(ord(pkt)-ord('a')+ord('A')),norm);
  284. X`09`09writeln(loc2`5Bpkt`5D,chr(ord(pkt)-ord('a')+ord('A')));
  285. X`09   end;
  286. X`09final:=pkt;
  287. Xend;
  288. X
  289. Xprocedure capture(player:v4string; pkt:char);
  290. Xvar temp:integer;
  291. Xbegin
  292. X`09temp:=0;
  293. X`09while (pocket`5Bpkt`5D in `5B2,3`5D) do
  294. X`09   begin
  295. X`09`09temp:=temp+pocket`5Bpkt`5D;
  296. X`09`09pocket`5Bpkt`5D:=0;
  297. X`09`09writeln(loc`5Bpkt`5D,owner`5Bpkt`5D,pocket`5Bpkt`5D:2,norm);
  298. X`09`09writeln(rv,loc2`5Bpkt`5D,chr(ord(pkt)-ord('a')+ord('A')),norm);
  299. X`09`09writeln(loc2`5Bpkt`5D,chr(ord(pkt)-ord('a')+ord('A')));
  300. X`09`09pkt:=pred(pkt);
  301. X`09`09if pkt<'a' then pkt:='l';
  302. X`09   end;
  303. X`09if player=p1 then
  304. X`09   begin
  305. X`09`09hand:=hand+temp;
  306. X`09`09show_captured;
  307. X`09   end
  308. X`09  else
  309. X`09   begin
  310. X`09`09comp:=comp+temp;
  311. X`09`09show_captured;
  312. X`09   end;
  313. Xend;
  314. X
  315. Xprocedure get_player_choice(var pkt:char);
  316. Xvar valid:boolean;
  317. Xbegin
  318. X`09valid:=false;
  319. X`09repeat
  320. X`09   repeat
  321. X`09`09stat:=$qiow(chan:=iochan,func:=func,p1:=pkt,
  322. X`09`09`09p2:=1);
  323. X`09`09case pkt of
  324. X`09`09chr(23):redraw;
  325. X`09`09end; (*case*)
  326. X`09   until pkt in `5B'a'..'m','A'..'M','q','Q'`5D;
  327. X`09   if pkt in `5B'A'..'L'`5D then
  328. X`09`09pkt := chr(ord(pkt)-ord('A')+ord('a'));
  329. X`09   if pkt in `5B'q','Q'`5D then
  330. X`09`09valid:=true
  331. X`09     else
  332. X`09   if pkt in `5B'm','M'`5D then
  333. X`09      begin
  334. X`09`09writeln(esc,'`5B2J',esc,'`5B1;1HEntering Mail...');
  335. X`09`09lib$spawn('Mail');
  336. X`09`09redraw;
  337. X`09      end
  338. X`09     else
  339. X`09   if (owner`5Bpkt`5D=player)and(pocket`5Bpkt`5D>0) then
  340. X`09`09valid:=true;
  341. X`09until valid;
  342. Xend;
  343. X
  344. Xfunction evaluate_move(pkt:char; pocket:pocket_type; level:integer):integer;
  345. Xvar scores:pocket_type; top:integer; temp:char;
  346. X    i,j,score:integer;
  347. Xbegin
  348. X`09score:=0;
  349. X`09j:=pocket`5Bpkt`5D;
  350. X`09pocket`5Bpkt`5D:=0;
  351. X`09for i:=1 to j do
  352. X`09   begin
  353. X`09`09pkt:=succ(pkt);
  354. X`09`09if pkt>'l' then pkt:='a';
  355. X`09`09pocket`5Bpkt`5D:=pocket`5Bpkt`5D+1;
  356. X`09   end;
  357. X`09while (pocket`5Bpkt`5D in `5B2,3`5D) do
  358. X`09   begin
  359. X`09`09if odd(level) then
  360. X`09`09`09score:=score+pocket`5Bpkt`5D
  361. X`09`09   else
  362. X`09`09`09score:=score-pocket`5Bpkt`5D;
  363. X`09`09pocket`5Bpkt`5D:=0;
  364. X`09`09pkt:=pred(pkt);
  365. X`09`09if pkt<'a' then pkt:='l';
  366. X`09   end;
  367. X`09if level=difficulty_level then evaluate_move:=score
  368. X`09  else
  369. X`09if odd(level) then
  370. X`09   begin
  371. X`09`09for temp:='a' to 'l' do
  372. X`09`09`09scores`5Btemp`5D:=50*(10-level);
  373. X`09`09temp:='a';
  374. X`09`09while temp<=pred(comp_start) do
  375. X`09`09   begin
  376. X`09`09`09if pocket`5Btemp`5D>0 then
  377. X`09`09`09`09scores`5Btemp`5D:=evaluate_move(temp,pocket,level+1);
  378. X`09`09`09temp:=succ(temp);
  379. X`09`09   end;
  380. X`09`09temp:='a';
  381. X`09`09top:=999;
  382. X`09`09while temp<=pred(comp_start) do
  383. X`09`09   begin
  384. X`09`09`09if scores`5Btemp`5D<top then
  385. X`09`09`09   begin
  386. X`09`09`09`09top:=scores`5Btemp`5D;
  387. X`09`09`09`09pkt:=temp;
  388. X`09`09`09   end;
  389. X`09`09`09temp:=succ(temp);
  390. X`09`09   end;
  391. X`09   end
  392. X`09  else
  393. X`09   begin
  394. X`09`09for temp:='a' to 'l' do
  395. X`09`09`09scores`5Btemp`5D:=-51;
  396. X`09`09temp:=comp_start;
  397. X`09`09while temp<='l' do
  398. X`09`09   begin
  399. X`09`09`09if pocket`5Btemp`5D>0 then
  400. X`09`09`09`09scores`5Btemp`5D:=evaluate_move(temp,pocket,level+1);
  401. X`09`09`09temp:=succ(temp);
  402. X`09`09   end;
  403. X`09`09temp:=comp_start;
  404. X`09`09top:=-999;
  405. X`09`09while temp<='l' do
  406. X`09`09   begin
  407. X`09`09`09if scores`5Btemp`5D>top then
  408. X`09`09`09   begin
  409. X`09`09`09`09top:=scores`5Btemp`5D;
  410. X`09`09`09`09pkt:=temp;
  411. X`09`09`09   end;
  412. X`09`09`09temp:=succ(temp);
  413. X`09`09   end;
  414. X`09   end;
  415. X`09evaluate_move:=score+top;
  416. Xend;
  417. X
  418. Xprocedure get_computer_choice(var pkt:char);
  419. Xvar score:pocket_type; top:integer; temp:char; pkt2:char;
  420. Xbegin
  421. X`09writeln(esc,'`5B19;1HThinking...');
  422. X`09for temp:='a' to 'l' do
  423. X`09`09score`5Btemp`5D:=-9999;
  424. X`09temp:=comp_start;
  425. X`09while temp<='l' do
  426. X`09   begin
  427. X`09`09if pocket`5Btemp`5D>0 then
  428. X`09`09`09score`5Btemp`5D:=evaluate_move(temp,pocket,1);
  429. X`09`09temp:=succ(temp);
  430. X`09   end;
  431. X`09temp:=comp_start;
  432. X`09top:=-9999;
  433. X`09pkt2:=' ';
  434. X`09pkt:=' ';
  435. X`09while temp<='l' do
  436. X`09   begin
  437. X`09`09if pocket`5Btemp`5D>0 then
  438. X`09`09`09if score`5Btemp`5D>top then
  439. X`09`09`09   begin
  440. X`09`09`09`09top:=score`5Btemp`5D;
  441. X`09`09`09`09pkt2:=pkt;
  442. X`09`09`09`09pkt:=temp;
  443. X`09`09`09   end;
  444. X`09`09temp:=succ(temp);
  445. X`09   end;
  446. X`09time(tm);
  447. X`09if tm`5B11`5D in `5B'0'`5D then
  448. X`09   if pkt2<>' ' then pkt:=pkt2;
  449. X`09if logging then logit(score,pkt);
  450. X`09writeln(esc,'`5B19;1H           ');
  451. Xend;
  452. X
  453. Xprocedure are_we_done(player:v4string; var done:boolean);
  454. Xvar i:char;
  455. Xbegin
  456. X`09done:=true;
  457. X`09for i:='a' to 'l' do
  458. X`09  if (pocket`5Bi`5D>0)and(owner`5Bi`5D=player) then done:=false;
  459. Xend;
  460. X
  461. Xprocedure divy_up(var comp_start:char);
  462. Xvar i:char;
  463. Xbegin
  464. X`09`09for i:='a' to pred(comp_start) do
  465. X`09`09  begin
  466. X`09`09   hand:=hand+pocket`5Bi`5D;
  467. X`09`09  end;
  468. X`09`09i:=chr(ord('a')+(hand div 4));
  469. X`09`09case (hand mod 4) of
  470. X`09`09   0,1: comp_start:=i;
  471. X`09`09     3: begin
  472. X`09`09`09owner`5Bi`5D:=p1;
  473. X`09`09`09comp_start:=succ(i)
  474. X`09`09`09end;
  475. X`09`09     2: if owner`5Bi`5D=p1 then
  476. X`09`09`09`09comp_start:=succ(i)
  477. X`09`09`09   else
  478. X`09`09`09`09comp_start:=i;
  479. X`09`09`09end; (*case*)
  480. X`09`09game:=game+1;
  481. X`09`09show_last_game;
  482. Xend;
  483. X
  484. Xprocedure play_the_game;
  485. Xbegin
  486. X`09comp_start:='g';
  487. X`09game:=1;
  488. X`09init_loc;
  489. X`09set_ownership;
  490. X`09init_pockets;
  491. X`09redraw;
  492. X`09really_done:=false;
  493. X`09repeat
  494. X`09`09repeat
  495. X`09`09`09if player=p1 then
  496. X`09`09`09   get_player_choice(pocket_choice)
  497. X`09`09`09  else
  498. X`09`09`09   get_computer_choice(pocket_choice);
  499. X`09`09`09if not(pocket_choice in `5B'q','Q'`5D) then
  500. X`09`09`09   begin
  501. X`09`09`09`09move_seeds(pocket_choice,final_pocket);
  502. X`09`09`09`09capture(player,final_pocket);
  503. X`09`09`09`09if player=p1 then player:=p2 else player:=p1;
  504. X`09`09`09`09are_we_done(player,done);
  505. +-+-+-+-+-+-+-+-  END  OF PART 1 +-+-+-+-+-+-+-+-
  506. -- 
  507. Matt Stum                    Gwydion ap Myrddin       Ball State University
  508. 00mjstum@leo.bsuvc.bsu.edu   Shire of Afonlyn, MK     Muncie, IN  USA
  509.