home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 3 / 3237 < prev    next >
Encoding:
Internet Message Format  |  1991-04-24  |  26.7 KB

  1. From: xanthian@zorch.SF-Bay.ORG (Kent Paul Dolan)
  2. Newsgroups: rec.games.programmers,alt.sources,alt.sources.amiga
  3. Subject: townmaze, patch 2
  4. Message-ID: <1991Apr23.180113.11575@zorch.SF-Bay.ORG>
  5. Date: 23 Apr 91 18:01:13 GMT
  6.  
  7. Archive-name: townmaze/patch2
  8.  
  9. Another bug that got past a couple of forgiving systems and died cold on
  10. a system with strict memory checking; I got a little outside the bounds
  11. of cmaze[][] under occasional maze seed dependent conditions due to two
  12. sign errores in closegates.c math and tromped on unallocated memory.
  13.  
  14. It was not a bug exactly, but the massive while statement condition at
  15. the bottom of makeunused.c blew away the parse buffer available storage
  16. for a couple of users' compilers. I pulled it out and made it a separate
  17. routine "wimpy_cc()" in the same file.
  18.  
  19. Thanks for problem report inputs that led to this patch to:
  20.  
  21.     Stefan M. Linnemann <crissl@rulcvx.LeidenUniv.nl>
  22.     dwade@jarthur.Claremont.edu
  23.     rmk@rmkhome.uucp (Rick Kelly)
  24.  
  25. I appreciate the help!
  26.  
  27. changes:
  28.  
  29. CHANGES
  30.  
  31.   Updated with this information.
  32.  
  33. patchlevel.h
  34.  
  35.   Updated to patchlevel 2
  36.  
  37. closegates.c
  38.  
  39.   Fixed two bugs in gatewalking code that was stepping outside the cmaze[]
  40.   limits, thanks to a bug report and patch supplied by Stefan M. Linnemann
  41.   <crissl@rulcvx.LeidenUniv.nl>.  Added comments to a few associated lines.
  42.  
  43. makeunused.c
  44.  
  45.   The 59 condition check in the do{}while loop's condition was overflowing
  46.   parse buffers on some smaller compilers, so it has now become a separate
  47.   routine, wimpy_cc() <Heh!> internal to makeunused.c.  Thanks for reports
  48.   from dwade@jarthur.Claremont.edu and rmk@rmkhome.uucp (Rick Kelly) of the
  49.   problem.
  50.  
  51. townmaze.test
  52.  
  53.   Clarified the descriptions for two tests; I'd muddled the effect a
  54.   courtyard or its lack could produce in a small maze.
  55.  
  56. townpgmr.doc
  57.  
  58.   Updated to reflect the changes in makeunused.c.
  59.  
  60. As with the previous patch, unpack this shar in the directory where your
  61. townmaze source is, and do "patch < patch02".  This shar and patch have
  62. been tested against the patch level 1 townmaze code and worked OK here.
  63.  
  64. Enjoy!
  65.  
  66. Kent, the man from xanth.
  67. <xanthian@Zorch.SF-Bay.ORG> <xanthian@well.sf.ca.us>
  68.  
  69.  
  70. #! /bin/sh
  71. # This is a shell archive.  Remove anything before this line, then unpack
  72. # it by saving it into a file and typing "sh file".  To overwrite existing
  73. # files, type "sh file -c".  You can also feed this as standard input via
  74. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  75. # will see the following message at the end:
  76. #        "End of archive 1 (of 1)."
  77. # Contents:  MANIFESTp1.2 patch02
  78. # Wrapped by xanthian@zorch on Tue Apr 23 10:28:48 1991
  79. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  80. if test -f 'MANIFESTp1.2' -a "${1}" != "-c" ; then 
  81.   echo shar: Will not clobber existing file \"'MANIFESTp1.2'\"
  82. else
  83. echo shar: Extracting \"'MANIFESTp1.2'\" \(176 characters\)
  84. sed "s/^X//" >'MANIFESTp1.2' <<'END_OF_FILE'
  85. X   File Name        Archive #    Description
  86. X-----------------------------------------------------------
  87. X MANIFESTp1.2               1    This shipping list
  88. X patch02                    1    
  89. END_OF_FILE
  90. if test 176 -ne `wc -c <'MANIFESTp1.2'`; then
  91.     echo shar: \"'MANIFESTp1.2'\" unpacked with wrong size!
  92. fi
  93. # end of 'MANIFESTp1.2'
  94. fi
  95. if test -f 'patch02' -a "${1}" != "-c" ; then 
  96.   echo shar: Will not clobber existing file \"'patch02'\"
  97. else
  98. echo shar: Extracting \"'patch02'\" \(22788 characters\)
  99. sed "s/^X//" >'patch02' <<'END_OF_FILE'
  100. XThis says there should be a patchlevel.h file containing a 1; it should
  101. Xremain from installing patch 1. It will be updated to be patchlevel 2 by
  102. Xthis patch. Kent.
  103. X
  104. XPrereq: 1
  105. X
  106. X*** patchlevel.h.old    Tue Apr 23 09:17:58 1991
  107. X--- patchlevel.h    Tue Apr 23 09:17:39 1991
  108. X***************
  109. X*** 1 ****
  110. X! #define patchlevel 1
  111. X--- 1 ----
  112. X! #define patchlevel 2
  113. X*** CHANGES.old    Fri Apr 19 23:47:44 1991
  114. X--- CHANGES    Tue Apr 23 09:38:28 1991
  115. X***************
  116. X*** 1,5 ****
  117. X--- 1,38 ----
  118. X  CHANGES -- change record for townmaze
  119. X  
  120. X+ v 1.2 23 April 1991
  121. X+ 
  122. X+ CHANGES
  123. X+ 
  124. X+   Updated this file.
  125. X+ 
  126. X+ patchlevel.h
  127. X+ 
  128. X+   Set to patchlevel 2.
  129. X+ 
  130. X+ closegates.c
  131. X+ 
  132. X+   Fixed two bugs in gatewalking code that was stepping outside the cmaze[]
  133. X+   limits, thanks to a bug report and patch supplied by Stefan M. Linnemann
  134. X+   <crissl@rulcvx.LeidenUniv.nl>.  Added comments to a few associated lines.
  135. X+ 
  136. X+ makeunused.c
  137. X+ 
  138. X+   The 59 condition check in the do{}while loop's condition was overflowing
  139. X+   parse buffers on some smaller compilers, so it has now become a separate
  140. X+   routine, wimpy_cc() <Heh!> internal to makeunused.c.  Thanks for reports
  141. X+   from dwade@jarthur.Claremont.edu and rmk@rmkhome.uucp (Rick Kelly) of the
  142. X+   problem.
  143. X+ 
  144. X+ townmaze.test
  145. X+ 
  146. X+   Clarified the descriptions for two tests; I'd muddled the effect a
  147. X+   courtyard or its lack could produce in a small maze.
  148. X+ 
  149. X+ townpgmr.doc
  150. X+ 
  151. X+   Updated to reflect the changes in makeunused.c.
  152. X+ 
  153. X  v 1.1 20 April 1991
  154. X  
  155. X  CHANGES
  156. X*** closegates.c.old    Tue Apr 23 07:49:17 1991
  157. X--- closegates.c    Tue Apr 23 08:04:24 1991
  158. X***************
  159. X*** 49,76 ****
  160. X  
  161. X      for (gatewalk = 0; gatewalk < possiblegates; gatewalk++)
  162. X      {
  163. X!       if (gatewalk < (mazewidth-1)/2)
  164. X        {
  165. X          mazei = 0;
  166. X          mazej = 2 * gatewalk + 1;
  167. X        }
  168. X        else
  169. X!         if (gatewalk < ((mazewidth-1)/2 + (mazeheight-1)/2))
  170. X          {
  171. X            mazei = 2 * (gatewalk - (mazewidth-1)/2) + 1;
  172. X            mazej = mazewidth-1;
  173. X          }
  174. X          else
  175. X!           if (gatewalk < ((mazewidth-1) + (mazeheight-1)/2))
  176. X            {
  177. X              mazei = mazeheight-1;
  178. X!             mazej = 2 * (((mazewidth-1)/2)-
  179. X!                     (gatewalk-((mazewidth-1)/2 + (mazeheight-1)/2))) + 1;
  180. X            }
  181. X!           else
  182. X            {
  183. X!             mazei = 2 * (((mazeheight-1)/2)-
  184. X!                     (gatewalk-((mazewidth-1) + (mazeheight-1)/2))) + 1;
  185. X              mazej = 0;
  186. X            }
  187. X  
  188. X--- 49,84 ----
  189. X  
  190. X      for (gatewalk = 0; gatewalk < possiblegates; gatewalk++)
  191. X      {
  192. X!       if (gatewalk < (mazewidth-1)/2) /* Pick a side: top? */
  193. X        {
  194. X          mazei = 0;
  195. X          mazej = 2 * gatewalk + 1;
  196. X        }
  197. X        else
  198. X!         if (gatewalk < ((mazewidth-1)/2 + (mazeheight-1)/2)) /* right? */
  199. X          {
  200. X            mazei = 2 * (gatewalk - (mazewidth-1)/2) + 1;
  201. X            mazej = mazewidth-1;
  202. X          }
  203. X          else
  204. X! /*
  205. X! **  Thanks to Stefan M. Linnemann <crissl@rulcvx.LeidenUniv.nl> for picking
  206. X! **  up the two errors flagged beneath his user ID below, where I had "+ 1" and
  207. X! **  needed the "- 1"'s shown.  Again, it dumped core on other machines, ran
  208. X! **  OK on mine.  Sigh.  Stefan was kind enough to send the repair back as a
  209. X! **  patch, and then to patiently explain to me in a second note _why_ what I
  210. X! **  did was wrong.
  211. X! */
  212. X!           if (gatewalk < ((mazewidth-1) + (mazeheight-1)/2)) /* bottom? */
  213. X            {
  214. X              mazei = mazeheight-1;
  215. X!             mazej = 2 * (((mazewidth-1)/2)-                      /* crissl */
  216. X!                     (gatewalk-((mazewidth-1)/2 + (mazeheight-1)/2))) - 1;
  217. X            }
  218. X!           else  /* left! */
  219. X            {
  220. X!             mazei = 2 * (((mazeheight-1)/2)-                      /* crissl */
  221. X!                     (gatewalk-((mazewidth-1) + (mazeheight-1)/2))) - 1;
  222. X              mazej = 0;
  223. X            }
  224. X  
  225. X*** makeunused.c.old    Fri Apr 19 18:11:17 1991
  226. X--- makeunused.c    Tue Apr 23 10:01:58 1991
  227. X***************
  228. X*** 58,185 ****
  229. X  
  230. X        tries++;
  231. X  
  232. X!     } while
  233. X!       (   (tries <= MAXTRIES)
  234. X!        && (   /* To avoid locking in an isolated room, check all 49 cells */
  235. X!               /* centered on this cell, the hard way: no loop, no direct  */
  236. X!               /* index to the cells. Goal is to be able to run a street  */
  237. X!               /* on all four sides of the 3x3 cell array centered at this */
  238. X!               /* cell. */
  239. X  
  240. X!               /* First verify cell and immediate neighbors two out all */
  241. X!               /* have all their neighbors; if not, we're too close to a */
  242. X!               /* border. */
  243. X  
  244. X-               (interiorcell(chosencell) != (1==1))
  245. X- 
  246. X-            || (interiorcell(nhbris(chosencell,0)) != (1==1))
  247. X-            || (interiorcell(nhbris(nhbris(chosencell,0),0)) != (1==1))
  248. X-            || (interiorcell(nhbris(chosencell,1)) != (1==1))
  249. X-            || (interiorcell(nhbris(nhbris(chosencell,1),1)) != (1==1))
  250. X-            || (interiorcell(nhbris(chosencell,2)) != (1==1))
  251. X-            || (interiorcell(nhbris(nhbris(chosencell,2),2)) != (1==1))
  252. X-            || (interiorcell(nhbris(chosencell,3)) != (1==1))
  253. X-            || (interiorcell(nhbris(nhbris(chosencell,3),3)) != (1==1))
  254. X- 
  255. X-               /* Now check all 49 cells for ISOLATED status -- yeech! */
  256. X- 
  257. X-               /* check the chosen cell */
  258. X-            || (statlist[chosencell].status != ISOLATED)
  259. X- 
  260. X-               /* check to the north/up */
  261. X-            || (statlist[nhbris(chosencell,0)].status != ISOLATED)
  262. X-            || (statlist[nhbris(nhbris(chosencell,0),0)].status != ISOLATED)
  263. X-            || (statlist[nhbris(nhbris(nhbris(chosencell,
  264. X-                                0),0),1)].status != ISOLATED)
  265. X-            || (statlist[nhbris(nhbris(nhbris(chosencell,
  266. X-                                0),0),3)].status != ISOLATED)
  267. X-            || (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,
  268. X-                                0),0),3),3)].status != ISOLATED)
  269. X-            || (statlist[nhbris(nhbris(nhbris(chosencell,
  270. X-                                0),0),0)].status != ISOLATED)
  271. X-            || (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,
  272. X-                                0),0),0),1)].status != ISOLATED)
  273. X-            || (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,
  274. X-                                0),0),0),1),1)].status != ISOLATED)
  275. X-            || (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,
  276. X-                                0),0),0),3)].status != ISOLATED)
  277. X-            || (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,
  278. X-                                0),0),0),3),3)].status != ISOLATED)
  279. X-            || (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,
  280. X-                                0),0),0),3),3),3)].status != ISOLATED)
  281. X-            || (statlist[nhbris(nhbris(chosencell,0),3)].status != ISOLATED)
  282. X- 
  283. X-               /* check to the east/right */
  284. X-            || (statlist[nhbris(chosencell,1)].status != ISOLATED)
  285. X-            || (statlist[nhbris(nhbris(chosencell,1),0)].status != ISOLATED)
  286. X-            || (statlist[nhbris(nhbris(chosencell,1),1)].status != ISOLATED)
  287. X-            || (statlist[nhbris(nhbris(nhbris(chosencell,
  288. X-                                1),1),2)].status != ISOLATED)
  289. X-            || (statlist[nhbris(nhbris(nhbris(chosencell,
  290. X-                                1),1),0)].status != ISOLATED)
  291. X-            || (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,
  292. X-                                1),1),0),0)].status != ISOLATED)
  293. X-            || (statlist[nhbris(nhbris(nhbris(chosencell,
  294. X-                                1),1),1)].status != ISOLATED)
  295. X-            || (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,
  296. X-                                1),1),1),2)].status != ISOLATED)
  297. X-            || (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,
  298. X-                                1),1),1),2),2)].status != ISOLATED)
  299. X-            || (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,
  300. X-                                1),1),1),0)].status != ISOLATED)
  301. X-            || (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,
  302. X-                                1),1),1),0),0)].status != ISOLATED)
  303. X-            || (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,
  304. X-                                1),1),1),0),0),0)].status != ISOLATED)
  305. X- 
  306. X-               /* check to the south/down */
  307. X-            || (statlist[nhbris(chosencell,2)].status != ISOLATED)
  308. X-            || (statlist[nhbris(nhbris(chosencell,2),1)].status != ISOLATED)
  309. X-            || (statlist[nhbris(nhbris(chosencell,2),2)].status != ISOLATED)
  310. X-            || (statlist[nhbris(nhbris(nhbris(chosencell,
  311. X-                                2),2),3)].status != ISOLATED)
  312. X-            || (statlist[nhbris(nhbris(nhbris(chosencell,
  313. X-                                2),2),1)].status != ISOLATED)
  314. X-            || (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,
  315. X-                                2),2),1),1)].status != ISOLATED)
  316. X-            || (statlist[nhbris(nhbris(nhbris(chosencell,
  317. X-                                2),2),2)].status != ISOLATED)
  318. X-            || (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,
  319. X-                                2),2),2),3)].status != ISOLATED)
  320. X-            || (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,
  321. X-                                2),2),2),3),3)].status != ISOLATED)
  322. X-            || (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,
  323. X-                                2),2),2),1)].status != ISOLATED)
  324. X-            || (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,
  325. X-                                2),2),2),1),1)].status != ISOLATED)
  326. X-            || (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,
  327. X-                                2),2),2),1),1),1)].status != ISOLATED)
  328. X- 
  329. X-               /* check to the west/left */
  330. X-            || (statlist[nhbris(chosencell,3)].status != ISOLATED)
  331. X-            || (statlist[nhbris(nhbris(chosencell,3),2)].status != ISOLATED)
  332. X-            || (statlist[nhbris(nhbris(chosencell,3),3)].status != ISOLATED)
  333. X-            || (statlist[nhbris(nhbris(nhbris(chosencell,
  334. X-                                3),3),0)].status != ISOLATED)
  335. X-            || (statlist[nhbris(nhbris(nhbris(chosencell,
  336. X-                                3),3),2)].status != ISOLATED)
  337. X-            || (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,
  338. X-                                3),3),2),2)].status != ISOLATED)
  339. X-            || (statlist[nhbris(nhbris(nhbris(chosencell,
  340. X-                                3),3),3)].status != ISOLATED)
  341. X-            || (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,
  342. X-                                3),3),3),0)].status != ISOLATED)
  343. X-            || (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,
  344. X-                                3),3),3),0),0)].status != ISOLATED)
  345. X-            || (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,
  346. X-                                3),3),3),2)].status != ISOLATED)
  347. X-            || (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,
  348. X-                                3),3),3),2),2)].status != ISOLATED)
  349. X-            || (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,
  350. X-                                3),3),3),2),2),2)].status != ISOLATED)
  351. X-           )
  352. X-       );
  353. X- 
  354. X      if (tries <= MAXTRIES)
  355. X      {
  356. X        movefromto(&isolated,&isolatedct,&unused,&unusedct,UNUSED,chosencell);
  357. X--- 58,72 ----
  358. X  
  359. X        tries++;
  360. X  
  361. X! /*
  362. X! ** Some C compilers couldn't cope with the big ugly while condition that used
  363. X! ** to be here, so it has become an internal routine called here.  Thanks to
  364. X! ** dwade@jarthur.Claremont.edu and rmk@rmkhome.uucp (Rick Kelly) for reporting
  365. X! ** the problem.
  366. X! */
  367. X  
  368. X!     } while ((tries <= MAXTRIES) && wimpy_cc(chosencell));
  369. X  
  370. X      if (tries <= MAXTRIES)
  371. X      {
  372. X        movefromto(&isolated,&isolatedct,&unused,&unusedct,UNUSED,chosencell);
  373. X***************
  374. X*** 195,198 ****
  375. X--- 82,321 ----
  376. X      }
  377. X    }
  378. X    return;
  379. X+ }
  380. X+ 
  381. X+ /*
  382. X+ ** Several compilers across the net died trying to digest what is now the
  383. X+ ** contents of this routine as a single statement.  Sigh.
  384. X+ */
  385. X+ 
  386. X+ #ifdef __STDC__
  387. X+ int wimpy_cc(int chosencell)
  388. X+ #else
  389. X+ int wimpy_cc(chosencell)
  390. X+   int chosencell;
  391. X+ #endif
  392. X+ 
  393. X+ {
  394. X+ 
  395. X+ /*
  396. X+ 
  397. X+ To avoid locking in an isolated room, check all 49 cells centered on
  398. X+ this cell, the hard way: no loop, no direct index to the cells. Goal
  399. X+ is to be able to run a street on all four sides of the 3x3 cell array
  400. X+ centered at this cell. 
  401. X+ 
  402. X+ First verify cell and immediate neighbors two out all have all their
  403. X+ neighbors; if not, we're too close to a border. 
  404. X+ 
  405. X+   if (interiorcell(chosencell) != (1==1)) return((1==1));
  406. X+ 
  407. X+   if (interiorcell(nhbris(chosencell,0)) != (1==1)) return((1==1));
  408. X+ 
  409. X+   if (interiorcell(nhbris(nhbris(chosencell,0),0)) != (1==1)) return((1==1));
  410. X+ 
  411. X+   if (interiorcell(nhbris(chosencell,1)) != (1==1)) return((1==1));
  412. X+ 
  413. X+   if (interiorcell(nhbris(nhbris(chosencell,1),1)) != (1==1)) return((1==1));
  414. X+ 
  415. X+   if (interiorcell(nhbris(chosencell,2)) != (1==1)) return((1==1));
  416. X+ 
  417. X+   if (interiorcell(nhbris(nhbris(chosencell,2),2)) != (1==1)) return((1==1));
  418. X+ 
  419. X+   if (interiorcell(nhbris(chosencell,3)) != (1==1)) return((1==1));
  420. X+ 
  421. X+   if (interiorcell(nhbris(nhbris(chosencell,3),3)) != (1==1)) return((1==1));
  422. X+ 
  423. X+ /*
  424. X+ ** Now check all 49 cells for ISOLATED status -- yeech!
  425. X+ **
  426. X+ ** Check the chosen cell.
  427. X+ */
  428. X+ 
  429. X+   if (statlist[chosencell].status != ISOLATED)  return((1==1));
  430. X+ /*
  431. X+ ** Check to the north/up.
  432. X+ */
  433. X+ 
  434. X+   if (statlist[nhbris(chosencell,0)].status != ISOLATED) return((1==1));
  435. X+ 
  436. X+   if (statlist[nhbris(nhbris(chosencell,0),0)].status != ISOLATED)
  437. X+     return((1==1));
  438. X+ 
  439. X+   if (statlist[nhbris(nhbris(nhbris(chosencell,0),0),1)].status != ISOLATED)
  440. X+     return((1==1));
  441. X+ 
  442. X+   if (statlist[nhbris(nhbris(nhbris(chosencell,0),0),3)].status != ISOLATED)
  443. X+     return((1==1));
  444. X+ 
  445. X+   if (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,0),0),3),3)].status
  446. X+       != ISOLATED)
  447. X+      return((1==1));
  448. X+ 
  449. X+   if (statlist[nhbris(nhbris(nhbris(chosencell,0),0),0)].status != ISOLATED)
  450. X+      return((1==1));
  451. X+ 
  452. X+   if (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,0),0),0),1)].status
  453. X+       != ISOLATED)
  454. X+     return((1==1));
  455. X+ 
  456. X+   if (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,0),0),0),1),1)
  457. X+               ].status != ISOLATED)
  458. X+     return((1==1));
  459. X+ 
  460. X+   if (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,0),0),0),3)].status
  461. X+       != ISOLATED)
  462. X+         return((1==1));
  463. X+ 
  464. X+   if (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,0),0),0),3),3)
  465. X+               ].status != ISOLATED)
  466. X+     return((1==1));
  467. X+ 
  468. X+   if (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,0),0),
  469. X+                0),3),3),3)].status != ISOLATED)
  470. X+     return((1==1));
  471. X+ 
  472. X+   if (statlist[nhbris(nhbris(chosencell,0),3)].status != ISOLATED)
  473. X+     return((1==1));
  474. X+ 
  475. X+ /*
  476. X+ ** Check to the east/right.
  477. X+ */
  478. X+ 
  479. X+   if (statlist[nhbris(chosencell,1)].status != ISOLATED) return((1==1));
  480. X+ 
  481. X+   if (statlist[nhbris(nhbris(chosencell,1),0)].status != ISOLATED)
  482. X+     return((1==1));
  483. X+ 
  484. X+   if (statlist[nhbris(nhbris(chosencell,1),1)].status != ISOLATED)
  485. X+     return((1==1));
  486. X+ 
  487. X+   if (statlist[nhbris(nhbris(nhbris(chosencell,1),1),2)].status != ISOLATED)
  488. X+     return((1==1));
  489. X+ 
  490. X+   if (statlist[nhbris(nhbris(nhbris(chosencell,1),1),0)].status != ISOLATED)
  491. X+     return((1==1));
  492. X+ 
  493. X+   if (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,1),1),0),0)].status
  494. X+       != ISOLATED)
  495. X+     return((1==1));
  496. X+ 
  497. X+   if (statlist[nhbris(nhbris(nhbris(chosencell,1),1),1)].status != ISOLATED)
  498. X+     return((1==1));
  499. X+ 
  500. X+   if (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,1),1),1),2)].status
  501. X+       != ISOLATED)
  502. X+     return((1==1));
  503. X+ 
  504. X+   if (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,1),1),1),2),2)
  505. X+               ].status != ISOLATED)
  506. X+     return((1==1));
  507. X+ 
  508. X+   if (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,1),1),1),0)].status
  509. X+       != ISOLATED)
  510. X+     return((1==1));
  511. X+ 
  512. X+   if (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,1),1),1),0),0)
  513. X+               ].status != ISOLATED)
  514. X+     return((1==1));
  515. X+ 
  516. X+   if (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,1),1),
  517. X+                       1),0),0),0)].status != ISOLATED)
  518. X+     return((1==1));
  519. X+ 
  520. X+ /*
  521. X+ ** check to the south/down
  522. X+ */
  523. X+ 
  524. X+   if (statlist[nhbris(chosencell,2)].status != ISOLATED) return((1==1));
  525. X+ 
  526. X+   if (statlist[nhbris(nhbris(chosencell,2),1)].status != ISOLATED)
  527. X+     return((1==1));
  528. X+ 
  529. X+   if (statlist[nhbris(nhbris(chosencell,2),2)].status != ISOLATED)
  530. X+     return((1==1));
  531. X+ 
  532. X+   if (statlist[nhbris(nhbris(nhbris(chosencell,2),2),3)].status != ISOLATED)
  533. X+     return((1==1));
  534. X+ 
  535. X+   if (statlist[nhbris(nhbris(nhbris(chosencell,2),2),1)].status != ISOLATED)
  536. X+     return((1==1));
  537. X+ 
  538. X+   if (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,2),2),1),1)].status
  539. X+       != ISOLATED)
  540. X+     return((1==1));
  541. X+ 
  542. X+   if (statlist[nhbris(nhbris(nhbris(chosencell,2),2),2)].status != ISOLATED)
  543. X+     return((1==1));
  544. X+ 
  545. X+   if (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,2),2),2),3)].status
  546. X+       != ISOLATED)
  547. X+     return((1==1));
  548. X+ 
  549. X+   if (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,2),2),2),3),3)
  550. X+               ].status != ISOLATED)
  551. X+     return((1==1));
  552. X+ 
  553. X+   if (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,2),2),2),1)].status
  554. X+       != ISOLATED)
  555. X+     return((1==1));
  556. X+ 
  557. X+   if (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,2),2),2),1),1)
  558. X+               ].status != ISOLATED)
  559. X+     return((1==1));
  560. X+ 
  561. X+   if (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,2),2),
  562. X+                2),1),1),1)].status != ISOLATED)
  563. X+     return((1==1));
  564. X+ 
  565. X+ /*
  566. X+ ** check to the west/left
  567. X+ */
  568. X+ 
  569. X+   if (statlist[nhbris(chosencell,3)].status != ISOLATED) return((1==1));
  570. X+ 
  571. X+   if (statlist[nhbris(nhbris(chosencell,3),2)].status != ISOLATED)
  572. X+     return((1==1));
  573. X+ 
  574. X+   if (statlist[nhbris(nhbris(chosencell,3),3)].status != ISOLATED)
  575. X+     return((1==1));
  576. X+ 
  577. X+   if (statlist[nhbris(nhbris(nhbris(chosencell,3),3),0)].status != ISOLATED)
  578. X+     return((1==1));
  579. X+ 
  580. X+   if (statlist[nhbris(nhbris(nhbris(chosencell,3),3),2)].status != ISOLATED)
  581. X+     return((1==1));
  582. X+ 
  583. X+   if (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,3),3),2),2)].status
  584. X+       != ISOLATED)
  585. X+     return((1==1));
  586. X+ 
  587. X+   if (statlist[nhbris(nhbris(nhbris(chosencell,3),3),3)].status != ISOLATED)
  588. X+     return((1==1));
  589. X+ 
  590. X+   if (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,3),3),3),0)].status
  591. X+       != ISOLATED)
  592. X+     return((1==1));
  593. X+ 
  594. X+   if (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,3),3),3),0),0)
  595. X+               ].status != ISOLATED)
  596. X+     return((1==1));
  597. X+ 
  598. X+   if (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,3),3),3),2)].status
  599. X+       != ISOLATED)
  600. X+     return((1==1));
  601. X+ 
  602. X+   if (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,3),3),3),2),2)
  603. X+               ].status != ISOLATED)
  604. X+     return((1==1));
  605. X+ 
  606. X+   if (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,3),3),
  607. X+                3),2),2),2)].status != ISOLATED)
  608. X+     return((1==1));
  609. X+ 
  610. X+ /*
  611. X+ ** Found no unisolated cell!  Celebrate the good news.
  612. X+ */
  613. X+     return((1==0));
  614. X+ 
  615. X  }
  616. X*** townmaze.test.old    Fri Apr 19 22:33:09 1991
  617. X--- townmaze.test    Tue Apr 23 09:55:22 1991
  618. X***************
  619. X*** 116,126 ****
  620. X  echo ""
  621. X  echo "Executing 'townmaze -h 11 -w 11 -g 4 -l 4 -c 1'"
  622. X  echo "Expected error: none -- should draw an 11 by 11 maze with 4 open gates"
  623. X! echo "but no courtyard because the gates get in the way"
  624. X  townmaze -h 11 -w 11 -g 4 -l 4 -c 1 
  625. X  echo "Executing 'townmaze -h 11 -w 11 -g 0 -l 0 -c 1'"
  626. X! echo "Expected error: none -- should draw an 11 by 11 maze with no gates"
  627. X! echo "but one courtyard (which should mean no center room"
  628. X  townmaze -h 11 -w 11 -g 0 -l 0 -c 1 
  629. X  echo ""
  630. X  echo "Executing 'townmaze -h 11 -w 11 -g 4 -l 4 -c 1 junk trash'"
  631. X--- 116,126 ----
  632. X  echo ""
  633. X  echo "Executing 'townmaze -h 11 -w 11 -g 4 -l 4 -c 1'"
  634. X  echo "Expected error: none -- should draw an 11 by 11 maze with 4 open gates"
  635. X! echo "but no courtyard (so a busier center) because the gates get in the way"
  636. X  townmaze -h 11 -w 11 -g 4 -l 4 -c 1 
  637. X  echo "Executing 'townmaze -h 11 -w 11 -g 0 -l 0 -c 1'"
  638. X! echo "Expected error: none -- should draw an 11 by 11 maze with no gates but"
  639. X! echo "one courtyard opening the center (which usually means no center room)"
  640. X  townmaze -h 11 -w 11 -g 0 -l 0 -c 1 
  641. X  echo ""
  642. X  echo "Executing 'townmaze -h 11 -w 11 -g 4 -l 4 -c 1 junk trash'"
  643. X*** townpgmr.doc.old    Sat Apr 20 00:16:48 1991
  644. X--- townpgmr.doc    Tue Apr 23 07:48:16 1991
  645. X***************
  646. X*** 693,709 ****
  647. X  cell choice to try, and a bump of tries to check each round against
  648. X  MAXTRIES. 
  649. X  
  650. X! The scary looking part is the 59 guard conditions on those two
  651. X! statements, perhaps some minor record.  Dijkstra would be proud. There
  652. X! is really a lot less than meets the eye.  First, the tries against
  653. X! MAXTRIES test is done.  Next, enough interiorcell() checks are done to
  654. X! assure that all 49 cells exist, each check depending on some one
  655. X! before for the existance of the next cell to check.  Last, all 49
  656. X  cells are checked to be ISOLATED cells. The thing that makes it look
  657. X  messy is that the nbhris() method of finding a neighbor is used rather
  658. X  than defining several extra functions to accomplish the same thing
  659. X! with fewer lines of code.  Again, mainly defended by this being a low
  660. X! cpu cost part of the code. 
  661. X  
  662. X  -----------------------------------------------------------------------
  663. X  | movefromto.c -- movefromto(&fromlist,&fromcount,&tolist,&tocount,
  664. X--- 693,715 ----
  665. X  cell choice to try, and a bump of tries to check each round against
  666. X  MAXTRIES. 
  667. X  
  668. X! What was a set of guard conditions for the do{}while is now a separate
  669. X! routine, to allow smaller compilers to compile the code.
  670. X! 
  671. X! The new routine wimpy_cc() does 59 guard conditions for the do{}while,
  672. X! perhaps some minor record.  Dijkstra would be proud. There is really a
  673. X! lot less than meets the eye.  First, the tries against MAXTRIES test
  674. X! is done in the do{}while condition.
  675. X! 
  676. X! Next, wimpy_cc() is called.  There, enough interiorcell() checks are
  677. X! done to assure that all 49 cells exist, each check depending on some
  678. X! one before for the existance of the next cell to check.  Last, all 49
  679. X  cells are checked to be ISOLATED cells. The thing that makes it look
  680. X  messy is that the nbhris() method of finding a neighbor is used rather
  681. X  than defining several extra functions to accomplish the same thing
  682. X! with fewer lines of code.
  683. X! 
  684. X! Again, mainly defended by this being a low cpu cost part of the code. 
  685. X  
  686. X  -----------------------------------------------------------------------
  687. X  | movefromto.c -- movefromto(&fromlist,&fromcount,&tolist,&tocount,
  688. END_OF_FILE
  689. if test 22788 -ne `wc -c <'patch02'`; then
  690.     echo shar: \"'patch02'\" unpacked with wrong size!
  691. fi
  692. # end of 'patch02'
  693. fi
  694. echo shar: End of archive 1 \(of 1\).
  695. cp /dev/null ark1isdone
  696. MISSING=""
  697. for I in 1 ; do
  698.     if test ! -f ark${I}isdone ; then
  699.     MISSING="${MISSING} ${I}"
  700.     fi
  701. done
  702. if test "${MISSING}" = "" ; then
  703.     echo You have the archive.
  704.     rm -f ark[1-9]isdone
  705. else
  706.     echo You still need to unpack the following archives:
  707.     echo "        " ${MISSING}
  708. fi
  709. ##  End of shell archive.
  710. exit 0
  711.