home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
view JSON data
|
view as text
This file was processed as: SHell self-extracting ARchive
(archive/shar).
You can browse this item here: 3202
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| Newsgroup Content (archive/news)
| magic
| Supported |
100%
| dexvert
| SHell self-extracting ARchive (archive/shar)
| magic
| Supported |
100%
| dexvert
| Internet Message Format (text/imf)
| magic
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| news or mail, ASCII text
| default
| |
100%
| TrID
| E-Mail message (Var. 2)
| default
| |
100%
| checkBytes
| Printable ASCII
| default
| |
100%
| perlTextCheck
| Likely Text (Perl)
| default
| |
100%
| siegfried
| fmt/329 Shell Archive Format
| default
| |
100%
| detectItEasy
| Format: plain text[LF]
| default (weak)
| |
100%
| xdgMime
| message/rfc822
| default
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 46 72 6f 6d 3a 20 78 61 | 6e 74 68 69 61 6e 40 7a |From: xa|nthian@z|
|00000010| 6f 72 63 68 2e 53 46 2d | 42 61 79 2e 4f 52 47 20 |orch.SF-|Bay.ORG |
|00000020| 28 4b 65 6e 74 20 50 61 | 75 6c 20 44 6f 6c 61 6e |(Kent Pa|ul Dolan|
|00000030| 29 0a 4e 65 77 73 67 72 | 6f 75 70 73 3a 20 72 65 |).Newsgr|oups: re|
|00000040| 63 2e 67 61 6d 65 73 2e | 70 72 6f 67 72 61 6d 6d |c.games.|programm|
|00000050| 65 72 2c 61 6c 74 2e 73 | 6f 75 72 63 65 73 2c 61 |er,alt.s|ources,a|
|00000060| 6c 74 2e 73 6f 75 72 63 | 65 73 2e 61 6d 69 67 61 |lt.sourc|es.amiga|
|00000070| 0a 53 75 62 6a 65 63 74 | 3a 20 74 6f 77 6e 6d 61 |.Subject|: townma|
|00000080| 7a 65 20 70 61 72 74 20 | 30 34 2f 30 34 0a 4d 65 |ze part |04/04.Me|
|00000090| 73 73 61 67 65 2d 49 44 | 3a 20 3c 31 39 39 31 41 |ssage-ID|: <1991A|
|000000a0| 70 72 31 38 2e 30 33 35 | 32 33 38 2e 37 35 37 35 |pr18.035|238.7575|
|000000b0| 40 7a 6f 72 63 68 2e 53 | 46 2d 42 61 79 2e 4f 52 |@zorch.S|F-Bay.OR|
|000000c0| 47 3e 0a 44 61 74 65 3a | 20 31 38 20 41 70 72 20 |G>.Date:| 18 Apr |
|000000d0| 39 31 20 30 33 3a 35 32 | 3a 33 38 20 47 4d 54 0a |91 03:52|:38 GMT.|
|000000e0| 0a 0a 41 72 63 68 69 76 | 65 2d 6e 61 6d 65 3a 20 |..Archiv|e-name: |
|000000f0| 74 6f 77 6e 6d 61 7a 65 | 2f 70 61 72 74 30 34 0a |townmaze|/part04.|
|00000100| 0a 23 21 20 2f 62 69 6e | 2f 73 68 0a 23 20 54 68 |.#! /bin|/sh.# Th|
|00000110| 69 73 20 69 73 20 61 20 | 73 68 65 6c 6c 20 61 72 |is is a |shell ar|
|00000120| 63 68 69 76 65 2e 20 20 | 52 65 6d 6f 76 65 20 61 |chive. |Remove a|
|00000130| 6e 79 74 68 69 6e 67 20 | 62 65 66 6f 72 65 20 74 |nything |before t|
|00000140| 68 69 73 20 6c 69 6e 65 | 2c 20 74 68 65 6e 20 75 |his line|, then u|
|00000150| 6e 70 61 63 6b 0a 23 20 | 69 74 20 62 79 20 73 61 |npack.# |it by sa|
|00000160| 76 69 6e 67 20 69 74 20 | 69 6e 74 6f 20 61 20 66 |ving it |into a f|
|00000170| 69 6c 65 20 61 6e 64 20 | 74 79 70 69 6e 67 20 22 |ile and |typing "|
|00000180| 73 68 20 66 69 6c 65 22 | 2e 20 20 54 6f 20 6f 76 |sh file"|. To ov|
|00000190| 65 72 77 72 69 74 65 20 | 65 78 69 73 74 69 6e 67 |erwrite |existing|
|000001a0| 0a 23 20 66 69 6c 65 73 | 2c 20 74 79 70 65 20 22 |.# files|, type "|
|000001b0| 73 68 20 66 69 6c 65 20 | 2d 63 22 2e 20 20 59 6f |sh file |-c". Yo|
|000001c0| 75 20 63 61 6e 20 61 6c | 73 6f 20 66 65 65 64 20 |u can al|so feed |
|000001d0| 74 68 69 73 20 61 73 20 | 73 74 61 6e 64 61 72 64 |this as |standard|
|000001e0| 20 69 6e 70 75 74 20 76 | 69 61 0a 23 20 75 6e 73 | input v|ia.# uns|
|000001f0| 68 61 72 2c 20 6f 72 20 | 62 79 20 74 79 70 69 6e |har, or |by typin|
|00000200| 67 20 22 73 68 20 3c 66 | 69 6c 65 22 2c 20 65 2e |g "sh <f|ile", e.|
|00000210| 67 2e 2e 20 20 49 66 20 | 74 68 69 73 20 61 72 63 |g.. If |this arc|
|00000220| 68 69 76 65 20 69 73 20 | 63 6f 6d 70 6c 65 74 65 |hive is |complete|
|00000230| 2c 20 79 6f 75 0a 23 20 | 77 69 6c 6c 20 73 65 65 |, you.# |will see|
|00000240| 20 74 68 65 20 66 6f 6c | 6c 6f 77 69 6e 67 20 6d | the fol|lowing m|
|00000250| 65 73 73 61 67 65 20 61 | 74 20 74 68 65 20 65 6e |essage a|t the en|
|00000260| 64 3a 0a 23 09 09 22 45 | 6e 64 20 6f 66 20 61 72 |d:.#.."E|nd of ar|
|00000270| 63 68 69 76 65 20 34 20 | 28 6f 66 20 34 29 2e 22 |chive 4 |(of 4)."|
|00000280| 0a 23 20 43 6f 6e 74 65 | 6e 74 73 3a 20 20 74 6f |.# Conte|nts: to|
|00000290| 77 6e 70 67 6d 72 2e 64 | 6f 63 0a 23 20 57 72 61 |wnpgmr.d|oc.# Wra|
|000002a0| 70 70 65 64 20 62 79 20 | 78 61 6e 74 68 69 61 6e |pped by |xanthian|
|000002b0| 40 7a 6f 72 63 68 20 6f | 6e 20 57 65 64 20 41 70 |@zorch o|n Wed Ap|
|000002c0| 72 20 31 37 20 32 30 3a | 33 34 3a 34 31 20 31 39 |r 17 20:|34:41 19|
|000002d0| 39 31 0a 50 41 54 48 3d | 2f 62 69 6e 3a 2f 75 73 |91.PATH=|/bin:/us|
|000002e0| 72 2f 62 69 6e 3a 2f 75 | 73 72 2f 75 63 62 20 3b |r/bin:/u|sr/ucb ;|
|000002f0| 20 65 78 70 6f 72 74 20 | 50 41 54 48 0a 69 66 20 | export |PATH.if |
|00000300| 74 65 73 74 20 2d 66 20 | 27 74 6f 77 6e 70 67 6d |test -f |'townpgm|
|00000310| 72 2e 64 6f 63 27 20 2d | 61 20 22 24 7b 31 7d 22 |r.doc' -|a "${1}"|
|00000320| 20 21 3d 20 22 2d 63 22 | 20 3b 20 74 68 65 6e 20 | != "-c"| ; then |
|00000330| 0a 20 20 65 63 68 6f 20 | 73 68 61 72 3a 20 57 69 |. echo |shar: Wi|
|00000340| 6c 6c 20 6e 6f 74 20 63 | 6c 6f 62 62 65 72 20 65 |ll not c|lobber e|
|00000350| 78 69 73 74 69 6e 67 20 | 66 69 6c 65 20 5c 22 27 |xisting |file \"'|
|00000360| 74 6f 77 6e 70 67 6d 72 | 2e 64 6f 63 27 5c 22 0a |townpgmr|.doc'\".|
|00000370| 65 6c 73 65 0a 65 63 68 | 6f 20 73 68 61 72 3a 20 |else.ech|o shar: |
|00000380| 45 78 74 72 61 63 74 69 | 6e 67 20 5c 22 27 74 6f |Extracti|ng \"'to|
|00000390| 77 6e 70 67 6d 72 2e 64 | 6f 63 27 5c 22 20 5c 28 |wnpgmr.d|oc'\" \(|
|000003a0| 33 39 31 35 31 20 63 68 | 61 72 61 63 74 65 72 73 |39151 ch|aracters|
|000003b0| 5c 29 0a 73 65 64 20 22 | 73 2f 5e 58 2f 2f 22 20 |\).sed "|s/^X//" |
|000003c0| 3e 27 74 6f 77 6e 70 67 | 6d 72 2e 64 6f 63 27 20 |>'townpg|mr.doc' |
|000003d0| 3c 3c 27 45 4e 44 5f 4f | 46 5f 46 49 4c 45 27 0a |<<'END_O|F_FILE'.|
|000003e0| 58 46 69 6c 65 20 74 6f | 77 6e 70 67 6d 72 2e 64 |XFile to|wnpgmr.d|
|000003f0| 6f 63 2c 20 74 68 65 20 | 70 72 6f 67 72 61 6d 6d |oc, the |programm|
|00000400| 65 72 73 27 20 64 6f 63 | 75 6d 65 6e 74 61 74 69 |ers' doc|umentati|
|00000410| 6f 6e 20 66 6f 72 20 74 | 6f 77 6e 6d 61 7a 65 2e |on for t|ownmaze.|
|00000420| 0a 58 0a 58 0a 58 54 68 | 69 73 20 66 69 6c 65 20 |.X.X.XTh|is file |
|00000430| 64 6f 63 75 6d 65 6e 74 | 73 20 74 68 65 20 43 20 |document|s the C |
|00000440| 63 6f 64 65 3b 20 73 65 | 65 20 66 69 6c 65 20 52 |code; se|e file R|
|00000450| 45 41 44 4d 45 20 66 6f | 72 20 63 6f 6d 70 69 6c |EADME fo|r compil|
|00000460| 65 20 61 6e 64 0a 58 65 | 78 65 63 75 74 65 20 69 |e and.Xe|xecute i|
|00000470| 6e 73 74 72 75 63 74 69 | 6f 6e 73 2c 20 63 6f 70 |nstructi|ons, cop|
|00000480| 79 72 69 67 68 74 20 72 | 65 73 74 72 69 63 74 69 |yright r|estricti|
|00000490| 6f 6e 73 2c 20 65 74 63 | 2e 0a 58 0a 58 53 69 6e |ons, etc|..X.XSin|
|000004a0| 63 65 20 74 6f 77 6e 6d | 61 7a 65 20 69 73 20 6d |ce townm|aze is m|
|000004b0| 65 61 6e 74 20 74 6f 20 | 62 65 20 61 20 73 65 74 |eant to |be a set|
|000004c0| 20 6f 66 20 73 6f 66 74 | 77 61 72 65 20 66 6f 72 | of soft|ware for|
|000004d0| 20 75 73 65 20 62 79 20 | 70 72 6f 67 72 61 6d 6d | use by |programm|
|000004e0| 65 72 73 2c 0a 58 74 68 | 65 72 65 20 69 73 20 67 |ers,.Xth|ere is g|
|000004f0| 6f 69 6e 67 20 74 6f 20 | 62 65 20 61 20 5f 6c 6f |oing to |be a _lo|
|00000500| 74 5f 20 6f 66 20 70 72 | 6f 67 72 61 6d 6d 65 72 |t_ of pr|ogrammer|
|00000510| 20 64 6f 63 75 6d 65 6e | 74 61 74 69 6f 6e 2e 20 | documen|tation. |
|00000520| 20 45 61 63 68 20 6f 66 | 20 74 68 65 0a 58 66 6f | Each of| the.Xfo|
|00000530| 6c 6c 6f 77 69 6e 67 20 | 73 6f 75 72 63 65 20 63 |llowing |source c|
|00000540| 6f 64 65 20 66 69 6c 65 | 73 20 77 69 6c 6c 20 62 |ode file|s will b|
|00000550| 65 20 73 65 70 61 72 61 | 74 65 6c 79 20 64 65 73 |e separa|tely des|
|00000560| 63 72 69 62 65 64 2e 0a | 58 0a 58 20 74 6f 77 6e |cribed..|X.X town|
|00000570| 6d 61 7a 65 2e 68 20 20 | 20 20 20 20 20 74 6f 77 |maze.h | tow|
|00000580| 6e 70 72 6f 74 6f 2e 68 | 0a 58 0a 58 20 63 6c 65 |nproto.h|.X.X cle|
|00000590| 61 6e 75 70 6d 61 70 2e | 63 20 20 20 20 20 63 6c |anupmap.|c cl|
|000005a0| 6f 73 65 64 6f 6f 72 73 | 2e 63 20 20 20 20 20 20 |osedoors|.c |
|000005b0| 20 63 6c 6f 73 65 67 61 | 74 65 73 2e 63 20 20 20 | closega|tes.c |
|000005c0| 20 20 20 20 63 6f 6e 6e | 65 63 74 73 74 2e 63 0a | conn|ectst.c.|
|000005d0| 58 20 66 69 6c 6c 6c 69 | 73 74 2e 63 20 20 20 20 |X fillli|st.c |
|000005e0| 20 20 20 66 69 6c 6c 6d | 61 7a 65 2e 63 20 20 20 | fillm|aze.c |
|000005f0| 20 20 20 20 20 20 66 69 | 6e 69 73 68 61 6c 6c 65 | fi|nishalle|
|00000600| 79 73 2e 63 20 20 20 20 | 20 66 72 65 65 73 70 61 |ys.c | freespa|
|00000610| 63 65 2e 63 0a 58 20 67 | 65 74 61 72 67 73 2e 63 |ce.c.X g|etargs.c|
|00000620| 20 20 20 20 20 20 20 20 | 69 6e 74 65 72 69 6f 72 | |interior|
|00000630| 63 65 6c 6c 2e 63 20 20 | 20 20 20 6d 61 6b 65 63 |cell.c | makec|
|00000640| 6f 75 72 74 73 2e 63 20 | 20 20 20 20 20 20 6d 61 |ourts.c | ma|
|00000650| 6b 65 67 61 74 65 73 2e | 63 0a 58 20 6d 61 6b 65 |kegates.|c.X make|
|00000660| 73 74 72 65 65 74 2e 63 | 20 20 20 20 20 6d 61 6b |street.c| mak|
|00000670| 65 73 70 61 63 65 2e 63 | 20 20 20 20 20 20 20 20 |espace.c| |
|00000680| 6d 61 6b 65 75 6e 75 73 | 65 64 2e 63 20 20 20 20 |makeunus|ed.c |
|00000690| 20 20 20 6d 6f 76 65 66 | 72 6f 6d 74 6f 2e 63 0a | movef|romto.c.|
|000006a0| 58 20 6e 68 62 72 65 78 | 69 73 74 73 2e 63 20 20 |X nhbrex|ists.c |
|000006b0| 20 20 20 6e 68 62 72 69 | 73 2e 63 20 20 20 20 20 | nhbri|s.c |
|000006c0| 20 20 20 20 20 20 73 68 | 6f 77 64 62 6d 61 7a 65 | sh|owdbmaze|
|000006d0| 2e 63 20 20 20 20 20 20 | 20 73 68 6f 77 6c 69 73 |.c | showlis|
|000006e0| 74 64 65 74 2e 63 0a 58 | 20 73 68 6f 77 6c 69 73 |tdet.c.X| showlis|
|000006f0| 74 73 75 6d 2e 63 20 20 | 20 20 73 68 6f 77 6d 61 |tsum.c | showma|
|00000700| 7a 65 2e 63 20 20 20 20 | 20 20 20 20 20 74 6f 77 |ze.c | tow|
|00000710| 6e 6d 61 69 6e 2e 63 20 | 20 20 20 20 20 20 20 20 |nmain.c | |
|00000720| 75 73 61 67 65 2e 63 0a | 58 0a 58 42 75 74 20 66 |usage.c.|X.XBut f|
|00000730| 69 72 73 74 2c 20 61 6e | 20 6f 76 65 72 76 69 65 |irst, an| overvie|
|00000740| 77 2e 0a 58 0a 58 54 6f | 77 6e 6d 61 7a 65 20 77 |w..X.XTo|wnmaze w|
|00000750| 6f 72 6b 73 20 63 6f 6e | 63 65 70 74 75 61 6c 6c |orks con|ceptuall|
|00000760| 79 20 6f 6e 20 61 20 73 | 74 72 75 63 74 75 72 65 |y on a s|tructure|
|00000770| 20 6f 66 20 6d 61 7a 65 | 20 63 65 6c 6c 73 20 69 | of maze| cells i|
|00000780| 6e 20 61 0a 58 66 6f 75 | 72 2d 63 6f 6e 6e 65 63 |n a.Xfou|r-connec|
|00000790| 74 65 64 20 28 65 61 63 | 68 20 63 65 6c 6c 20 68 |ted (eac|h cell h|
|000007a0| 61 73 20 66 6f 75 72 20 | 6e 65 69 67 68 62 6f 72 |as four |neighbor|
|000007b0| 73 29 20 67 72 69 64 20 | 77 69 74 68 20 6f 6e 65 |s) grid |with one|
|000007c0| 20 6f 66 20 66 69 76 65 | 0a 58 73 74 61 74 75 73 | of five|.Xstatus|
|000007d0| 65 73 3a 0a 58 0a 58 49 | 53 4f 4c 41 54 45 44 20 |es:.X.XI|SOLATED |
|000007e0| 2d 20 6e 6f 20 6e 65 69 | 67 68 62 6f 72 20 6f 66 |- no nei|ghbor of|
|000007f0| 20 74 68 69 73 20 63 65 | 6c 6c 20 69 73 20 61 20 | this ce|ll is a |
|00000800| 73 74 72 65 65 74 2e 0a | 58 0a 58 4c 49 56 45 20 |street..|X.XLIVE |
|00000810| 2d 20 73 6f 6d 65 20 6e | 65 69 67 68 62 6f 72 20 |- some n|eighbor |
|00000820| 6f 66 20 74 68 69 73 20 | 63 65 6c 6c 20 69 73 20 |of this |cell is |
|00000830| 61 20 73 74 72 65 65 74 | 2c 20 61 6e 64 20 73 6f |a street|, and so|
|00000840| 6d 65 20 6e 65 69 67 68 | 62 6f 72 20 6f 66 0a 58 |me neigh|bor of.X|
|00000850| 74 68 69 73 20 63 65 6c | 6c 20 69 73 20 61 6e 20 |this cel|l is an |
|00000860| 69 73 6f 6c 61 74 65 64 | 20 63 65 6c 6c 2e 20 0a |isolated| cell. .|
|00000870| 58 0a 58 44 45 41 44 20 | 2d 20 73 6f 6d 65 20 6e |X.XDEAD |- some n|
|00000880| 65 69 67 68 62 6f 72 20 | 6f 66 20 74 68 69 73 20 |eighbor |of this |
|00000890| 63 65 6c 6c 20 69 73 20 | 61 20 73 74 72 65 65 74 |cell is |a street|
|000008a0| 2c 20 62 75 74 20 6e 6f | 20 6e 65 69 67 68 62 6f |, but no| neighbo|
|000008b0| 72 20 6f 66 20 74 68 69 | 73 0a 58 63 65 6c 6c 20 |r of thi|s.Xcell |
|000008c0| 69 73 20 61 6e 20 69 73 | 6f 6c 61 74 65 64 20 63 |is an is|olated c|
|000008d0| 65 6c 6c 2e 20 0a 58 0a | 58 53 54 52 45 45 54 20 |ell. .X.|XSTREET |
|000008e0| 2d 20 74 68 65 20 70 61 | 73 73 61 67 65 77 61 79 |- the pa|ssageway|
|000008f0| 73 20 66 6f 72 20 74 68 | 65 20 61 64 76 65 6e 74 |s for th|e advent|
|00000900| 75 72 65 72 73 3b 20 74 | 68 69 73 20 63 65 6c 6c |urers; t|his cell|
|00000910| 20 69 73 20 63 6f 6e 6e | 65 63 74 65 64 0a 58 62 | is conn|ected.Xb|
|00000920| 79 20 61 20 73 65 72 69 | 65 73 20 6f 66 20 6f 74 |y a seri|es of ot|
|00000930| 68 65 72 20 73 74 72 65 | 65 74 20 63 65 6c 6c 73 |her stre|et cells|
|00000940| 20 74 6f 20 73 6f 6d 65 | 20 6f 72 69 67 69 6e 20 | to some| origin |
|00000950| 70 6f 69 6e 74 20 66 6f | 72 20 61 20 73 74 72 65 |point fo|r a stre|
|00000960| 65 74 2e 20 0a 58 0a 58 | 55 4e 55 53 45 44 20 2d |et. .X.X|UNUSED -|
|00000970| 20 74 68 69 73 20 63 65 | 6c 6c 20 69 73 20 73 6f | this ce|ll is so|
|00000980| 6c 69 64 20 72 6f 63 6b | 2c 20 69 74 20 6d 61 79 |lid rock|, it may|
|00000990| 20 6e 65 69 74 68 65 72 | 20 62 65 63 6f 6d 65 20 | neither| become |
|000009a0| 61 20 72 6f 6f 6d 20 6e | 6f 72 20 61 0a 58 73 74 |a room n|or a.Xst|
|000009b0| 72 65 65 74 2c 20 6e 6f | 72 20 68 61 76 65 20 61 |reet, no|r have a|
|000009c0| 20 73 74 72 65 65 74 20 | 63 65 6c 6c 20 61 73 20 | street |cell as |
|000009d0| 61 20 6e 65 69 67 68 62 | 6f 72 2e 20 0a 58 0a 58 |a neighb|or. .X.X|
|000009e0| 54 68 65 20 67 6f 61 6c | 20 69 73 20 74 6f 20 62 |The goal| is to b|
|000009f0| 75 69 6c 64 20 61 20 74 | 6f 77 6e 20 6d 61 7a 65 |uild a t|own maze|
|00000a00| 20 6c 69 6b 65 20 74 68 | 65 20 75 70 70 65 72 20 | like th|e upper |
|00000a10| 6c 65 76 65 6c 20 6f 66 | 20 42 61 72 64 27 73 20 |level of| Bard's |
|00000a20| 54 61 6c 65 20 49 2c 0a | 58 77 69 74 68 20 61 20 |Tale I,.|Xwith a |
|00000a30| 73 74 72 65 65 74 20 74 | 6f 20 65 76 65 72 79 20 |street t|o every |
|00000a40| 64 6f 6f 72 2c 20 61 6e | 64 20 61 20 66 61 69 72 |door, an|d a fair|
|00000a50| 6c 79 20 22 64 6f 75 62 | 6c 65 20 72 6f 77 20 6f |ly "doub|le row o|
|00000a60| 66 20 62 72 6f 77 6e 73 | 74 6f 6e 65 73 22 20 0a |f browns|tones" .|
|00000a70| 58 61 70 70 65 61 72 61 | 6e 63 65 2c 20 62 79 20 |Xappeara|nce, by |
|00000a80| 6c 6f 6f 6b 69 6e 67 20 | 74 77 6f 20 6e 65 69 67 |looking |two neig|
|00000a90| 68 62 6f 72 20 6c 69 6e | 6b 73 20 61 77 61 79 2c |hbor lin|ks away,|
|00000aa0| 20 74 6f 20 70 72 65 73 | 65 72 76 65 20 77 68 65 | to pres|erve whe|
|00000ab0| 72 65 0a 58 70 6f 73 73 | 69 62 6c 65 20 72 6f 6f |re.Xposs|ible roo|
|00000ac0| 6d 20 63 65 6c 6c 73 20 | 69 6e 20 62 61 63 6b 20 |m cells |in back |
|00000ad0| 74 6f 20 62 61 63 6b 20 | 72 6f 77 73 2e 0a 58 0a |to back |rows..X.|
|00000ae0| 58 54 6f 20 61 63 63 6f | 6d 70 6c 69 73 68 20 74 |XTo acco|mplish t|
|00000af0| 68 69 73 2c 20 4c 49 56 | 45 20 63 65 6c 6c 73 20 |his, LIV|E cells |
|00000b00| 61 72 65 20 75 73 65 64 | 20 74 6f 20 69 6e 64 69 |are used| to indi|
|00000b10| 63 61 74 65 20 77 68 65 | 6e 20 61 74 20 6c 65 61 |cate whe|n at lea|
|00000b20| 73 74 20 6f 6e 65 0a 58 | 64 69 72 65 63 74 69 6f |st one.X|directio|
|00000b30| 6e 20 66 72 6f 6d 20 74 | 68 65 20 6c 69 76 65 20 |n from t|he live |
|00000b40| 63 65 6c 6c 2c 20 74 68 | 65 20 6e 65 78 74 20 73 |cell, th|e next s|
|00000b50| 74 72 65 65 74 20 69 73 | 20 73 65 70 61 72 61 74 |treet is| separat|
|00000b60| 65 64 20 62 79 20 61 6e | 0a 58 49 53 4f 4c 41 54 |ed by an|.XISOLAT|
|00000b70| 45 44 20 63 65 6c 6c 20 | 61 6e 64 20 73 6f 6d 65 |ED cell |and some|
|00000b80| 20 6f 74 68 65 72 20 6e | 6f 6e 2d 53 54 52 45 45 | other n|on-STREE|
|00000b90| 54 20 63 65 6c 6c 20 6f | 6e 20 74 68 65 20 66 61 |T cell o|n the fa|
|00000ba0| 72 20 73 69 64 65 2e 20 | 20 54 68 69 73 0a 58 77 |r side. | This.Xw|
|00000bb0| 6f 72 6b 73 20 66 61 69 | 72 6c 79 20 77 65 6c 6c |orks fai|rly well|
|00000bc0| 20 77 68 65 6e 20 74 68 | 65 20 73 74 72 65 65 74 | when th|e street|
|00000bd0| 73 20 72 75 6e 20 76 65 | 72 79 20 70 61 72 61 6c |s run ve|ry paral|
|00000be0| 6c 65 6c 2c 20 6e 6f 74 | 20 73 6f 20 77 65 6c 6c |lel, not| so well|
|00000bf0| 20 77 68 65 6e 0a 58 74 | 68 65 79 20 64 6f 6e 27 | when.Xt|hey don'|
|00000c00| 74 2e 20 20 42 65 74 74 | 65 72 20 73 74 72 61 74 |t. Bett|er strat|
|00000c10| 65 67 69 65 73 20 6d 61 | 79 20 77 65 6c 6c 20 65 |egies ma|y well e|
|00000c20| 78 69 73 74 2c 20 62 75 | 74 20 74 68 69 73 20 6f |xist, bu|t this o|
|00000c30| 6e 65 20 64 6f 65 73 20 | 76 65 72 79 0a 58 6e 69 |ne does |very.Xni|
|00000c40| 63 65 20 6d 61 7a 65 73 | 20 66 6f 72 20 73 6f 6d |ce mazes| for som|
|00000c50| 65 20 70 61 72 61 6d 65 | 74 65 72 20 76 61 6c 75 |e parame|ter valu|
|00000c60| 65 73 2e 20 0a 58 0a 58 | 54 68 65 20 62 61 73 69 |es. .X.X|The basi|
|00000c70| 63 20 70 6c 61 6e 20 6f | 66 20 74 6f 77 6e 6d 61 |c plan o|f townma|
|00000c80| 7a 65 20 69 73 20 74 6f | 0a 58 0a 58 31 29 20 41 |ze is to|.X.X1) A|
|00000c90| 63 63 65 70 74 20 61 20 | 73 65 74 20 6f 66 20 63 |ccept a |set of c|
|00000ca0| 6f 6d 6d 61 6e 64 20 6c | 69 6e 65 20 70 61 72 61 |ommand l|ine para|
|00000cb0| 6d 65 74 65 72 73 2e 0a | 58 0a 58 32 29 20 41 6c |meters..|X.X2) Al|
|00000cc0| 6c 6f 63 61 74 65 20 74 | 77 6f 20 6d 61 6a 6f 72 |locate t|wo major|
|00000cd0| 20 64 61 74 61 20 73 74 | 72 75 63 74 75 72 65 73 | data st|ructures|
|00000ce0| 20 6f 66 20 74 68 65 20 | 61 70 70 72 6f 70 72 69 | of the |appropri|
|00000cf0| 61 74 65 20 73 69 7a 65 | 20 69 6e 0a 58 61 63 63 |ate size| in.Xacc|
|00000d00| 6f 72 64 61 6e 63 65 20 | 77 69 74 68 20 74 68 6f |ordance |with tho|
|00000d10| 73 65 20 70 61 72 61 6d | 65 74 65 72 73 2c 20 6f |se param|eters, o|
|00000d20| 6e 65 20 61 20 74 77 6f | 20 64 69 6d 65 6e 73 69 |ne a two| dimensi|
|00000d30| 6f 6e 61 6c 20 61 72 72 | 61 79 20 6f 66 0a 58 63 |onal arr|ay of.Xc|
|00000d40| 68 61 72 61 63 74 65 72 | 73 20 77 68 69 63 68 20 |haracter|s which |
|00000d50| 77 69 6c 6c 20 62 65 20 | 75 73 65 64 20 74 6f 20 |will be |used to |
|00000d60| 62 75 69 6c 64 20 61 6e | 64 20 64 69 73 70 6c 61 |build an|d displa|
|00000d70| 79 20 74 68 65 20 63 6f | 6d 70 6c 65 74 65 64 20 |y the co|mpleted |
|00000d80| 6d 61 7a 65 2c 0a 58 74 | 68 65 20 6f 74 68 65 72 |maze,.Xt|he other|
|00000d90| 20 61 20 6f 6e 65 20 64 | 69 6d 65 6e 73 69 6f 6e | a one d|imension|
|00000da0| 61 6c 20 61 72 72 61 79 | 20 6f 66 20 73 74 72 75 |al array| of stru|
|00000db0| 63 74 75 72 65 73 20 77 | 68 69 63 68 20 69 73 20 |ctures w|hich is |
|00000dc0| 75 73 65 64 20 61 73 20 | 61 0a 58 73 74 61 74 75 |used as |a.Xstatu|
|00000dd0| 73 20 6c 69 73 74 20 74 | 6f 20 73 74 6f 72 65 20 |s list t|o store |
|00000de0| 74 68 65 20 73 74 61 74 | 75 73 20 6f 66 20 65 61 |the stat|us of ea|
|00000df0| 63 68 20 6d 61 7a 65 20 | 63 65 6c 6c 2c 20 61 6e |ch maze |cell, an|
|00000e00| 64 20 74 6f 20 6c 69 6e | 6b 20 6d 61 7a 65 0a 58 |d to lin|k maze.X|
|00000e10| 63 65 6c 6c 73 20 74 6f | 67 65 74 68 65 72 20 69 |cells to|gether i|
|00000e20| 6e 20 73 75 62 6c 69 73 | 74 73 20 66 6f 72 20 73 |n sublis|ts for s|
|00000e30| 70 65 65 64 20 6f 66 20 | 70 72 6f 63 65 73 73 69 |peed of |processi|
|00000e40| 6e 67 2e 20 0a 58 0a 58 | 33 29 20 46 69 6c 6c 20 |ng. .X.X|3) Fill |
|00000e50| 69 6e 20 74 68 65 20 6d | 61 7a 65 20 61 73 20 61 |in the m|aze as a|
|00000e60| 20 73 6f 6c 69 64 20 61 | 72 72 61 79 20 6f 66 20 | solid a|rray of |
|00000e70| 72 6f 6f 6d 73 20 65 78 | 63 65 70 74 20 74 68 65 |rooms ex|cept the|
|00000e80| 20 63 6f 72 6e 65 72 73 | 2c 0a 58 77 68 69 63 68 | corners|,.Xwhich|
|00000e90| 20 61 72 65 20 62 6c 6f | 63 6b 65 64 20 6f 66 66 | are blo|cked off|
|00000ea0| 20 28 74 68 65 79 27 72 | 65 20 74 6f 6f 20 68 61 | (they'r|e too ha|
|00000eb0| 72 64 20 74 6f 20 75 73 | 65 29 2c 20 65 61 63 68 |rd to us|e), each|
|00000ec0| 20 72 6f 6f 6d 20 77 69 | 74 68 6f 75 74 0a 58 64 | room wi|thout.Xd|
|00000ed0| 6f 6f 72 73 2c 20 61 6e | 64 20 66 69 6c 6c 20 69 |oors, an|d fill i|
|00000ee0| 6e 20 74 68 65 20 73 74 | 61 74 75 73 20 6c 69 73 |n the st|atus lis|
|00000ef0| 74 20 61 6e 64 20 6c 69 | 6e 6b 20 69 74 20 74 6f |t and li|nk it to|
|00000f00| 67 65 74 68 65 72 20 61 | 73 20 61 20 6c 69 73 74 |gether a|s a list|
|00000f10| 20 6f 66 0a 58 49 53 4f | 4c 41 54 45 44 20 63 65 | of.XISO|LATED ce|
|00000f20| 6c 6c 73 2c 20 65 78 63 | 65 70 74 20 61 67 61 69 |lls, exc|ept agai|
|00000f30| 6e 20 66 6f 72 20 74 68 | 65 20 63 6f 72 6e 65 72 |n for th|e corner|
|00000f40| 73 2c 20 77 68 69 63 68 | 20 62 65 63 6f 6d 65 20 |s, which| become |
|00000f50| 55 4e 55 53 45 44 0a 58 | 63 65 6c 6c 73 2e 20 0a |UNUSED.X|cells. .|
|00000f60| 58 0a 58 34 29 20 53 65 | 65 64 20 74 68 65 20 6d |X.X4) Se|ed the m|
|00000f70| 61 7a 65 20 77 69 74 68 | 20 75 6e 69 71 75 65 6c |aze with| uniquel|
|00000f80| 79 20 6e 75 6d 62 65 72 | 65 64 20 73 74 72 65 65 |y number|ed stree|
|00000f90| 74 20 6f 72 69 67 69 6e | 73 20 61 74 20 62 6f 72 |t origin|s at bor|
|00000fa0| 64 65 72 20 6f 72 0a 58 | 69 6e 74 65 72 69 6f 72 |der or.X|interior|
|00000fb0| 20 63 65 6c 6c 73 2c 20 | 61 6e 64 20 6f 62 73 74 | cells, |and obst|
|00000fc0| 61 63 6c 65 73 20 61 74 | 20 69 6e 74 65 72 69 6f |acles at| interio|
|00000fd0| 72 20 63 65 6c 6c 73 20 | 6f 6e 6c 79 2e 20 20 41 |r cells |only. A|
|00000fe0| 73 73 75 72 65 20 74 68 | 61 74 0a 58 64 69 66 66 |ssure th|at.Xdiff|
|00000ff0| 65 72 65 6e 74 20 73 65 | 65 64 20 63 65 6c 6c 73 |erent se|ed cells|
|00001000| 20 61 72 65 20 66 61 72 | 20 65 6e 6f 75 67 68 20 | are far| enough |
|00001010| 61 70 61 72 74 20 74 6f | 20 61 6c 6c 6f 77 20 73 |apart to| allow s|
|00001020| 75 63 63 65 73 73 66 75 | 6c 20 6d 61 7a 65 0a 58 |uccessfu|l maze.X|
|00001030| 63 72 65 61 74 69 6f 6e | 2e 20 20 55 70 64 61 74 |creation|. Updat|
|00001040| 65 20 64 69 73 70 6c 61 | 79 20 74 6f 20 6d 61 74 |e displa|y to mat|
|00001050| 63 68 3b 20 72 6f 6f 6d | 73 20 62 65 73 69 64 65 |ch; room|s beside|
|00001060| 20 73 74 72 65 65 74 73 | 20 67 65 74 20 64 6f 6f | streets| get doo|
|00001070| 72 73 0a 58 66 61 63 69 | 6e 67 20 74 68 65 20 73 |rs.Xfaci|ng the s|
|00001080| 74 72 65 65 74 73 3b 20 | 74 68 65 20 6f 75 74 73 |treets; |the outs|
|00001090| 69 64 65 20 77 61 6c 6c | 20 6e 65 78 74 20 74 6f |ide wall| next to|
|000010a0| 20 61 20 73 74 72 65 65 | 74 20 62 65 63 6f 6d 65 | a stree|t become|
|000010b0| 73 20 61 0a 58 22 67 61 | 74 65 22 2e 0a 58 0a 58 |s a.X"ga|te"..X.X|
|000010c0| 34 61 29 20 53 65 65 64 | 20 61 6e 79 20 55 4e 55 |4a) Seed| any UNU|
|000010d0| 53 45 44 20 63 65 6c 6c | 73 20 69 6e 20 74 68 65 |SED cell|s in the|
|000010e0| 20 69 6e 74 65 72 69 6f | 72 20 6f 66 20 74 68 65 | interio|r of the|
|000010f0| 20 6d 61 7a 65 2e 0a 58 | 0a 58 34 62 29 20 53 65 | maze..X|.X4b) Se|
|00001100| 65 64 20 61 6e 79 20 22 | 67 61 74 65 22 20 53 54 |ed any "|gate" ST|
|00001110| 52 45 45 54 20 63 65 6c | 6c 73 20 61 6c 6f 6e 67 |REET cel|ls along|
|00001120| 20 74 68 65 20 62 6f 72 | 64 65 72 20 6f 66 20 74 | the bor|der of t|
|00001130| 68 65 20 6d 61 7a 65 2e | 0a 58 0a 58 34 63 29 20 |he maze.|.X.X4c) |
|00001140| 53 65 65 64 20 61 6e 79 | 20 22 63 6f 75 72 74 79 |Seed any| "courty|
|00001150| 61 72 64 22 20 53 54 52 | 45 45 54 20 63 65 6c 6c |ard" STR|EET cell|
|00001160| 73 20 69 6e 20 74 68 65 | 20 69 6e 74 65 72 69 6f |s in the| interio|
|00001170| 72 20 6f 66 20 74 68 65 | 20 6d 61 7a 65 2e 0a 58 |r of the| maze..X|
|00001180| 0a 58 35 29 20 43 6f 6e | 6e 65 63 74 20 74 68 65 |.X5) Con|nect the|
|00001190| 20 73 74 72 65 65 74 73 | 20 62 79 20 65 78 74 65 | streets| by exte|
|000011a0| 6e 64 69 6e 67 20 74 68 | 65 6d 20 75 6e 74 69 6c |nding th|em until|
|000011b0| 20 61 6c 6c 20 73 74 72 | 65 65 74 73 20 68 61 76 | all str|eets hav|
|000011c0| 65 20 74 68 65 0a 58 73 | 61 6d 65 20 73 74 72 65 |e the.Xs|ame stre|
|000011d0| 65 74 20 6e 75 6d 62 65 | 72 3b 20 6d 65 72 67 65 |et numbe|r; merge|
|000011e0| 20 73 74 72 65 65 74 20 | 6e 75 6d 62 65 72 73 20 | street |numbers |
|000011f0| 77 68 65 6e 20 74 77 6f | 20 73 74 72 65 65 74 73 |when two| streets|
|00001200| 20 6d 65 65 74 2e 20 20 | 41 67 61 69 6e 0a 58 75 | meet. |Again.Xu|
|00001210| 70 64 61 74 65 20 74 68 | 65 20 64 69 73 70 6c 61 |pdate th|e displa|
|00001220| 79 20 61 72 72 61 79 20 | 74 6f 20 6d 61 74 63 68 |y array |to match|
|00001230| 3b 20 72 6f 6f 6d 73 20 | 61 72 65 20 63 6f 6e 76 |; rooms |are conv|
|00001240| 65 72 74 65 64 20 74 6f | 20 73 74 72 65 65 74 73 |erted to| streets|
|00001250| 20 62 79 0a 58 72 65 6d | 6f 76 69 6e 67 20 61 6c | by.Xrem|oving al|
|00001260| 6c 20 64 6f 6f 72 73 2e | 20 20 52 6f 6f 6d 73 20 |l doors.| Rooms |
|00001270| 6e 65 77 6c 79 20 61 64 | 6a 61 63 65 6e 74 20 74 |newly ad|jacent t|
|00001280| 6f 20 73 74 72 65 65 74 | 73 20 67 61 69 6e 20 61 |o street|s gain a|
|00001290| 20 6e 65 77 20 64 6f 6f | 72 0a 58 6f 6e 20 74 68 | new doo|r.Xon th|
|000012a0| 61 74 20 73 74 72 65 65 | 74 2e 20 0a 58 0a 58 36 |at stree|t. .X.X6|
|000012b0| 29 20 57 68 65 6e 20 61 | 6c 6c 20 73 74 72 65 65 |) When a|ll stree|
|000012c0| 74 73 20 61 72 65 20 63 | 6f 6e 6e 65 63 74 65 64 |ts are c|onnected|
|000012d0| 2c 20 63 6f 6e 74 69 6e | 75 65 20 74 6f 20 65 78 |, contin|ue to ex|
|000012e0| 74 65 6e 64 20 74 68 65 | 6d 20 61 73 20 22 61 6c |tend the|m as "al|
|000012f0| 6c 65 79 73 22 0a 58 75 | 6e 74 69 6c 20 6e 6f 20 |leys".Xu|ntil no |
|00001300| 69 73 6f 6c 61 74 65 64 | 20 72 6f 6f 6d 20 63 65 |isolated| room ce|
|00001310| 6c 6c 73 20 72 65 6d 61 | 69 6e 2e 20 0a 58 0a 58 |lls rema|in. .X.X|
|00001320| 37 29 20 43 6c 6f 73 65 | 20 6d 6f 73 74 20 6f 66 |7) Close| most of|
|00001330| 20 74 68 65 20 64 6f 6f | 72 73 2c 20 6c 65 61 76 | the doo|rs, leav|
|00001340| 69 6e 67 20 6f 6e 65 20 | 6f 70 65 6e 20 64 6f 6f |ing one |open doo|
|00001350| 72 20 70 65 72 20 72 6f | 6f 6d 2c 20 62 79 0a 58 |r per ro|om, by.X|
|00001360| 72 65 70 6c 61 63 69 6e | 67 20 64 6f 6f 72 73 20 |replacin|g doors |
|00001370| 62 79 20 77 61 6c 6c 73 | 2e 0a 58 0a 58 38 29 20 |by walls|..X.X8) |
|00001380| 50 6f 73 73 69 62 6c 79 | 20 63 6c 6f 73 65 20 73 |Possibly| close s|
|00001390| 6f 6d 65 20 6f 72 20 61 | 6c 6c 20 67 61 74 65 73 |ome or a|ll gates|
|000013a0| 20 62 79 20 72 65 70 6c | 61 63 69 6e 67 20 74 68 | by repl|acing th|
|000013b0| 65 6d 20 77 69 74 68 20 | 77 61 6c 6c 73 2e 0a 58 |em with |walls..X|
|000013c0| 0a 58 39 29 20 43 6c 65 | 61 6e 20 75 70 20 22 70 |.X9) Cle|an up "p|
|000013d0| 69 6c 6c 61 72 73 22 3b | 20 62 69 74 73 20 6f 66 |illars";| bits of|
|000013e0| 20 77 61 6c 6c 20 74 68 | 61 74 20 68 61 76 65 20 | wall th|at have |
|000013f0| 62 65 65 6e 20 69 73 6f | 6c 61 74 65 64 20 62 79 |been iso|lated by|
|00001400| 20 62 65 69 6e 67 0a 58 | 73 75 72 72 6f 75 6e 64 | being.X|surround|
|00001410| 65 64 20 62 79 20 73 74 | 72 65 65 74 73 2e 0a 58 |ed by st|reets..X|
|00001420| 0a 58 31 30 29 20 44 69 | 73 70 6c 61 79 20 74 68 |.X10) Di|splay th|
|00001430| 65 20 6d 61 7a 65 2e 0a | 58 0a 58 31 31 29 20 46 |e maze..|X.X11) F|
|00001440| 72 65 65 20 74 68 65 20 | 61 6c 6c 6f 63 61 74 65 |ree the |allocate|
|00001450| 64 20 73 70 61 63 65 2e | 0a 58 0a 58 31 32 29 20 |d space.|.X.X12) |
|00001460| 45 78 69 74 2e 0a 58 0a | 58 44 65 74 61 69 6c 65 |Exit..X.|XDetaile|
|00001470| 64 20 73 6f 75 72 63 65 | 20 6d 6f 64 75 6c 65 20 |d source| module |
|00001480| 64 65 73 63 72 69 70 74 | 69 6f 6e 73 2e 0a 58 0a |descript|ions..X.|
|00001490| 58 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |X-------|--------|
|000014a0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000014b0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000014c0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000014d0| 2d 2d 2d 2d 2d 2d 2d 2d | 0a 58 7c 20 74 6f 77 6e |--------|.X| town|
|000014e0| 6d 61 7a 65 2e 68 20 0a | 58 2d 2d 2d 2d 2d 2d 2d |maze.h .|X-------|
|000014f0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00001500| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00001510| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00001520| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00001530| 0a 58 0a 58 54 68 69 73 | 20 68 65 61 64 65 72 20 |.X.XThis| header |
|00001540| 66 69 6c 65 20 69 73 20 | 77 68 65 72 65 20 61 6c |file is |where al|
|00001550| 6c 20 74 68 65 20 23 69 | 66 64 65 66 20 63 6f 6e |l the #i|fdef con|
|00001560| 74 72 6f 6c 6c 69 6e 67 | 20 23 64 65 66 69 6e 65 |trolling| #define|
|00001570| 73 20 61 72 65 20 64 6f | 6e 65 0a 58 28 65 78 63 |s are do|ne.X(exc|
|00001580| 65 70 74 20 4d 41 49 4e | 4c 49 4e 45 2c 20 69 6e |ept MAIN|LINE, in|
|00001590| 20 74 6f 77 6e 6d 61 69 | 6e 2e 63 2c 20 61 6e 64 | townmai|n.c, and|
|000015a0| 20 52 41 4e 44 34 38 2c | 20 69 6e 20 74 68 65 20 | RAND48,| in the |
|000015b0| 6d 61 6b 65 20 66 69 6c | 65 29 2c 20 74 68 65 0a |make fil|e), the.|
|000015c0| 58 73 74 72 75 63 74 75 | 72 65 73 20 61 72 65 20 |Xstructu|res are |
|000015d0| 64 65 66 69 6e 65 64 2c | 20 74 68 65 20 64 65 66 |defined,| the def|
|000015e0| 69 6e 65 64 20 63 6f 6e | 73 74 61 6e 74 73 20 61 |ined con|stants a|
|000015f0| 72 65 20 64 65 63 6c 61 | 72 65 64 2c 20 61 6e 64 |re decla|red, and|
|00001600| 20 74 68 65 0a 58 65 78 | 74 65 72 6e 61 6c 20 76 | the.Xex|ternal v|
|00001610| 61 72 69 61 62 6c 65 73 | 20 61 72 65 20 64 65 63 |ariables| are dec|
|00001620| 6c 61 72 65 64 20 6f 72 | 20 64 65 66 69 6e 65 64 |lared or| defined|
|00001630| 20 75 6e 64 65 72 20 23 | 69 66 64 65 66 20 63 6f | under #|ifdef co|
|00001640| 6e 74 72 6f 6c 2e 20 0a | 58 0a 58 49 6e 20 70 61 |ntrol. .|X.XIn pa|
|00001650| 72 74 69 63 75 6c 61 72 | 2c 20 74 68 65 20 63 6d |rticular|, the cm|
|00001660| 61 7a 65 20 74 77 6f 20 | 64 69 6d 65 6e 73 69 6f |aze two |dimensio|
|00001670| 6e 61 6c 20 63 68 61 72 | 61 63 74 65 72 20 61 72 |nal char|acter ar|
|00001680| 72 61 79 20 66 6f 72 20 | 6d 61 7a 65 0a 58 64 69 |ray for |maze.Xdi|
|00001690| 73 70 6c 61 79 2c 20 74 | 68 65 20 73 74 61 74 6c |splay, t|he statl|
|000016a0| 69 73 74 20 6f 6e 65 20 | 64 69 6d 65 6e 73 69 6f |ist one |dimensio|
|000016b0| 6e 61 6c 20 73 74 72 75 | 63 74 75 72 65 20 61 72 |nal stru|cture ar|
|000016c0| 72 61 79 20 66 6f 72 20 | 63 65 6c 6c 0a 58 73 74 |ray for |cell.Xst|
|000016d0| 61 74 75 73 65 73 2c 20 | 61 6e 64 20 74 68 65 20 |atuses, |and the |
|000016e0| 76 61 72 69 6f 75 73 20 | 63 65 6c 6c 20 74 79 70 |various |cell typ|
|000016f0| 65 20 6c 69 6e 6b 20 6c | 69 73 74 20 68 65 61 64 |e link l|ist head|
|00001700| 20 70 6f 69 6e 74 65 72 | 73 20 69 73 6f 6c 61 74 | pointer|s isolat|
|00001710| 65 64 2c 0a 58 6c 69 76 | 65 2c 20 64 65 61 64 2c |ed,.Xliv|e, dead,|
|00001720| 20 73 74 72 65 65 74 2c | 20 61 6e 64 20 75 6e 75 | street,| and unu|
|00001730| 73 65 64 2c 20 61 6e 64 | 20 74 68 65 69 72 20 63 |sed, and| their c|
|00001740| 6f 72 72 65 73 70 6f 6e | 64 69 6e 67 20 63 65 6c |orrespon|ding cel|
|00001750| 6c 20 63 6f 75 6e 74 65 | 72 73 0a 58 69 73 6f 6c |l counte|rs.Xisol|
|00001760| 61 74 65 64 63 74 2c 20 | 6c 69 76 65 63 74 2c 20 |atedct, |livect, |
|00001770| 64 65 61 64 63 74 2c 20 | 73 74 72 65 65 74 63 74 |deadct, |streetct|
|00001780| 2c 20 61 6e 64 20 75 6e | 75 73 65 64 63 74 2c 20 |, and un|usedct, |
|00001790| 61 72 65 20 61 6c 6c 20 | 64 65 66 69 6e 65 64 0a |are all |defined.|
|000017a0| 58 68 65 72 65 2e 20 41 | 73 20 77 65 6c 6c 2c 20 |Xhere. A|s well, |
|000017b0| 73 74 72 65 65 74 6e 75 | 6d 63 74 2c 20 74 68 65 |streetnu|mct, the|
|000017c0| 20 63 6f 75 6e 74 20 6f | 66 20 68 6f 77 20 6d 61 | count o|f how ma|
|000017d0| 6e 79 20 64 69 66 66 65 | 72 65 6e 74 20 73 74 72 |ny diffe|rent str|
|000017e0| 65 65 74 0a 58 6e 75 6d | 62 65 72 73 20 65 78 69 |eet.Xnum|bers exi|
|000017f0| 73 74 2c 20 69 73 20 64 | 65 66 69 6e 65 64 20 68 |st, is d|efined h|
|00001800| 65 72 65 2e 0a 58 0a 58 | 41 73 20 77 65 6c 6c 2c |ere..X.X|As well,|
|00001810| 20 74 68 65 20 67 6c 6f | 62 61 6c 20 70 61 72 61 | the glo|bal para|
|00001820| 6d 65 74 65 72 73 20 6d | 61 7a 65 68 65 69 67 68 |meters m|azeheigh|
|00001830| 74 2c 20 6d 61 7a 65 77 | 69 64 74 68 2c 20 6d 61 |t, mazew|idth, ma|
|00001840| 7a 65 67 61 74 65 73 2c | 0a 58 6c 65 66 74 67 61 |zegates,|.Xleftga|
|00001850| 74 65 73 2c 20 6d 61 7a | 65 63 6f 75 72 74 73 2c |tes, maz|ecourts,|
|00001860| 20 6d 61 7a 65 75 6e 75 | 73 65 64 2c 20 77 69 74 | mazeunu|sed, wit|
|00001870| 68 20 74 68 65 69 72 20 | 61 70 70 72 6f 70 72 69 |h their |appropri|
|00001880| 61 74 65 20 64 65 66 61 | 75 6c 74 73 0a 58 77 68 |ate defa|ults.Xwh|
|00001890| 65 6e 20 6e 6f 74 20 72 | 65 61 64 20 69 6e 20 66 |en not r|ead in f|
|000018a0| 72 6f 6d 20 74 68 65 20 | 63 6f 6d 6d 61 6e 64 20 |rom the |command |
|000018b0| 6c 69 6e 65 2c 20 61 6e | 64 20 72 61 6e 64 6f 6d |line, an|d random|
|000018c0| 73 65 65 64 20 77 69 74 | 68 6f 75 74 20 61 0a 58 |seed wit|hout a.X|
|000018d0| 64 65 66 61 75 6c 74 20 | 76 61 6c 75 65 2c 20 61 |default |value, a|
|000018e0| 6e 64 20 74 68 65 20 64 | 65 72 69 76 65 64 20 67 |nd the d|erived g|
|000018f0| 6c 6f 62 61 6c 20 70 61 | 72 61 6d 65 74 65 72 20 |lobal pa|rameter |
|00001900| 6c 69 73 74 73 69 7a 65 | 2c 20 61 72 65 20 64 65 |listsize|, are de|
|00001910| 63 6c 61 72 65 64 0a 58 | 61 6e 64 20 64 65 66 69 |clared.X|and defi|
|00001920| 6e 65 64 20 68 65 72 65 | 2e 0a 58 0a 58 49 6e 20 |ned here|..X.XIn |
|00001930| 61 64 64 69 74 69 6f 6e | 2c 20 74 68 65 20 69 6e |addition|, the in|
|00001940| 74 65 67 65 72 20 63 6f | 6e 73 74 61 6e 74 73 20 |teger co|nstants |
|00001950| 49 53 4f 4c 41 54 45 44 | 2c 20 4c 49 56 45 2c 20 |ISOLATED|, LIVE, |
|00001960| 44 45 41 44 2c 20 53 54 | 52 45 45 54 2c 20 61 6e |DEAD, ST|REET, an|
|00001970| 64 0a 58 55 4e 55 53 45 | 44 20 61 72 65 20 64 65 |d.XUNUSE|D are de|
|00001980| 66 69 6e 65 64 2c 20 61 | 6e 64 20 74 68 65 20 63 |fined, a|nd the c|
|00001990| 68 61 72 61 63 74 65 72 | 20 63 6f 6e 73 74 61 6e |haracter| constan|
|000019a0| 74 73 20 57 41 4c 4c 2c | 20 56 44 4f 4f 52 2c 20 |ts WALL,| VDOOR, |
|000019b0| 48 44 4f 4f 52 2c 0a 58 | 61 6e 64 20 42 4c 41 4e |HDOOR,.X|and BLAN|
|000019c0| 4b 2e 20 20 41 6c 73 6f | 20 64 65 66 69 6e 65 64 |K. Also| defined|
|000019d0| 20 68 65 72 65 20 69 73 | 20 4e 4f 50 4f 49 4e 54 | here is| NOPOINT|
|000019e0| 45 52 2c 20 77 68 69 63 | 68 20 61 63 74 73 20 61 |ER, whic|h acts a|
|000019f0| 73 20 61 20 6e 75 6c 6c | 0a 58 70 6f 69 6e 74 65 |s a null|.Xpointe|
|00001a00| 72 20 69 6e 20 74 68 65 | 20 73 74 61 74 6c 69 73 |r in the| statlis|
|00001a10| 74 20 64 6f 75 62 6c 65 | 20 6c 69 6e 6b 65 64 20 |t double| linked |
|00001a20| 6c 69 73 74 73 2c 20 77 | 68 69 63 68 20 75 73 65 |lists, w|hich use|
|00001a30| 20 69 6e 64 69 63 65 73 | 20 72 61 74 68 65 72 0a | indices| rather.|
|00001a40| 58 74 68 61 6e 20 70 6f | 69 6e 74 65 72 73 20 66 |Xthan po|inters f|
|00001a50| 6f 72 20 6c 69 6e 6b 73 | 2e 0a 58 0a 58 0a 58 2d |or links|..X.X.X-|
|00001a60| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00001a70| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00001a80| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00001a90| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00001aa0| 2d 2d 2d 2d 2d 2d 0a 58 | 7c 20 74 6f 77 6e 70 72 |------.X|| townpr|
|00001ab0| 6f 74 6f 2e 68 0a 58 2d | 2d 2d 2d 2d 2d 2d 2d 2d |oto.h.X-|--------|
|00001ac0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00001ad0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00001ae0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00001af0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 0a 58 |--------|------.X|
|00001b00| 0a 58 54 68 69 73 20 68 | 65 61 64 65 72 20 66 69 |.XThis h|eader fi|
|00001b10| 6c 65 20 63 6f 6e 74 61 | 69 6e 73 20 61 6c 6c 20 |le conta|ins all |
|00001b20| 74 68 65 20 66 75 6e 63 | 74 69 6f 6e 20 70 72 6f |the func|tion pro|
|00001b30| 74 6f 74 79 70 65 73 2c | 20 73 69 6e 63 65 20 65 |totypes,| since e|
|00001b40| 61 63 68 0a 58 66 75 6e | 63 74 69 6f 6e 20 69 73 |ach.Xfun|ction is|
|00001b50| 20 69 6e 20 69 74 73 20 | 6f 77 6e 20 73 65 70 61 | in its |own sepa|
|00001b60| 72 61 74 65 20 73 6f 75 | 72 63 65 20 6d 6f 64 75 |rate sou|rce modu|
|00001b70| 6c 65 2c 20 64 6f 6e 65 | 20 69 6e 20 62 6f 74 68 |le, done| in both|
|00001b80| 20 41 4e 53 49 20 43 20 | 61 6e 64 0a 58 6f 6c 64 | ANSI C |and.Xold|
|00001b90| 20 4b 26 52 20 66 6f 72 | 6d 2c 20 63 6f 6e 64 69 | K&R for|m, condi|
|00001ba0| 74 69 6f 6e 65 64 20 6f | 6e 20 5f 5f 53 54 44 43 |tioned o|n __STDC|
|00001bb0| 5f 5f 2c 20 74 68 65 20 | 63 6f 6d 70 69 6c 65 72 |__, the |compiler|
|00001bc0| 20 64 65 66 69 6e 65 64 | 20 63 6f 6e 73 74 61 6e | defined| constan|
|00001bd0| 74 0a 58 74 6f 20 69 64 | 65 6e 74 69 66 79 20 41 |t.Xto id|entify A|
|00001be0| 4e 53 49 20 43 20 63 6f | 6d 70 69 6c 65 72 73 2e |NSI C co|mpilers.|
|00001bf0| 20 20 54 68 65 20 73 61 | 6d 65 20 63 6f 6e 64 69 | The sa|me condi|
|00001c00| 74 69 6f 6e 69 6e 67 20 | 69 73 20 64 6f 6e 65 20 |tioning |is done |
|00001c10| 69 6e 20 65 61 63 68 0a | 58 2a 2e 63 20 6d 6f 64 |in each.|X*.c mod|
|00001c20| 75 6c 65 20 66 6f 72 20 | 63 6f 6d 70 61 74 69 62 |ule for |compatib|
|00001c30| 69 6c 69 74 79 2e 0a 58 | 0a 58 0a 58 2d 2d 2d 2d |ility..X|.X.X----|
|00001c40| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00001c50| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00001c60| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00001c70| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00001c80| 2d 2d 2d 0a 58 7c 20 63 | 6c 65 61 6e 75 70 6d 61 |---.X| c|leanupma|
|00001c90| 70 2e 63 20 2d 2d 20 63 | 6c 65 61 6e 6d 61 70 28 |p.c -- c|leanmap(|
|00001ca0| 29 0a 58 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |).X-----|--------|
|00001cb0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00001cc0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00001cd0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00001ce0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 0a 58 0a 58 54 68 |--------|--.X.XTh|
|00001cf0| 69 73 20 69 73 20 74 68 | 65 20 72 6f 75 74 69 6e |is is th|e routin|
|00001d00| 65 20 74 68 61 74 20 61 | 63 63 6f 6d 70 6c 69 73 |e that a|ccomplis|
|00001d10| 68 65 73 20 73 74 65 70 | 20 39 29 20 61 62 6f 76 |hes step| 9) abov|
|00001d20| 65 2e 20 20 49 74 20 64 | 6f 65 73 20 74 68 69 73 |e. It d|oes this|
|00001d30| 20 62 79 0a 58 6d 6f 76 | 69 6e 67 20 74 6f 20 65 | by.Xmov|ing to e|
|00001d40| 61 63 68 20 69 6e 74 65 | 72 73 65 63 74 69 6f 6e |ach inte|rsection|
|00001d50| 20 70 6f 69 6e 74 20 69 | 6e 20 74 68 65 20 63 6d | point i|n the cm|
|00001d60| 61 7a 65 20 64 69 73 70 | 6c 61 79 20 61 72 72 61 |aze disp|lay arra|
|00001d70| 79 20 69 6e 74 65 72 69 | 6f 72 0a 58 66 6f 72 20 |y interi|or.Xfor |
|00001d80| 74 68 65 20 68 6f 72 69 | 7a 6f 6e 74 61 6c 20 61 |the hori|zontal a|
|00001d90| 6e 64 20 76 65 72 74 69 | 63 61 6c 20 77 61 6c 6c |nd verti|cal wall|
|00001da0| 73 20 28 73 65 65 20 66 | 69 6c 6c 6d 61 7a 65 2e |s (see f|illmaze.|
|00001db0| 63 2c 20 62 65 6c 6f 77 | 29 20 6f 66 20 74 68 65 |c, below|) of the|
|00001dc0| 0a 58 72 6f 6f 6d 73 2c | 20 61 6e 64 20 6c 6f 6f |.Xrooms,| and loo|
|00001dd0| 6b 69 6e 67 20 61 74 20 | 74 68 65 20 6e 6f 72 74 |king at |the nort|
|00001de0| 68 2c 20 73 6f 75 74 68 | 2c 20 65 61 73 74 20 61 |h, south|, east a|
|00001df0| 6e 64 20 77 65 73 74 20 | 64 69 73 70 6c 61 79 0a |nd west |display.|
|00001e00| 58 63 68 61 72 61 63 74 | 65 72 73 3b 20 69 66 20 |Xcharact|ers; if |
|00001e10| 74 68 65 79 20 61 72 65 | 20 61 6c 6c 20 62 6c 61 |they are| all bla|
|00001e20| 6e 6b 73 2c 20 74 68 65 | 6e 20 74 68 69 73 20 69 |nks, the|n this i|
|00001e30| 73 20 61 6e 20 69 73 6f | 6c 61 74 65 64 20 22 70 |s an iso|lated "p|
|00001e40| 69 6c 6c 61 72 22 0a 58 | 70 69 65 63 65 20 6f 66 |illar".X|piece of|
|00001e50| 20 77 61 6c 6c 2c 20 73 | 6f 20 69 74 20 69 73 20 | wall, s|o it is |
|00001e60| 72 65 70 6c 61 63 65 64 | 20 62 79 20 61 20 62 6c |replaced| by a bl|
|00001e70| 61 6e 6b 2e 0a 58 0a 58 | 0a 58 2d 2d 2d 2d 2d 2d |ank..X.X|.X------|
|00001e80| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00001e90| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00001ea0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00001eb0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00001ec0| 2d 0a 58 7c 20 63 6c 6f | 73 65 64 6f 6f 72 73 2e |-.X| clo|sedoors.|
|00001ed0| 63 20 2d 2d 20 63 6c 6f | 73 65 64 6f 6f 72 73 28 |c -- clo|sedoors(|
|00001ee0| 29 0a 58 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |).X-----|--------|
|00001ef0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00001f00| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00001f10| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00001f20| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 0a 58 0a 58 54 68 |--------|--.X.XTh|
|00001f30| 69 73 20 69 73 20 74 68 | 65 20 72 6f 75 74 69 6e |is is th|e routin|
|00001f40| 65 20 74 68 61 74 20 61 | 63 63 6f 6d 70 6c 69 73 |e that a|ccomplis|
|00001f50| 68 65 73 20 73 74 65 70 | 20 37 29 20 61 62 6f 76 |hes step| 7) abov|
|00001f60| 65 2e 20 20 49 74 20 64 | 6f 65 73 20 74 68 69 73 |e. It d|oes this|
|00001f70| 20 62 79 0a 58 77 61 6c | 6b 69 6e 67 20 74 68 65 | by.Xwal|king the|
|00001f80| 20 44 45 41 44 20 6c 69 | 73 74 20 66 72 6f 6d 20 | DEAD li|st from |
|00001f90| 6c 69 73 74 20 68 65 61 | 64 20 70 6f 69 6e 74 65 |list hea|d pointe|
|00001fa0| 72 20 64 65 61 64 20 75 | 6e 74 69 6c 20 61 20 4e |r dead u|ntil a N|
|00001fb0| 4f 50 4f 49 4e 54 45 52 | 0a 58 6e 65 78 74 20 70 |OPOINTER|.Xnext p|
|00001fc0| 6f 69 6e 74 65 72 20 69 | 73 20 66 6f 75 6e 64 2e |ointer i|s found.|
|00001fd0| 20 20 41 74 20 65 61 63 | 68 20 72 6f 6f 6d 20 6f | At eac|h room o|
|00001fe0| 6e 20 74 68 65 20 64 65 | 61 64 20 6c 69 73 74 2c |n the de|ad list,|
|00001ff0| 20 69 74 20 63 6f 75 6e | 74 73 20 74 68 65 0a 58 | it coun|ts the.X|
|00002000| 64 6f 6f 72 73 20 62 79 | 20 6c 6f 6f 6b 69 6e 67 |doors by| looking|
|00002010| 20 6e 6f 72 74 68 2c 20 | 65 61 73 74 2c 20 73 6f | north, |east, so|
|00002020| 75 74 68 2c 20 61 6e 64 | 20 77 65 73 74 2c 20 74 |uth, and| west, t|
|00002030| 68 65 6e 20 69 66 20 6d | 6f 72 65 20 74 68 61 6e |hen if m|ore than|
|00002040| 20 6f 6e 65 0a 58 65 78 | 69 73 74 73 2c 20 70 69 | one.Xex|ists, pi|
|00002050| 63 6b 73 20 6f 6e 65 20 | 61 74 20 72 61 6e 64 6f |cks one |at rando|
|00002060| 6d 20 74 6f 20 73 75 72 | 76 69 76 65 20 61 6e 64 |m to sur|vive and|
|00002070| 20 72 65 70 6c 61 63 65 | 73 20 74 68 65 20 6f 74 | replace|s the ot|
|00002080| 68 65 72 73 20 77 69 74 | 68 0a 58 57 41 4c 4c 20 |hers wit|h.XWALL |
|00002090| 73 79 6d 62 6f 6c 73 2e | 20 20 4d 6f 73 74 20 6f |symbols.| Most o|
|000020a0| 66 20 74 68 65 20 6e 61 | 73 74 79 20 6c 6f 6f 6b |f the na|sty look|
|000020b0| 69 6e 67 20 61 72 69 74 | 68 6d 65 74 69 63 20 69 |ing arit|hmetic i|
|000020c0| 73 20 6a 75 73 74 20 74 | 68 65 0a 58 74 72 61 6e |s just t|he.Xtran|
|000020d0| 73 6c 61 74 69 6f 6e 20 | 66 72 6f 6d 20 73 74 61 |slation |from sta|
|000020e0| 74 6c 69 73 74 20 69 6e | 64 69 63 65 73 20 74 6f |tlist in|dices to|
|000020f0| 20 63 6d 61 7a 65 20 6c | 6f 63 61 74 69 6f 6e 73 | cmaze l|ocations|
|00002100| 3b 20 61 6c 6c 20 74 68 | 65 20 63 6f 64 65 20 69 |; all th|e code i|
|00002110| 73 0a 58 72 69 66 65 20 | 77 69 74 68 20 74 68 65 |s.Xrife |with the|
|00002120| 6d 2e 0a 58 0a 58 54 68 | 65 20 6e 65 63 65 73 73 |m..X.XTh|e necess|
|00002130| 69 74 79 20 66 6f 72 20 | 74 68 69 73 20 72 6f 75 |ity for |this rou|
|00002140| 74 69 6e 65 20 69 73 20 | 74 68 61 74 20 77 68 65 |tine is |that whe|
|00002150| 6e 20 74 68 65 20 70 72 | 65 76 69 6f 75 73 20 73 |n the pr|evious s|
|00002160| 74 72 65 65 74 0a 58 63 | 72 65 61 74 69 6f 6e 20 |treet.Xc|reation |
|00002170| 72 6f 75 74 69 6e 65 73 | 20 61 72 65 20 63 6f 6d |routines| are com|
|00002180| 70 6c 65 74 65 2c 20 6d | 6f 73 74 20 6f 66 20 74 |plete, m|ost of t|
|00002190| 68 65 20 72 6f 6f 6d 20 | 63 65 6c 6c 73 20 68 61 |he room |cells ha|
|000021a0| 76 65 20 6d 6f 73 74 20 | 77 61 6c 6c 73 0a 58 61 |ve most |walls.Xa|
|000021b0| 73 20 64 6f 6f 72 73 2c | 20 77 68 69 63 68 20 64 |s doors,| which d|
|000021c0| 6f 65 73 6e 27 74 20 6d | 61 6b 65 20 66 6f 72 20 |oesn't m|ake for |
|000021d0| 6d 75 63 68 20 6f 66 20 | 61 20 63 68 61 6c 6c 65 |much of |a challe|
|000021e0| 6e 67 65 2c 20 74 68 65 | 20 61 64 76 65 6e 74 75 |nge, the| adventu|
|000021f0| 72 65 72 0a 58 64 6f 65 | 73 6e 27 74 20 68 61 76 |rer.Xdoe|sn't hav|
|00002200| 65 20 74 6f 20 77 6f 72 | 6b 20 64 6f 77 6e 20 74 |e to wor|k down t|
|00002210| 68 65 20 73 74 72 65 65 | 74 2c 20 62 75 74 20 63 |he stree|t, but c|
|00002220| 61 6e 20 69 6e 73 74 65 | 61 64 20 6a 75 73 74 20 |an inste|ad just |
|00002230| 77 61 6c 6b 0a 58 74 68 | 72 6f 75 67 68 20 74 68 |walk.Xth|rough th|
|00002240| 65 20 72 6f 77 20 6f 66 | 20 72 6f 6f 6d 73 20 74 |e row of| rooms t|
|00002250| 6f 20 74 68 65 20 73 74 | 72 65 65 74 20 62 65 68 |o the st|reet beh|
|00002260| 69 6e 64 2e 20 0a 58 0a | 58 41 6c 73 6f 2c 20 67 |ind. .X.|XAlso, g|
|00002270| 61 6d 65 73 20 6c 69 6b | 65 20 42 61 72 64 27 73 |ames lik|e Bard's|
|00002280| 20 54 61 6c 65 20 61 72 | 65 20 73 69 6d 70 6c 65 | Tale ar|e simple|
|00002290| 72 20 74 6f 20 64 65 73 | 69 67 6e 20 69 66 20 61 |r to des|ign if a|
|000022a0| 6c 6c 20 6e 6f 72 6d 61 | 6c 20 72 6f 6f 6d 73 0a |ll norma|l rooms.|
|000022b0| 58 68 61 76 65 20 6f 6e | 6c 79 20 6f 6e 65 20 65 |Xhave on|ly one e|
|000022c0| 78 69 74 2c 20 73 69 6e | 63 65 20 74 68 65 6e 20 |xit, sin|ce then |
|000022d0| 6f 6e 6c 79 20 6f 6e 65 | 20 76 69 65 77 70 6f 69 |only one| viewpoi|
|000022e0| 6e 74 20 61 6e 64 20 6e | 6f 20 63 68 6f 69 63 65 |nt and n|o choice|
|000022f0| 73 20 6e 65 65 64 0a 58 | 62 65 20 70 72 65 73 65 |s need.X|be prese|
|00002300| 6e 74 65 64 20 74 6f 20 | 74 68 65 20 70 6c 61 79 |nted to |the play|
|00002310| 65 72 2e 20 0a 58 0a 58 | 2d 2d 2d 2d 2d 2d 2d 2d |er. .X.X|--------|
|00002320| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00002330| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00002340| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00002350| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 0a |--------|-------.|
|00002360| 58 7c 20 63 6c 6f 73 65 | 67 61 74 65 73 2e 63 20 |X| close|gates.c |
|00002370| 2d 2d 20 63 6c 6f 73 65 | 67 61 74 65 73 28 29 0a |-- close|gates().|
|00002380| 58 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |X-------|--------|
|00002390| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000023a0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000023b0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000023c0| 2d 2d 2d 2d 2d 2d 2d 2d | 0a 58 0a 58 54 68 69 73 |--------|.X.XThis|
|000023d0| 20 69 73 20 74 68 65 20 | 72 6f 75 74 69 6e 65 20 | is the |routine |
|000023e0| 74 68 61 74 20 61 63 63 | 6f 6d 70 6c 69 73 68 65 |that acc|omplishe|
|000023f0| 73 20 73 74 65 70 20 38 | 29 20 61 62 6f 76 65 2e |s step 8|) above.|
|00002400| 20 20 49 74 20 64 6f 65 | 73 20 74 68 69 73 20 69 | It doe|s this i|
|00002410| 6e 0a 58 72 65 73 70 6f | 6e 73 65 20 74 6f 20 61 |n.Xrespo|nse to a|
|00002420| 20 63 6f 6d 70 61 72 69 | 73 69 6f 6e 20 62 65 74 | compari|sion bet|
|00002430| 77 65 65 6e 20 74 68 65 | 20 2d 67 20 6d 61 7a 65 |ween the| -g maze|
|00002440| 67 61 74 65 73 20 70 61 | 72 61 6d 65 6e 74 65 72 |gates pa|ramenter|
|00002450| 20 61 6e 64 20 74 68 65 | 0a 58 2d 6c 20 6c 65 66 | and the|.X-l lef|
|00002460| 74 67 61 74 65 73 20 70 | 61 72 61 6d 65 74 65 72 |tgates p|arameter|
|00002470| 3b 20 69 66 20 6d 6f 72 | 65 20 67 61 74 65 73 20 |; if mor|e gates |
|00002480| 77 65 72 65 20 73 65 65 | 64 65 64 20 74 68 61 6e |were see|ded than|
|00002490| 20 77 65 72 65 20 72 65 | 71 75 65 73 74 65 64 0a | were re|quested.|
|000024a0| 58 69 6e 20 74 68 65 20 | 66 69 6e 61 6c 20 6d 61 |Xin the |final ma|
|000024b0| 7a 65 2c 20 74 68 65 6e | 20 67 61 74 65 73 20 61 |ze, then| gates a|
|000024c0| 72 65 20 63 6c 6f 73 65 | 64 20 61 74 20 72 61 6e |re close|d at ran|
|000024d0| 64 6f 6d 20 75 6e 74 69 | 6c 20 6f 6e 6c 79 0a 58 |dom unti|l only.X|
|000024e0| 6c 65 66 74 67 61 74 65 | 73 20 6f 66 20 74 68 65 |leftgate|s of the|
|000024f0| 6d 20 72 65 6d 61 69 6e | 2e 0a 58 0a 58 48 6f 77 |m remain|..X.XHow|
|00002500| 20 6d 61 6e 79 20 70 6c | 61 63 65 73 20 61 6c 6f | many pl|aces alo|
|00002510| 6e 67 20 74 68 65 20 6d | 61 7a 65 20 70 65 72 69 |ng the m|aze peri|
|00002520| 70 68 65 72 79 20 6d 75 | 73 74 20 62 65 20 63 68 |phery mu|st be ch|
|00002530| 65 63 6b 65 64 20 66 6f | 72 20 67 61 74 65 73 20 |ecked fo|r gates |
|00002540| 69 73 0a 58 70 72 65 63 | 6f 6d 70 75 74 65 64 20 |is.Xprec|omputed |
|00002550| 69 6e 74 6f 20 70 6f 73 | 73 69 62 6c 65 67 61 74 |into pos|siblegat|
|00002560| 65 73 2c 20 77 68 69 63 | 68 20 62 65 63 6f 6d 65 |es, whic|h become|
|00002570| 73 20 74 68 65 20 69 6e | 6e 65 72 20 28 66 6f 72 |s the in|ner (for|
|00002580| 29 20 6c 6f 6f 70 0a 58 | 6c 69 6d 69 74 2e 0a 58 |) loop.X|limit..X|
|00002590| 0a 58 54 68 65 20 67 61 | 74 65 20 63 6c 6f 73 69 |.XThe ga|te closi|
|000025a0| 6e 67 20 74 61 73 6b 20 | 69 73 20 64 6f 6e 65 20 |ng task |is done |
|000025b0| 62 79 20 6b 65 65 70 69 | 6e 67 20 74 72 61 63 6b |by keepi|ng track|
|000025c0| 20 6f 66 20 68 6f 77 20 | 6d 61 6e 79 20 67 61 74 | of how |many gat|
|000025d0| 65 73 20 61 72 65 0a 58 | 6c 65 66 74 20 77 69 74 |es are.X|left wit|
|000025e0| 68 20 67 61 74 65 73 6c | 65 66 74 2c 20 63 6f 6e |h gatesl|eft, con|
|000025f0| 64 69 74 69 6f 6e 69 6e | 67 20 61 6e 20 6f 75 74 |ditionin|g an out|
|00002600| 65 72 20 77 68 69 6c 65 | 20 6c 6f 6f 70 20 6f 6e |er while| loop on|
|00002610| 20 67 61 74 65 73 6c 65 | 66 74 0a 58 62 65 69 6e | gatesle|ft.Xbein|
|00002620| 67 20 67 72 65 61 74 65 | 72 20 74 68 61 6e 20 6c |g greate|r than l|
|00002630| 65 66 74 67 61 74 65 73 | 2c 20 74 68 65 6e 20 77 |eftgates|, then w|
|00002640| 69 74 68 69 6e 67 20 74 | 68 65 20 6c 6f 6f 70 20 |ithing t|he loop |
|00002650| 72 6f 6c 6c 69 6e 67 20 | 61 20 72 61 6e 64 6f 6d |rolling |a random|
|00002660| 0a 58 67 61 74 65 20 6e | 75 6d 62 65 72 20 69 6e |.Xgate n|umber in|
|00002670| 74 6f 20 63 68 6f 73 65 | 6e 67 61 74 65 20 61 73 |to chose|ngate as|
|00002680| 20 61 20 6d 6f 64 75 6c | 75 73 20 6f 66 20 52 41 | a modul|us of RA|
|00002690| 4e 44 4f 4d 28 29 20 62 | 79 20 67 61 74 65 73 6c |NDOM() b|y gatesl|
|000026a0| 65 66 74 2c 20 61 6e 64 | 0a 58 74 68 65 6e 20 77 |eft, and|.Xthen w|
|000026b0| 61 6c 6b 69 6e 67 20 74 | 68 65 20 70 65 72 69 70 |alking t|he perip|
|000026c0| 68 65 72 79 20 6f 66 20 | 74 68 65 20 6d 61 7a 65 |hery of |the maze|
|000026d0| 20 69 6e 20 61 6e 64 20 | 69 6e 6e 65 72 20 66 6f | in and |inner fo|
|000026e0| 72 20 6c 6f 6f 70 2c 20 | 6c 6f 6f 6b 69 6e 67 0a |r loop, |looking.|
|000026f0| 58 66 6f 72 20 56 44 4f | 4f 52 20 6f 72 20 48 44 |Xfor VDO|OR or HD|
|00002700| 4f 4f 52 20 65 6c 65 6d | 65 6e 74 73 20 69 6e 20 |OOR elem|ents in |
|00002710| 74 68 65 20 6f 75 74 65 | 72 20 77 61 6c 6c 2c 20 |the oute|r wall, |
|00002720| 61 6e 64 20 63 6f 75 6e | 74 69 6e 67 20 68 6f 77 |and coun|ting how|
|00002730| 20 6d 61 6e 79 0a 58 67 | 61 74 65 73 20 68 61 76 | many.Xg|ates hav|
|00002740| 65 20 62 65 65 6e 20 65 | 6e 63 6f 75 6e 74 65 72 |e been e|ncounter|
|00002750| 65 64 20 69 6e 20 66 6f | 75 6e 64 67 61 74 65 2e |ed in fo|undgate.|
|00002760| 0a 58 0a 58 57 68 65 6e | 20 74 68 65 20 67 61 74 |.X.XWhen| the gat|
|00002770| 65 20 65 6e 63 6f 75 6e | 74 65 72 65 64 20 6d 61 |e encoun|tered ma|
|00002780| 74 63 68 65 73 20 74 68 | 65 20 6e 75 6d 62 65 72 |tches th|e number|
|00002790| 20 66 6f 75 6e 64 2c 20 | 74 68 65 20 67 61 74 65 | found, |the gate|
|000027a0| 20 69 73 0a 58 63 6c 6f | 73 65 64 2c 20 74 68 65 | is.Xclo|sed, the|
|000027b0| 20 67 61 74 65 73 6c 65 | 66 74 20 64 65 63 72 65 | gatesle|ft decre|
|000027c0| 6d 65 6e 74 65 64 2c 20 | 61 6e 64 20 74 68 65 20 |mented, |and the |
|000027d0| 69 6e 6e 65 72 20 6c 6f | 6f 70 20 62 72 6f 6b 65 |inner lo|op broke|
|000027e0| 6e 2e 0a 58 0a 58 54 68 | 65 20 6d 65 73 73 79 20 |n..X.XTh|e messy |
|000027f0| 69 6e 74 65 72 69 6f 72 | 20 6f 66 20 74 68 65 20 |interior| of the |
|00002800| 69 6e 6e 65 72 20 6c 6f | 6f 70 20 69 73 20 75 6e |inner lo|op is un|
|00002810| 61 76 6f 69 64 61 62 6c | 65 20 75 6e 6c 65 73 73 |avoidabl|e unless|
|00002820| 20 61 20 6c 69 6e 6b 20 | 6c 69 73 74 0a 58 6f 66 | a link |list.Xof|
|00002830| 20 67 61 74 65 20 63 65 | 6c 6c 73 20 69 73 20 6b | gate ce|lls is k|
|00002840| 65 70 74 2c 20 77 68 69 | 63 68 20 77 6f 75 6c 64 |ept, whi|ch would|
|00002850| 20 68 61 76 65 20 6d 65 | 73 73 65 64 20 75 70 20 | have me|ssed up |
|00002860| 73 74 61 74 6c 69 73 74 | 20 74 6f 6f 20 6d 75 63 |statlist| too muc|
|00002870| 68 3b 0a 58 74 68 65 20 | 61 72 69 74 68 6d 65 74 |h;.Xthe |arithmet|
|00002880| 69 63 20 74 6f 20 77 61 | 6c 6b 20 61 72 6f 75 6e |ic to wa|lk aroun|
|00002890| 64 20 74 68 65 20 62 6f | 72 64 65 72 20 6f 66 20 |d the bo|rder of |
|000028a0| 61 20 72 65 63 74 61 6e | 67 6c 65 20 77 68 65 6e |a rectan|gle when|
|000028b0| 20 74 68 65 0a 58 69 6e | 64 69 63 65 73 20 61 72 | the.Xin|dices ar|
|000028c0| 65 20 69 6e 20 72 6f 77 | 20 6d 61 6a 6f 72 20 6f |e in row| major o|
|000028d0| 72 64 65 72 20 69 6e 73 | 74 65 61 64 20 6f 66 20 |rder ins|tead of |
|000028e0| 73 6f 6d 65 20 6e 69 63 | 65 20 69 6e 74 75 72 6e |some nic|e inturn|
|000028f0| 69 6e 67 20 73 70 69 72 | 61 6c 0a 58 69 73 20 6a |ing spir|al.Xis j|
|00002900| 75 73 74 20 74 68 61 74 | 20 75 67 6c 79 2e 0a 58 |ust that| ugly..X|
|00002910| 0a 58 0a 58 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |.X.X----|--------|
|00002920| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00002930| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00002940| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00002950| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 0a 58 7c 20 63 |--------|---.X| c|
|00002960| 6f 6e 6e 65 63 74 73 74 | 2e 63 20 2d 2d 20 63 6f |onnectst|.c -- co|
|00002970| 6e 6e 65 63 74 73 74 72 | 65 65 74 73 28 29 0a 58 |nnectstr|eets().X|
|00002980| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00002990| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000029a0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000029b0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000029c0| 2d 2d 2d 2d 2d 2d 2d 0a | 58 0a 58 54 68 69 73 20 |-------.|X.XThis |
|000029d0| 69 73 20 74 68 65 20 72 | 6f 75 74 69 6e 65 20 74 |is the r|outine t|
|000029e0| 68 61 74 20 61 63 63 6f | 6d 70 6c 69 73 68 65 73 |hat acco|mplishes|
|000029f0| 20 73 74 65 70 20 35 29 | 2c 20 61 62 6f 76 65 2e | step 5)|, above.|
|00002a00| 20 20 54 68 65 20 67 6f | 61 6c 20 69 73 20 74 6f | The go|al is to|
|00002a10| 0a 58 6d 61 6b 65 20 61 | 6c 6c 20 74 68 65 20 73 |.Xmake a|ll the s|
|00002a20| 74 72 65 65 74 73 20 69 | 6e 20 74 68 65 20 6d 61 |treets i|n the ma|
|00002a30| 7a 65 20 69 6e 74 6f 20 | 6f 6e 65 20 63 6f 6e 6e |ze into |one conn|
|00002a40| 65 63 74 65 64 20 73 74 | 72 65 65 74 2c 20 64 65 |ected st|reet, de|
|00002a50| 63 72 65 61 73 69 6e 67 | 0a 58 73 74 72 65 65 74 |creasing|.Xstreet|
|00002a60| 6e 75 6d 63 74 20 74 6f | 20 31 2c 20 61 6e 64 20 |numct to| 1, and |
|00002a70| 74 68 69 73 20 69 73 20 | 77 68 65 72 65 20 74 6f |this is |where to|
|00002a80| 77 6e 6d 61 7a 65 20 73 | 70 65 6e 64 73 20 6d 6f |wnmaze s|pends mo|
|00002a90| 73 74 20 6f 66 20 69 74 | 73 20 74 69 6d 65 2c 0a |st of it|s time,.|
|00002aa0| 58 73 69 6e 63 65 20 61 | 64 64 69 6e 67 20 6e 65 |Xsince a|dding ne|
|00002ab0| 77 20 73 74 72 65 65 74 | 20 63 65 6c 6c 73 20 69 |w street| cells i|
|00002ac0| 73 20 77 68 61 74 20 6d | 61 6b 65 73 20 74 68 65 |s what m|akes the|
|00002ad0| 20 6d 61 7a 65 2e 0a 58 | 0a 58 54 68 69 73 20 69 | maze..X|.XThis i|
|00002ae0| 73 20 6f 6e 65 20 6f 66 | 20 74 68 65 20 62 69 67 |s one of| the big|
|00002af0| 67 65 73 74 20 72 6f 75 | 74 69 6e 65 73 20 69 6e |gest rou|tines in|
|00002b00| 20 74 6f 77 6e 6d 61 7a | 65 2c 20 62 65 63 61 75 | townmaz|e, becau|
|00002b10| 73 65 20 69 74 20 6e 65 | 65 64 73 0a 58 74 68 72 |se it ne|eds.Xthr|
|00002b20| 65 65 20 73 65 70 61 72 | 61 74 65 20 73 74 72 61 |ee separ|ate stra|
|00002b30| 74 65 67 69 65 73 20 74 | 6f 20 63 6f 6e 6e 65 63 |tegies t|o connec|
|00002b40| 74 20 73 74 72 65 65 74 | 73 2e 20 20 46 69 72 73 |t street|s. Firs|
|00002b50| 74 20 69 74 20 74 72 69 | 65 73 20 74 6f 0a 58 63 |t it tri|es to.Xc|
|00002b60| 6f 6e 6e 65 63 74 20 61 | 6c 6c 20 74 68 65 20 73 |onnect a|ll the s|
|00002b70| 74 72 65 65 74 73 20 62 | 79 20 6f 6e 6c 79 20 75 |treets b|y only u|
|00002b80| 73 69 6e 67 20 63 65 6c | 6c 73 20 66 72 6f 6d 20 |sing cel|ls from |
|00002b90| 74 68 65 20 4c 49 56 45 | 20 6c 69 73 74 20 69 6e |the LIVE| list in|
|00002ba0| 0a 58 73 74 61 74 6c 69 | 73 74 2e 20 20 49 66 20 |.Xstatli|st. If |
|00002bb0| 61 6c 6c 20 74 68 65 20 | 4c 49 56 45 20 63 65 6c |all the |LIVE cel|
|00002bc0| 6c 73 20 61 72 65 20 75 | 73 65 64 20 75 70 20 61 |ls are u|sed up a|
|00002bd0| 6e 64 20 74 68 65 72 65 | 20 61 72 65 20 73 74 69 |nd there| are sti|
|00002be0| 6c 6c 20 6d 6f 72 65 0a | 58 74 68 61 6e 20 6f 6e |ll more.|Xthan on|
|00002bf0| 65 20 73 74 72 65 65 74 | 20 6e 6f 74 65 64 20 69 |e street| noted i|
|00002c00| 6e 20 73 74 72 65 65 74 | 6e 75 6d 63 74 2c 20 74 |n street|numct, t|
|00002c10| 68 65 6e 20 74 68 65 20 | 73 65 63 6f 6e 64 20 73 |hen the |second s|
|00002c20| 74 72 61 74 65 67 79 20 | 69 73 20 74 6f 0a 58 75 |trategy |is to.Xu|
|00002c30| 73 65 20 6f 6e 6c 79 20 | 44 45 41 44 20 63 65 6c |se only |DEAD cel|
|00002c40| 6c 73 20 74 68 61 74 20 | 74 6f 75 63 68 20 74 77 |ls that |touch tw|
|00002c50| 6f 20 64 69 66 66 65 72 | 65 6e 74 20 73 74 72 65 |o differ|ent stre|
|00002c60| 65 74 73 20 61 73 20 6e | 65 77 20 73 74 72 65 65 |ets as n|ew stree|
|00002c70| 74 0a 58 63 65 6c 6c 73 | 2e 20 20 49 66 20 77 6f |t.Xcells|. If wo|
|00002c80| 72 73 74 20 63 6f 6d 65 | 73 20 74 6f 20 77 6f 72 |rst come|s to wor|
|00002c90| 73 74 2c 20 69 66 20 73 | 74 72 65 65 74 6e 75 6d |st, if s|treetnum|
|00002ca0| 63 74 20 69 73 20 73 74 | 69 6c 6c 20 67 72 65 61 |ct is st|ill grea|
|00002cb0| 74 65 72 20 74 68 61 6e | 0a 58 6f 6e 65 2c 20 74 |ter than|.Xone, t|
|00002cc0| 68 65 6e 20 69 6e 20 74 | 68 65 20 74 68 69 72 64 |hen in t|he third|
|00002cd0| 20 73 74 72 61 74 65 67 | 79 2c 20 74 68 65 20 65 | strateg|y, the e|
|00002ce0| 6e 74 69 72 65 20 44 45 | 41 44 20 63 65 6c 6c 20 |ntire DE|AD cell |
|00002cf0| 6c 69 73 74 20 69 73 20 | 75 73 65 64 20 61 73 0a |list is |used as.|
|00002d00| 58 74 61 72 67 65 74 73 | 20 74 6f 20 63 6f 6e 6e |Xtargets| to conn|
|00002d10| 65 63 74 20 74 68 65 20 | 73 74 72 65 65 74 73 2e |ect the |streets.|
|00002d20| 0a 58 0a 58 54 68 69 73 | 20 72 6f 75 74 69 6e 65 |.X.XThis| routine|
|00002d30| 20 72 75 6e 73 20 61 20 | 6c 6f 74 20 73 6c 6f 77 | runs a |lot slow|
|00002d40| 65 72 20 74 68 61 6e 20 | 66 69 72 73 74 20 67 6c |er than |first gl|
|00002d50| 61 6e 63 65 20 6d 69 67 | 68 74 20 73 75 67 67 65 |ance mig|ht sugge|
|00002d60| 73 74 2c 0a 58 62 65 63 | 61 75 73 65 20 63 61 6c |st,.Xbec|ause cal|
|00002d70| 6c 65 64 20 72 6f 75 74 | 69 6e 65 20 6d 61 6b 65 |led rout|ine make|
|00002d80| 73 74 72 65 65 74 28 29 | 20 63 61 6e 20 73 75 63 |street()| can suc|
|00002d90| 63 65 65 64 20 61 73 20 | 69 6e 66 72 65 71 75 65 |ceed as |infreque|
|00002da0| 6e 74 6c 79 20 61 73 0a | 58 6f 6e 63 65 20 69 6e |ntly as.|Xonce in|
|00002db0| 20 61 20 74 68 6f 75 73 | 61 6e 64 20 63 61 6c 6c | a thous|and call|
|00002dc0| 73 2c 20 64 65 70 65 6e | 64 69 6e 67 20 6f 6e 20 |s, depen|ding on |
|00002dd0| 74 68 65 20 63 75 72 72 | 65 6e 74 20 63 6f 6e 66 |the curr|ent conf|
|00002de0| 69 67 75 72 61 74 69 6f | 6e 20 6f 66 0a 58 74 68 |iguratio|n of.Xth|
|00002df0| 65 20 6d 61 7a 65 2c 20 | 61 6e 64 20 74 68 65 20 |e maze, |and the |
|00002e00| 6d 61 7a 65 73 74 72 61 | 69 67 68 74 6e 65 73 73 |mazestra|ightness|
|00002e10| 20 70 61 72 61 6d 65 74 | 65 72 20 73 65 74 74 69 | paramet|er setti|
|00002e20| 6e 67 2e 0a 58 0a 58 54 | 68 65 20 66 69 72 73 74 |ng..X.XT|he first|
|00002e30| 20 70 68 61 73 65 20 69 | 73 20 64 6f 6e 65 20 62 | phase i|s done b|
|00002e40| 79 20 70 69 63 6b 69 6e | 67 20 61 20 72 61 6e 64 |y pickin|g a rand|
|00002e50| 6f 6d 20 4c 49 56 45 20 | 6c 69 73 74 20 65 6c 65 |om LIVE |list ele|
|00002e60| 6d 65 6e 74 2c 20 77 61 | 6c 6b 69 6e 67 0a 58 74 |ment, wa|lking.Xt|
|00002e70| 68 65 20 6c 69 76 65 20 | 6c 69 73 74 20 74 6f 20 |he live |list to |
|00002e80| 74 68 61 74 20 65 6c 65 | 6d 65 6e 74 2c 20 61 6e |that ele|ment, an|
|00002e90| 64 20 61 73 6b 69 6e 67 | 20 6d 61 6b 65 73 74 72 |d asking| makestr|
|00002ea0| 65 65 74 28 29 20 74 6f | 20 6d 61 6b 65 20 61 0a |eet() to| make a.|
|00002eb0| 58 73 74 72 65 65 74 20 | 6f 66 20 69 74 2e 20 20 |Xstreet |of it. |
|00002ec0| 54 68 65 20 6f 75 74 65 | 72 20 6c 6f 6f 70 20 64 |The oute|r loop d|
|00002ed0| 6f 69 6e 67 20 74 68 69 | 73 20 69 73 20 63 6f 6e |oing thi|s is con|
|00002ee0| 64 69 74 69 6f 6e 65 64 | 20 6f 6e 20 62 6f 74 68 |ditioned| on both|
|00002ef0| 0a 58 73 74 72 65 65 74 | 6e 75 6d 63 74 20 62 65 |.Xstreet|numct be|
|00002f00| 69 6e 67 20 67 72 65 61 | 74 65 72 20 74 68 61 6e |ing grea|ter than|
|00002f10| 20 31 2c 20 61 6e 64 20 | 6c 69 76 65 63 74 20 62 | 1, and |livect b|
|00002f20| 65 69 6e 67 20 67 72 65 | 61 74 65 72 20 74 68 61 |eing gre|ater tha|
|00002f30| 6e 20 7a 65 72 6f 2e 0a | 58 54 68 65 20 66 61 63 |n zero..|XThe fac|
|00002f40| 74 20 74 68 61 74 20 6d | 61 6b 65 73 74 72 65 65 |t that m|akestree|
|00002f50| 74 28 29 20 6d 69 67 68 | 74 20 72 65 66 75 73 65 |t() migh|t refuse|
|00002f60| 20 74 6f 20 6d 61 6b 65 | 20 61 20 73 74 72 65 65 | to make| a stree|
|00002f70| 74 20 6f 6e 0a 58 73 74 | 72 61 69 67 68 74 6e 65 |t on.Xst|raightne|
|00002f80| 73 73 20 63 72 69 74 65 | 72 69 61 20 69 73 20 68 |ss crite|ria is h|
|00002f90| 69 64 64 65 6e 20 62 79 | 20 6a 75 73 74 20 72 75 |idden by| just ru|
|00002fa0| 6e 6e 69 6e 67 20 74 68 | 65 20 6f 75 74 65 72 20 |nning th|e outer |
|00002fb0| 6c 6f 6f 70 20 75 6e 74 | 69 6c 0a 58 6f 6e 65 20 |loop unt|il.Xone |
|00002fc0| 6f 66 20 74 68 65 20 63 | 6f 6e 64 69 74 69 6f 6e |of the c|ondition|
|00002fd0| 73 20 66 61 69 6c 73 2e | 20 0a 58 0a 58 41 66 74 |s fails.| .X.XAft|
|00002fe0| 65 72 74 68 65 20 6f 75 | 74 65 72 6c 6f 6f 70 20 |erthe ou|terloop |
|00002ff0| 73 65 6c 65 63 74 73 20 | 61 20 74 61 72 67 65 74 |selects |a target|
|00003000| 63 65 6c 6c 20 66 72 6f | 6d 20 74 68 65 20 4c 49 |cell fro|m the LI|
|00003010| 56 45 20 6c 69 73 74 20 | 62 61 73 65 64 20 6f 6e |VE list |based on|
|00003020| 20 61 0a 58 6d 6f 64 75 | 6c 75 73 20 6f 66 20 52 | a.Xmodu|lus of R|
|00003030| 41 4e 44 4f 4d 28 29 20 | 61 67 61 69 6e 73 74 20 |ANDOM() |against |
|00003040| 74 68 65 20 6c 69 76 65 | 63 74 2c 20 74 68 65 20 |the live|ct, the |
|00003050| 6d 69 64 64 6c 65 20 6c | 6f 6f 70 20 69 73 20 75 |middle l|oop is u|
|00003060| 73 65 64 20 74 6f 0a 58 | 77 61 6c 6b 20 6c 69 76 |sed to.X|walk liv|
|00003070| 65 77 61 6c 6b 20 64 6f | 77 6e 20 74 68 65 20 4c |ewalk do|wn the L|
|00003080| 49 56 45 20 6c 69 73 74 | 2e 20 54 68 69 73 20 69 |IVE list|. This i|
|00003090| 73 20 77 68 65 72 65 20 | 74 68 65 20 6d 61 69 6e |s where |the main|
|000030a0| 74 65 6e 61 6e 63 65 20 | 6f 66 20 74 68 65 0a 58 |tenance |of the.X|
|000030b0| 6c 69 6e 6b 73 20 6c 69 | 73 74 73 20 70 61 79 73 |links li|sts pays|
|000030c0| 20 6f 66 66 3b 20 77 69 | 74 68 6f 75 74 20 74 68 | off; wi|thout th|
|000030d0| 65 6d 2c 20 74 68 65 20 | 77 61 6c 6b 20 74 6f 20 |em, the |walk to |
|000030e0| 66 69 6e 64 20 74 68 65 | 20 74 61 72 67 65 74 63 |find the| targetc|
|000030f0| 65 6c 6c 0a 58 61 6d 6f | 6e 67 20 74 68 65 20 4c |ell.Xamo|ng the L|
|00003100| 49 56 45 20 6c 69 73 74 | 20 63 65 6c 6c 73 20 77 |IVE list| cells w|
|00003110| 6f 75 6c 64 20 68 61 76 | 65 20 74 6f 20 77 61 6c |ould hav|e to wal|
|00003120| 6b 20 74 68 65 20 77 68 | 6f 6c 65 20 73 74 61 74 |k the wh|ole stat|
|00003130| 6c 69 73 74 2c 20 61 0a | 58 6d 75 63 68 20 6c 6f |list, a.|Xmuch lo|
|00003140| 6e 67 65 72 20 6c 69 73 | 74 2e 20 0a 58 0a 58 49 |nger lis|t. .X.XI|
|00003150| 6e 20 74 68 65 20 69 6e | 6e 65 72 20 6c 6f 6f 70 |n the in|ner loop|
|00003160| 2c 20 6e 68 62 72 65 78 | 69 73 74 73 20 69 73 20 |, nhbrex|ists is |
|00003170| 75 73 65 64 2c 20 68 65 | 72 65 20 61 73 20 65 6c |used, he|re as el|
|00003180| 73 65 77 68 65 72 65 2c | 20 74 6f 20 61 76 6f 69 |sewhere,| to avoi|
|00003190| 64 0a 58 69 6e 64 65 78 | 69 6e 67 20 61 6e 20 69 |d.Xindex|ing an i|
|000031a0| 6e 76 61 6c 69 64 20 65 | 6e 74 72 79 20 6f 66 20 |nvalid e|ntry of |
|000031b0| 73 74 61 74 6c 69 73 74 | 2c 20 77 68 69 6c 65 20 |statlist|, while |
|000031c0| 6e 68 62 72 69 73 20 69 | 73 20 75 73 65 64 20 74 |nhbris i|s used t|
|000031d0| 6f 0a 58 74 72 61 6e 73 | 6c 61 74 65 20 73 69 6d |o.Xtrans|late sim|
|000031e0| 70 6c 79 20 66 72 6f 6d | 20 61 20 6e 65 69 67 68 |ply from| a neigh|
|000031f0| 62 6f 72 20 6e 75 6d 62 | 65 72 20 30 2d 33 20 74 |bor numb|er 0-3 t|
|00003200| 6f 20 61 20 73 74 61 74 | 6c 69 73 74 20 63 65 6c |o a stat|list cel|
|00003210| 6c 20 69 6e 64 65 78 2e | 0a 58 49 66 20 79 6f 75 |l index.|.XIf you|
|00003220| 20 77 61 6e 74 20 74 6f | 20 62 65 20 6e 69 63 65 | want to| be nice|
|00003230| 20 61 62 6f 75 74 20 69 | 74 20 79 6f 75 20 63 6f | about i|t you co|
|00003240| 75 6c 64 20 63 61 6c 6c | 20 74 68 69 73 20 64 61 |uld call| this da|
|00003250| 74 61 20 61 62 73 74 72 | 61 63 74 69 6f 6e 2e 0a |ta abstr|action..|
|00003260| 58 0a 58 54 68 65 20 63 | 61 6c 6c 20 74 6f 20 6d |X.XThe c|all to m|
|00003270| 61 6b 65 73 74 72 65 65 | 74 28 29 20 63 6f 6e 74 |akestree|t() cont|
|00003280| 61 69 6e 73 20 22 2d 31 | 22 20 61 73 20 74 68 65 |ains "-1|" as the|
|00003290| 20 6c 61 73 74 20 70 61 | 72 61 6d 65 74 65 72 2c | last pa|rameter,|
|000032a0| 20 77 68 69 63 68 0a 58 | 65 6e 61 62 6c 65 73 20 | which.X|enables |
|000032b0| 74 68 65 20 73 74 72 61 | 69 67 68 74 6e 65 73 73 |the stra|ightness|
|000032c0| 20 63 68 65 63 6b 73 20 | 74 68 65 72 65 2e 0a 58 | checks |there..X|
|000032d0| 0a 58 54 68 65 20 73 65 | 63 6f 6e 64 20 70 68 61 |.XThe se|cond pha|
|000032e0| 73 65 20 69 73 20 64 6f | 6e 65 20 62 79 20 77 61 |se is do|ne by wa|
|000032f0| 6c 6b 69 6e 67 20 74 68 | 65 20 44 45 41 44 20 6c |lking th|e DEAD l|
|00003300| 69 73 74 2c 20 73 65 65 | 6b 69 6e 67 20 44 45 41 |ist, see|king DEA|
|00003310| 44 20 63 65 6c 6c 73 0a | 58 77 68 6f 73 65 20 6e |D cells.|Xwhose n|
|00003320| 65 69 67 68 62 6f 72 73 | 20 69 6e 63 6c 75 64 65 |eighbors| include|
|00003330| 20 73 74 72 65 65 74 73 | 20 77 69 74 68 20 74 77 | streets| with tw|
|00003340| 6f 20 6f 72 20 6d 6f 72 | 65 20 64 69 66 66 65 72 |o or mor|e differ|
|00003350| 65 6e 74 20 6e 75 6d 62 | 65 72 73 2e 0a 58 54 68 |ent numb|ers..XTh|
|00003360| 69 73 20 63 6f 75 6c 64 | 20 70 72 6f 62 61 62 6c |is could| probabl|
|00003370| 79 20 68 61 76 65 20 62 | 65 65 6e 20 64 6f 6e 65 |y have b|een done|
|00003380| 20 6d 6f 72 65 20 63 6c | 65 61 6e 6c 79 20 77 69 | more cl|eanly wi|
|00003390| 74 68 20 74 68 65 20 22 | 66 6f 72 28 69 22 20 6c |th the "|for(i" l|
|000033a0| 6f 6f 70 0a 58 72 65 70 | 6c 61 63 65 64 20 62 79 |oop.Xrep|laced by|
|000033b0| 20 61 20 22 77 68 69 6c | 65 20 28 64 65 61 64 77 | a "whil|e (deadw|
|000033c0| 61 6c 6b 20 21 3d 20 4e | 4f 50 4f 49 4e 54 45 52 |alk != N|OPOINTER|
|000033d0| 29 22 20 6c 6f 6f 70 2c | 20 62 75 74 20 74 68 69 |)" loop,| but thi|
|000033e0| 73 20 6f 6e 65 0a 58 77 | 6f 72 6b 73 2e 20 20 42 |s one.Xw|orks. B|
|000033f0| 65 63 61 75 73 65 20 74 | 68 65 20 44 45 41 44 20 |ecause t|he DEAD |
|00003400| 6c 69 73 74 20 69 73 20 | 63 68 61 6e 67 69 6e 67 |list is |changing|
|00003410| 20 73 69 7a 65 20 77 68 | 69 6c 65 20 74 68 65 20 | size wh|ile the |
|00003420| 6c 69 73 74 20 69 73 0a | 58 77 61 6c 6b 65 64 2c |list is.|Xwalked,|
|00003430| 20 74 68 65 72 65 20 61 | 72 65 20 73 6f 6d 65 20 | there a|re some |
|00003440| 68 79 70 65 72 2d 64 65 | 66 65 6e 73 69 76 65 20 |hyper-de|fensive |
|00003450| 63 68 65 63 6b 73 20 67 | 6f 69 6e 67 20 6f 6e 20 |checks g|oing on |
|00003460| 74 6f 20 6d 61 6b 65 20 | 73 75 72 65 0a 58 74 68 |to make |sure.Xth|
|00003470| 65 20 44 45 41 44 20 6c | 69 73 74 20 65 6e 64 20 |e DEAD l|ist end |
|00003480| 69 73 6e 27 74 20 65 78 | 63 65 65 64 65 64 2e 20 |isn't ex|ceeded. |
|00003490| 20 46 6f 72 20 74 68 65 | 20 73 61 6d 65 20 72 65 | For the| same re|
|000034a0| 61 73 6f 6e 2c 20 64 65 | 61 64 77 61 6c 6b 20 68 |ason, de|adwalk h|
|000034b0| 61 73 0a 58 74 6f 20 62 | 65 20 6d 6f 76 65 64 20 |as.Xto b|e moved |
|000034c0| 70 61 73 74 20 74 68 65 | 20 63 75 72 72 65 6e 74 |past the| current|
|000034d0| 20 63 65 6c 6c 20 62 65 | 66 6f 72 65 20 69 74 20 | cell be|fore it |
|000034e0| 69 73 20 70 6f 73 73 69 | 62 6c 79 20 79 61 6e 6b |is possi|bly yank|
|000034f0| 65 64 20 6f 75 74 0a 58 | 66 72 6f 6d 20 75 6e 64 |ed out.X|from und|
|00003500| 65 72 20 62 79 20 6d 61 | 6b 65 73 74 72 65 65 74 |er by ma|kestreet|
|00003510| 20 28 77 68 69 63 68 20 | 77 69 6c 6c 20 6d 6f 76 | (which |will mov|
|00003520| 65 20 69 74 20 66 72 6f | 6d 20 74 68 65 20 44 45 |e it fro|m the DE|
|00003530| 41 44 20 6c 69 73 74 20 | 74 6f 0a 58 74 68 65 20 |AD list |to.Xthe |
|00003540| 53 54 52 45 45 54 20 6c | 69 73 74 20 69 66 20 63 |STREET l|ist if c|
|00003550| 61 6c 6c 65 64 29 2c 20 | 73 6f 20 6c 61 73 74 64 |alled), |so lastd|
|00003560| 65 61 64 20 69 73 20 75 | 73 65 64 20 74 6f 20 61 |ead is u|sed to a|
|00003570| 63 63 65 73 73 20 74 68 | 65 20 63 75 72 72 65 6e |ccess th|e curren|
|00003580| 74 0a 58 63 65 6c 6c 20 | 61 6e 64 20 74 68 65 6e |t.Xcell |and then|
|00003590| 20 6e 6f 74 20 75 73 65 | 64 20 61 66 74 65 72 20 | not use|d after |
|000035a0| 74 68 65 20 6d 61 6b 65 | 73 74 72 65 65 74 20 63 |the make|street c|
|000035b0| 61 6c 6c 2e 0a 58 0a 58 | 41 74 20 74 68 65 20 74 |all..X.X|At the t|
|000035c0| 6f 70 20 6f 66 20 74 68 | 65 20 6c 6f 6f 70 73 2c |op of th|e loops,|
|000035d0| 20 61 20 63 68 65 63 6b | 20 69 73 20 6d 61 64 65 | a check| is made|
|000035e0| 20 74 68 61 74 20 74 68 | 69 73 20 63 65 6c 6c 20 | that th|is cell |
|000035f0| 69 73 20 69 6e 74 65 72 | 69 6f 72 3b 0a 58 74 68 |is inter|ior;.Xth|
|00003600| 65 20 67 6f 61 6c 20 69 | 73 20 74 6f 20 61 76 6f |e goal i|s to avo|
|00003610| 69 64 20 72 75 6e 6e 69 | 6e 67 20 73 74 72 65 65 |id runni|ng stree|
|00003620| 74 73 20 61 6c 6f 6e 67 | 20 74 68 65 20 63 69 74 |ts along| the cit|
|00003630| 79 20 77 61 6c 6c 2c 20 | 61 20 62 6f 72 69 6e 67 |y wall, |a boring|
|00003640| 0a 58 6b 69 6e 64 20 6f | 66 20 64 65 73 69 67 6e |.Xkind o|f design|
|00003650| 3b 20 74 61 6b 65 20 74 | 68 69 73 20 63 68 65 63 |; take t|his chec|
|00003660| 6b 20 6f 75 74 20 69 66 | 20 79 6f 75 20 77 61 6e |k out if| you wan|
|00003670| 74 20 74 68 65 20 6f 63 | 63 61 73 69 6f 6e 61 6c |t the oc|casional|
|00003680| 20 77 61 6c 6c 0a 58 68 | 75 67 67 65 72 2e 20 20 | wall.Xh|ugger. |
|00003690| 54 68 65 20 64 6f 75 62 | 6c 65 20 6c 6f 6f 70 20 |The doub|le loop |
|000036a0| 6f 6e 20 6a 20 61 6e 64 | 20 6b 20 69 73 20 63 6f |on j and| k is co|
|000036b0| 6d 70 61 72 69 6e 67 20 | 6e 65 69 67 68 62 6f 72 |mparing |neighbor|
|000036c0| 73 2c 20 77 68 65 72 65 | 20 74 68 65 79 0a 58 65 |s, where| they.Xe|
|000036d0| 78 69 73 74 2c 20 6c 6f | 6f 6b 69 6e 67 20 66 6f |xist, lo|oking fo|
|000036e0| 72 20 73 74 72 65 65 74 | 73 20 77 69 74 68 20 64 |r street|s with d|
|000036f0| 69 66 66 65 72 65 6e 74 | 20 6e 75 6d 62 65 72 73 |ifferent| numbers|
|00003700| 2e 20 0a 58 0a 58 54 6f | 20 61 76 6f 69 64 20 74 |. .X.XTo| avoid t|
|00003710| 72 79 69 6e 67 20 74 6f | 20 62 72 65 61 6b 20 6f |rying to| break o|
|00003720| 75 74 20 6f 66 20 61 20 | 64 6f 75 62 6c 65 20 6c |ut of a |double l|
|00003730| 6f 6f 70 2c 20 6e 6f 74 | 20 6f 6e 65 20 6f 66 20 |oop, not| one of |
|00003740| 43 27 73 20 73 74 72 6f | 6e 67 0a 58 70 6f 69 6e |C's stro|ng.Xpoin|
|00003750| 74 73 2c 20 61 6e 6f 74 | 68 65 72 20 74 72 69 63 |ts, anot|her tric|
|00003760| 6b 20 77 61 73 20 75 73 | 65 64 2e 20 20 54 68 65 |k was us|ed. The|
|00003770| 20 72 65 61 73 6f 6e 20 | 74 68 69 73 20 6c 6f 6f | reason |this loo|
|00003780| 70 20 64 6f 65 73 6e 27 | 74 20 6b 65 65 70 0a 58 |p doesn'|t keep.X|
|00003790| 74 72 79 69 6e 67 20 74 | 6f 20 6d 61 6b 65 20 61 |trying t|o make a|
|000037a0| 20 73 74 72 65 65 74 20 | 6f 75 74 20 6f 66 20 74 | street |out of t|
|000037b0| 68 65 20 63 68 6f 73 65 | 6e 20 63 65 6c 6c 20 61 |he chose|n cell a|
|000037c0| 66 74 65 72 20 69 74 20 | 68 61 73 20 64 6f 6e 65 |fter it |has done|
|000037d0| 20 73 6f 0a 58 6f 6e 63 | 65 20 69 73 20 74 68 61 | so.Xonc|e is tha|
|000037e0| 74 20 6d 61 6b 65 73 74 | 72 65 65 74 28 29 20 63 |t makest|reet() c|
|000037f0| 61 75 73 65 73 20 61 6c | 6c 20 74 68 65 20 61 64 |auses al|l the ad|
|00003800| 6a 61 63 65 6e 74 20 73 | 74 72 65 65 74 73 20 74 |jacent s|treets t|
|00003810| 6f 20 62 65 20 6d 65 72 | 67 65 64 0a 58 61 6e 64 |o be mer|ged.Xand|
|00003820| 20 68 61 76 65 20 74 68 | 65 20 73 61 6d 65 20 73 | have th|e same s|
|00003830| 74 72 65 65 74 20 6e 75 | 6d 62 65 72 2c 20 73 6f |treet nu|mber, so|
|00003840| 20 74 68 61 74 20 74 68 | 65 20 69 6e 6e 65 72 20 | that th|e inner |
|00003850| 69 66 20 74 65 73 74 20 | 61 6c 77 61 79 73 0a 58 |if test |always.X|
|00003860| 66 61 69 6c 73 20 61 66 | 74 65 72 20 74 68 65 20 |fails af|ter the |
|00003870| 66 69 72 73 74 20 73 75 | 63 63 65 73 73 2e 20 0a |first su|ccess. .|
|00003880| 58 0a 58 68 65 20 63 61 | 6c 6c 20 74 6f 20 6d 61 |X.Xhe ca|ll to ma|
|00003890| 6b 65 73 74 72 65 65 74 | 20 69 73 20 77 69 74 68 |kestreet| is with|
|000038a0| 20 61 20 66 6f 72 63 69 | 6e 67 20 61 63 74 75 61 | a forci|ng actua|
|000038b0| 6c 20 64 69 72 65 63 74 | 69 6f 6e 20 6c 61 73 74 |l direct|ion last|
|000038c0| 0a 58 70 61 72 61 6d 65 | 74 65 72 20 28 73 65 65 |.Xparame|ter (see|
|000038d0| 20 62 65 6c 6f 77 20 61 | 62 6f 75 74 20 63 68 65 | below a|bout che|
|000038e0| 61 70 64 69 72 29 20 73 | 6f 20 74 68 65 20 73 74 |apdir) s|o the st|
|000038f0| 72 65 65 74 20 69 73 20 | 61 6c 77 61 79 73 20 63 |reet is |always c|
|00003900| 72 65 61 74 65 64 0a 58 | 6f 6e 20 74 68 65 20 66 |reated.X|on the f|
|00003910| 69 72 73 74 20 74 72 79 | 2e 20 45 78 63 65 70 74 |irst try|. Except|
|00003920| 2c 20 74 68 61 74 20 69 | 66 20 74 68 65 20 73 74 |, that i|f the st|
|00003930| 72 65 65 74 20 69 73 20 | 61 20 6e 65 69 67 68 62 |reet is |a neighb|
|00003940| 6f 72 20 6f 66 20 61 6e | 0a 58 55 4e 55 53 45 44 |or of an|.XUNUSED|
|00003950| 20 63 65 6c 6c 2c 20 74 | 68 65 6e 20 74 68 65 20 | cell, t|hen the |
|00003960| 63 68 65 63 6b 20 61 74 | 20 74 68 65 20 76 65 72 |check at| the ver|
|00003970| 79 20 74 6f 70 20 6f 66 | 20 6d 61 6b 65 73 74 72 |y top of| makestr|
|00003980| 65 65 74 28 29 20 6d 65 | 61 6e 73 0a 58 69 6e 74 |eet() me|ans.Xint|
|00003990| 73 65 61 64 20 74 68 61 | 74 20 69 74 20 77 69 6c |sead tha|t it wil|
|000039a0| 6c 20 6e 65 76 65 72 20 | 62 65 20 6d 61 64 65 20 |l never |be made |
|000039b0| 69 6e 74 6f 20 61 20 73 | 74 72 65 65 74 2e 20 0a |into a s|treet. .|
|000039c0| 58 0a 58 54 68 65 20 64 | 6f 75 62 6c 65 20 6a 2c |X.XThe d|ouble j,|
|000039d0| 20 6b 20 6c 6f 6f 70 20 | 63 61 6e 20 74 68 75 73 | k loop |can thus|
|000039e0| 20 69 6e 20 65 69 74 68 | 65 72 20 63 61 73 65 20 | in eith|er case |
|000039f0| 73 61 66 65 6c 79 20 62 | 65 20 6c 65 74 20 72 75 |safely b|e let ru|
|00003a00| 6e 20 74 6f 0a 58 63 6f | 6d 70 6c 65 74 69 6f 6e |n to.Xco|mpletion|
|00003a10| 2c 20 73 69 6e 63 65 20 | 69 74 20 77 69 6c 6c 20 |, since |it will |
|00003a20| 6e 65 76 65 72 20 61 73 | 6b 20 6d 61 6b 65 73 74 |never as|k makest|
|00003a30| 72 65 65 74 28 29 20 74 | 6f 20 6d 61 6b 65 20 61 |reet() t|o make a|
|00003a40| 20 73 74 72 65 65 74 20 | 69 6e 74 6f 0a 58 61 20 | street |into.Xa |
|00003a50| 73 74 72 65 65 74 2e 20 | 20 4c 65 74 74 69 6e 67 |street. | Letting|
|00003a60| 20 69 74 20 73 70 69 6e | 20 74 68 72 6f 75 67 68 | it spin| through|
|00003a70| 20 74 6f 20 63 6f 6d 70 | 6c 65 74 69 6f 6e 20 69 | to comp|letion i|
|00003a80| 73 20 6e 6f 20 62 69 67 | 20 64 65 61 6c 20 73 69 |s no big| deal si|
|00003a90| 6e 63 65 0a 58 70 68 61 | 73 65 20 74 77 6f 20 69 |nce.Xpha|se two i|
|00003aa0| 73 20 61 20 76 65 72 79 | 20 6d 69 6e 6f 72 20 70 |s a very| minor p|
|00003ab0| 61 72 74 20 6f 66 20 74 | 68 65 20 6f 76 65 72 61 |art of t|he overa|
|00003ac0| 6c 6c 20 74 69 6d 65 20 | 69 6e 20 61 6e 79 20 63 |ll time |in any c|
|00003ad0| 61 73 65 2c 20 64 6f 69 | 6e 67 0a 58 6e 6f 20 72 |ase, doi|ng.Xno r|
|00003ae0| 61 6e 64 6f 6d 20 63 61 | 6c 6c 73 2e 20 0a 58 0a |andom ca|lls. .X.|
|00003af0| 58 54 68 65 20 6c 69 74 | 74 6c 65 20 74 72 69 63 |XThe lit|tle tric|
|00003b00| 6b 20 64 6f 77 6e 20 69 | 6e 73 69 64 65 20 74 68 |k down i|nside th|
|00003b10| 65 20 6c 6f 6f 70 20 77 | 69 74 68 20 63 68 65 61 |e loop w|ith chea|
|00003b20| 70 64 69 72 20 69 73 20 | 74 6f 20 61 64 6f 70 74 |pdir is |to adopt|
|00003b30| 20 74 68 65 0a 58 64 69 | 72 65 63 74 69 6f 6e 20 | the.Xdi|rection |
|00003b40| 6f 66 20 6f 6e 65 20 6f | 66 20 74 68 65 20 73 74 |of one o|f the st|
|00003b50| 72 65 65 74 73 20 77 68 | 65 74 68 65 72 20 74 68 |reets wh|ether th|
|00003b60| 69 73 20 63 65 6c 6c 20 | 63 6f 6e 74 69 6e 75 65 |is cell |continue|
|00003b70| 73 20 69 74 20 6f 72 20 | 6e 6f 74 2c 0a 58 61 6e |s it or |not,.Xan|
|00003b80| 64 20 74 68 65 20 73 65 | 63 6f 6e 64 20 6f 6e 65 |d the se|cond one|
|00003b90| 20 69 66 20 69 74 20 68 | 61 70 70 65 6e 73 20 74 | if it h|appens t|
|00003ba0| 6f 20 63 6f 6e 74 69 6e | 75 65 20 74 68 65 20 73 |o contin|ue the s|
|00003bb0| 74 72 65 65 74 2e 20 20 | 54 68 69 73 20 69 73 20 |treet. |This is |
|00003bc0| 6e 6f 74 0a 58 70 65 72 | 66 65 63 74 6c 79 20 66 |not.Xper|fectly f|
|00003bd0| 61 69 72 2c 20 62 75 74 | 20 69 74 20 64 6f 65 73 |air, but| it does|
|00003be0| 6e 27 74 20 73 65 65 6d | 20 74 6f 20 68 75 72 74 |n't seem| to hurt|
|00003bf0| 20 61 6e 79 74 68 69 6e | 67 2c 20 61 6e 64 20 77 | anythin|g, and w|
|00003c00| 69 74 68 20 61 74 0a 58 | 6c 65 61 73 74 20 74 77 |ith at.X|least tw|
|00003c10| 6f 20 73 69 64 65 73 20 | 61 6c 72 65 61 64 79 20 |o sides |already |
|00003c20| 73 74 72 65 65 74 73 2c | 20 74 68 69 73 20 63 65 |streets,| this ce|
|00003c30| 6c 6c 20 69 73 20 6c 65 | 73 73 20 6c 69 6b 65 6c |ll is le|ss likel|
|00003c40| 79 20 74 68 61 6e 20 6d | 61 6e 79 20 74 6f 0a 58 |y than m|any to.X|
|00003c50| 77 61 6e 74 20 74 6f 20 | 63 6f 6e 74 69 6e 75 65 |want to |continue|
|00003c60| 20 69 74 73 20 64 69 72 | 65 63 74 69 6f 6e 20 69 | its dir|ection i|
|00003c70| 6e 74 6f 20 61 20 73 75 | 62 73 65 71 75 65 6e 74 |nto a su|bsequent|
|00003c80| 6c 79 2d 73 74 61 72 74 | 65 64 2d 68 65 72 65 20 |ly-start|ed-here |
|00003c90| 61 6c 6c 65 79 0a 58 6f | 72 20 73 74 72 65 65 74 |alley.Xo|r street|
|00003ca0| 2e 0a 58 0a 58 54 68 65 | 20 74 68 69 72 64 20 70 |..X.XThe| third p|
|00003cb0| 68 61 73 65 20 69 73 20 | 6d 75 63 68 20 6c 69 6b |hase is |much lik|
|00003cc0| 65 20 74 68 65 20 66 69 | 72 73 74 2c 20 65 78 63 |e the fi|rst, exc|
|00003cd0| 65 70 74 20 74 68 61 74 | 20 6e 6f 77 20 74 68 65 |ept that| now the|
|00003ce0| 20 44 45 41 44 20 6c 69 | 73 74 0a 58 69 73 20 62 | DEAD li|st.Xis b|
|00003cf0| 65 69 6e 67 20 72 61 6e | 64 6f 6d 6c 79 20 75 73 |eing ran|domly us|
|00003d00| 65 64 20 74 6f 20 65 78 | 74 65 6e 64 20 74 68 65 |ed to ex|tend the|
|00003d10| 20 73 74 72 65 65 74 73 | 2c 20 72 61 74 68 65 72 | streets|, rather|
|00003d20| 20 74 68 61 6e 20 74 68 | 65 20 6c 69 76 65 0a 58 | than th|e live.X|
|00003d30| 6c 69 73 74 2e 20 20 54 | 68 69 73 20 74 65 6e 64 |list. T|his tend|
|00003d40| 73 20 74 6f 20 6d 61 6b | 65 20 74 68 65 20 74 6f |s to mak|e the to|
|00003d50| 77 6e 20 6d 61 7a 65 20 | 6d 6f 72 65 20 6f 70 65 |wn maze |more ope|
|00003d60| 6e 2c 20 61 6e 64 20 74 | 6f 20 64 65 73 74 72 6f |n, and t|o destro|
|00003d70| 79 20 74 68 65 0a 58 62 | 61 63 6b 20 74 6f 20 62 |y the.Xb|ack to b|
|00003d80| 61 63 6b 20 72 6f 6f 6d | 73 20 74 68 61 74 20 61 |ack room|s that a|
|00003d90| 72 65 20 74 68 65 20 77 | 68 6f 6c 65 20 67 6f 61 |re the w|hole goa|
|00003da0| 6c 20 6f 66 20 74 6f 77 | 6e 6d 61 7a 65 2c 20 62 |l of tow|nmaze, b|
|00003db0| 75 74 20 69 74 20 69 73 | 0a 58 73 6f 6d 65 74 69 |ut it is|.Xsometi|
|00003dc0| 6d 65 73 20 74 68 65 20 | 6f 6e 6c 79 20 77 61 79 |mes the |only way|
|00003dd0| 20 74 6f 20 22 6d 61 6b | 65 20 65 6e 64 73 20 6d | to "mak|e ends m|
|00003de0| 65 65 74 22 20 61 6e 64 | 20 67 65 74 20 61 6c 6c |eet" and| get all|
|00003df0| 20 74 68 65 20 73 74 72 | 65 65 74 73 0a 58 63 6f | the str|eets.Xco|
|00003e00| 6e 6e 65 63 74 65 64 2c | 20 61 6e 20 61 62 73 6f |nnected,| an abso|
|00003e10| 6c 75 74 65 20 72 65 71 | 75 69 72 65 6d 65 6e 74 |lute req|uirement|
|00003e20| 2e 20 66 6f 72 20 74 6f | 77 6e 6d 61 7a 65 2e 20 |. for to|wnmaze. |
|00003e30| 20 54 68 65 20 6f 6e 6c | 79 20 64 69 66 66 65 72 | The onl|y differ|
|00003e40| 65 6e 63 65 0a 58 66 72 | 6f 6d 20 74 68 65 20 66 |ence.Xfr|om the f|
|00003e50| 69 72 73 74 20 70 68 61 | 73 65 20 69 73 20 74 68 |irst pha|se is th|
|00003e60| 61 74 2c 20 75 6e 6c 69 | 6b 65 20 4c 49 56 45 20 |at, unli|ke LIVE |
|00003e70| 63 65 6c 6c 73 2c 20 77 | 68 69 63 68 20 61 72 65 |cells, w|hich are|
|00003e80| 20 61 6c 77 61 79 73 0a | 58 69 6e 74 65 72 69 6f | always.|Xinterio|
|00003e90| 72 20 28 74 6f 20 6b 65 | 65 70 20 74 68 65 20 73 |r (to ke|ep the s|
|00003ea0| 74 72 65 65 74 73 20 66 | 72 6f 6d 20 72 75 6e 6e |treets f|rom runn|
|00003eb0| 69 6e 67 20 64 6f 77 6e | 20 74 68 65 20 63 69 74 |ing down| the cit|
|00003ec0| 79 20 77 61 6c 6c 20 61 | 67 61 69 6e 29 2c 0a 58 |y wall a|gain),.X|
|00003ed0| 44 45 41 44 20 63 65 6c | 6c 73 20 6d 61 79 20 62 |DEAD cel|ls may b|
|00003ee0| 65 20 62 6f 72 64 65 72 | 20 63 65 6c 6c 73 2c 20 |e border| cells, |
|00003ef0| 61 6e 64 20 77 65 20 77 | 61 6e 74 20 65 78 70 6c |and we w|ant expl|
|00003f00| 69 63 69 74 6c 79 20 74 | 6f 20 65 78 63 6c 75 64 |icitly t|o exclud|
|00003f10| 65 20 74 68 65 0a 58 62 | 6f 72 64 65 72 20 63 65 |e the.Xb|order ce|
|00003f20| 6c 6c 73 20 66 72 6f 6d | 20 63 6f 6e 73 69 64 65 |lls from| conside|
|00003f30| 72 61 74 69 6f 6e 20 66 | 6f 72 20 65 78 74 65 6e |ration f|or exten|
|00003f40| 64 69 6e 67 20 74 68 65 | 20 73 74 72 65 65 74 73 |ding the| streets|
|00003f50| 2e 0a 58 0a 58 0a 58 2d | 2d 2d 2d 2d 2d 2d 2d 2d |..X.X.X-|--------|
|00003f60| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00003f70| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00003f80| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00003f90| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 0a 58 |--------|------.X|
|00003fa0| 7c 20 66 69 6c 6c 6c 69 | 73 74 2e 63 20 2d 2d 20 || fillli|st.c -- |
|00003fb0| 66 69 6c 6c 6c 69 73 74 | 28 29 0a 58 2d 2d 2d 2d |filllist|().X----|
|00003fc0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00003fd0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00003fe0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00003ff0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00004000| 2d 2d 2d 0a 58 0a 58 54 | 68 69 73 20 72 6f 75 74 |---.X.XT|his rout|
|00004010| 69 6e 65 20 64 6f 65 73 | 20 68 61 6c 66 20 6f 66 |ine does| half of|
|00004020| 20 73 74 65 70 20 33 29 | 2c 20 61 62 6f 76 65 2e | step 3)|, above.|
|00004030| 20 20 54 68 69 73 20 66 | 75 6e 63 74 69 6f 6e 20 | This f|unction |
|00004040| 74 61 6b 65 73 20 74 68 | 65 20 72 61 77 0a 58 73 |takes th|e raw.Xs|
|00004050| 70 61 63 65 20 61 6c 6c | 6f 63 61 74 65 64 20 66 |pace all|ocated f|
|00004060| 6f 72 20 73 74 61 74 6c | 69 73 74 20 62 79 20 6d |or statl|ist by m|
|00004070| 61 6b 65 73 70 61 63 65 | 28 29 2c 20 61 6e 64 20 |akespace|(), and |
|00004080| 74 75 72 6e 73 20 69 74 | 20 69 6e 74 6f 20 61 6e |turns it| into an|
|00004090| 0a 58 61 72 72 61 79 20 | 77 68 69 63 68 20 69 73 |.Xarray |which is|
|000040a0| 20 61 6c 73 6f 20 66 69 | 76 65 20 64 6f 75 62 6c | also fi|ve doubl|
|000040b0| 79 20 6c 69 6e 6b 65 64 | 20 6c 69 73 74 73 2c 20 |y linked| lists, |
|000040c0| 61 6c 6c 20 62 75 74 20 | 74 68 65 20 49 53 4f 4c |all but |the ISOL|
|000040d0| 41 54 45 44 0a 58 6c 69 | 73 74 20 65 6d 70 74 79 |ATED.Xli|st empty|
|000040e0| 20 61 6e 64 20 77 69 74 | 68 20 6c 69 73 74 20 68 | and wit|h list h|
|000040f0| 65 61 64 73 20 73 65 74 | 20 74 6f 20 4e 4f 50 4f |eads set| to NOPO|
|00004100| 49 4e 54 45 52 2c 20 61 | 6e 64 20 6c 69 73 74 20 |INTER, a|nd list |
|00004110| 63 6f 75 6e 74 73 20 73 | 65 74 0a 58 74 6f 20 7a |counts s|et.Xto z|
|00004120| 65 72 6f 2c 20 74 6f 20 | 73 74 61 72 74 2e 20 20 |ero, to |start. |
|00004130| 54 68 65 20 49 53 4f 4c | 41 54 45 44 20 6c 69 73 |The ISOL|ATED lis|
|00004140| 74 20 63 6f 75 6e 74 20 | 69 73 20 73 65 74 20 74 |t count |is set t|
|00004150| 6f 20 6c 69 73 74 73 69 | 7a 65 2c 20 61 6e 64 0a |o listsi|ze, and.|
|00004160| 58 74 68 65 20 6c 69 73 | 74 20 68 65 61 64 65 72 |Xthe lis|t header|
|00004170| 20 70 6f 69 6e 74 69 6e | 67 20 74 6f 20 74 68 65 | pointin|g to the|
|00004180| 20 7a 65 72 6f 74 68 20 | 65 6c 65 6d 65 6e 74 20 | zeroth |element |
|00004190| 6f 66 20 73 74 61 74 6c | 69 73 74 2e 20 20 4a 75 |of statl|ist. Ju|
|000041a0| 73 74 20 61 74 0a 58 74 | 68 65 20 65 6e 64 20 69 |st at.Xt|he end i|
|000041b0| 74 20 70 75 74 73 20 74 | 68 65 20 66 6f 75 72 20 |t puts t|he four |
|000041c0| 63 6f 72 6e 65 72 20 63 | 65 6c 6c 73 20 69 6e 74 |corner c|ells int|
|000041d0| 6f 20 74 68 65 20 55 4e | 55 53 45 44 20 6c 69 73 |o the UN|USED lis|
|000041e0| 74 20 75 73 69 6e 67 0a | 58 6d 6f 76 65 66 72 6f |t using.|Xmovefro|
|000041f0| 6d 74 6f 28 29 2c 20 61 | 6e 64 20 73 65 74 73 20 |mto(), a|nd sets |
|00004200| 74 68 65 20 73 74 72 65 | 65 74 6e 75 6d 63 74 20 |the stre|etnumct |
|00004210| 74 6f 20 7a 65 72 6f 20 | 28 69 74 20 6e 65 65 64 |to zero |(it need|
|00004220| 65 64 20 74 6f 20 62 65 | 20 64 6f 6e 65 0a 58 73 |ed to be| done.Xs|
|00004230| 6f 6d 65 77 68 65 72 65 | 20 69 6e 20 73 65 74 75 |omewhere| in setu|
|00004240| 70 2c 20 6f 72 20 73 74 | 61 74 69 63 20 73 65 74 |p, or st|atic set|
|00004250| 20 74 68 65 72 65 2c 20 | 61 6e 64 20 49 20 70 72 | there, |and I pr|
|00004260| 65 66 65 72 20 74 68 65 | 20 73 65 6c 66 0a 58 64 |efer the| self.Xd|
|00004270| 6f 63 75 6d 65 6e 74 61 | 74 69 6f 6e 20 6f 66 20 |ocumenta|tion of |
|00004280| 61 6e 20 65 78 70 6c 69 | 63 69 74 20 61 63 74 69 |an expli|cit acti|
|00004290| 6f 6e 29 2e 20 0a 58 0a | 58 0a 58 2d 2d 2d 2d 2d |on). .X.|X.X-----|
|000042a0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000042b0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000042c0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000042d0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000042e0| 2d 2d 0a 58 7c 20 66 69 | 6c 6c 6d 61 7a 65 2e 63 |--.X| fi|llmaze.c|
|000042f0| 20 2d 2d 20 66 69 6c 6c | 6d 61 7a 65 28 29 0a 58 | -- fill|maze().X|
|00004300| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00004310| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00004320| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00004330| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00004340| 2d 2d 2d 2d 2d 2d 2d 0a | 58 0a 58 0a 58 54 68 69 |-------.|X.X.XThi|
|00004350| 73 20 72 6f 75 74 69 6e | 65 20 64 6f 65 73 20 74 |s routin|e does t|
|00004360| 68 65 20 6f 74 68 65 72 | 20 68 61 6c 66 20 6f 66 |he other| half of|
|00004370| 20 73 74 65 70 20 33 29 | 2c 20 61 62 6f 76 65 2e | step 3)|, above.|
|00004380| 20 20 54 68 69 73 20 66 | 75 6e 63 74 69 6f 6e 0a | This f|unction.|
|00004390| 58 6d 61 6b 65 73 20 65 | 76 65 72 79 20 65 76 65 |Xmakes e|very eve|
|000043a0| 6e 20 28 7a 65 72 6f 20 | 6f 72 69 67 69 6e 2c 20 |n (zero |origin, |
|000043b0| 72 65 6d 65 6d 62 65 72 | 29 20 72 6f 77 20 61 6e |remember|) row an|
|000043c0| 64 20 63 6f 6c 75 6d 6e | 20 6f 66 20 74 68 65 20 |d column| of the |
|000043d0| 63 6d 61 7a 65 0a 58 63 | 68 61 72 61 63 74 65 72 |cmaze.Xc|haracter|
|000043e0| 20 61 72 72 61 79 20 61 | 20 57 41 4c 4c 20 73 79 | array a| WALL sy|
|000043f0| 6d 62 6f 6c 2c 20 61 6e | 64 20 74 68 65 20 72 65 |mbol, an|d the re|
|00004400| 6d 61 69 6e 69 6e 67 20 | 64 6f 75 62 6c 79 20 6f |maining |doubly o|
|00004410| 64 64 20 63 6f 6f 72 64 | 69 6e 61 74 65 0a 58 69 |dd coord|inate.Xi|
|00004420| 6e 74 65 72 73 74 69 63 | 65 73 20 42 4c 41 4e 4b |nterstic|es BLANK|
|00004430| 20 73 79 6d 62 6f 6c 73 | 2c 20 61 6e 64 20 61 74 | symbols|, and at|
|00004440| 20 74 68 65 20 65 6e 64 | 20 66 69 6c 6c 73 20 69 | the end| fills i|
|00004450| 6e 20 57 41 4c 4c 20 73 | 79 6d 62 6f 6c 73 20 69 |n WALL s|ymbols i|
|00004460| 6e 20 74 68 65 0a 58 66 | 6f 75 72 20 63 6f 72 6e |n the.Xf|our corn|
|00004470| 65 72 20 63 65 6c 6c 73 | 27 20 63 65 6e 74 65 72 |er cells|' center|
|00004480| 73 20 74 6f 20 6d 61 6b | 65 20 74 68 65 6d 20 55 |s to mak|e them U|
|00004490| 4e 55 53 45 44 20 6c 6f | 6f 6b 69 6e 67 2e 20 0a |NUSED lo|oking. .|
|000044a0| 58 0a 58 0a 58 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |X.X.X---|--------|
|000044b0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000044c0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000044d0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000044e0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 0a 58 7c 20 |--------|----.X| |
|000044f0| 66 69 6e 69 73 68 61 6c | 6c 65 79 73 2e 63 20 2d |finishal|leys.c -|
|00004500| 2d 20 66 69 6e 69 73 68 | 61 6c 6c 65 79 73 28 29 |- finish|alleys()|
|00004510| 0a 58 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |.X------|--------|
|00004520| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00004530| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00004540| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00004550| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 0a 58 0a 58 54 68 69 |--------|-.X.XThi|
|00004560| 73 20 69 73 20 74 68 65 | 20 72 6f 75 74 69 6e 65 |s is the| routine|
|00004570| 20 74 68 61 74 20 61 63 | 63 6f 6d 70 6c 69 73 68 | that ac|complish|
|00004580| 65 73 20 73 74 65 70 20 | 36 29 2c 20 61 62 6f 76 |es step |6), abov|
|00004590| 65 2e 20 20 41 66 74 65 | 72 0a 58 63 6f 6e 6e 65 |e. Afte|r.Xconne|
|000045a0| 63 74 73 74 72 65 65 74 | 73 28 29 20 68 61 73 20 |ctstreet|s() has |
|000045b0| 6d 61 64 65 20 73 75 72 | 65 20 74 68 61 74 20 61 |made sur|e that a|
|000045c0| 6c 6c 20 74 68 65 20 73 | 74 72 65 65 74 73 20 69 |ll the s|treets i|
|000045d0| 6e 20 74 6f 77 6e 20 61 | 72 65 0a 58 69 6e 74 65 |n town a|re.Xinte|
|000045e0| 72 63 6f 6e 6e 65 63 74 | 65 64 2c 20 74 68 65 72 |rconnect|ed, ther|
|000045f0| 65 20 6d 61 79 20 73 74 | 69 6c 6c 20 62 65 20 49 |e may st|ill be I|
|00004600| 53 4f 4c 41 54 45 44 20 | 28 61 6e 64 20 74 68 75 |SOLATED |(and thu|
|00004610| 73 20 4c 49 56 45 29 20 | 63 65 6c 6c 73 0a 58 72 |s LIVE) |cells.Xr|
|00004620| 65 6d 61 69 6e 69 6e 67 | 2e 20 20 54 68 69 73 20 |emaining|. This |
|00004630| 72 6f 75 74 69 6e 65 20 | 63 6f 6e 74 69 6e 75 65 |routine |continue|
|00004640| 73 20 74 6f 20 74 75 72 | 6e 20 4c 49 56 45 20 63 |s to tur|n LIVE c|
|00004650| 65 6c 6c 73 20 69 6e 74 | 6f 20 73 74 72 65 65 74 |ells int|o street|
|00004660| 73 2c 0a 58 61 6e 64 20 | 74 68 75 73 20 49 53 4f |s,.Xand |thus ISO|
|00004670| 4c 41 54 45 44 20 63 65 | 6c 6c 73 20 69 6e 74 6f |LATED ce|lls into|
|00004680| 20 4c 49 56 45 20 6f 72 | 20 44 45 41 44 20 63 65 | LIVE or| DEAD ce|
|00004690| 6c 6c 73 20 61 6e 64 20 | 70 6f 73 73 69 62 6c 65 |lls and |possible|
|000046a0| 0a 58 63 6f 6e 73 65 71 | 75 65 6e 74 6c 79 20 4c |.Xconseq|uently L|
|000046b0| 49 56 45 20 63 65 6c 6c | 73 20 69 6e 74 6f 20 44 |IVE cell|s into D|
|000046c0| 45 41 44 20 63 65 6c 6c | 73 20 28 66 72 6f 6d 20 |EAD cell|s (from |
|000046d0| 6c 61 63 6b 20 6f 66 20 | 61 20 6e 65 69 67 68 62 |lack of |a neighb|
|000046e0| 6f 72 69 6e 67 0a 58 49 | 53 4f 4c 41 54 45 44 20 |oring.XI|SOLATED |
|000046f0| 63 65 6c 6c 20 61 6e 64 | 20 6d 6f 72 65 29 20 75 |cell and| more) u|
|00004700| 6e 74 69 6c 20 6e 6f 20 | 4c 49 56 45 20 6f 72 20 |ntil no |LIVE or |
|00004710| 49 53 4f 4c 41 54 45 44 | 20 63 65 6c 6c 73 20 72 |ISOLATED| cells r|
|00004720| 65 6d 61 69 6e 2e 20 0a | 58 0a 58 54 68 69 73 20 |emain. .|X.XThis |
|00004730| 77 6f 72 6b 73 20 6a 75 | 73 74 20 6c 69 6b 65 20 |works ju|st like |
|00004740| 74 68 65 20 66 69 72 73 | 74 20 70 68 61 73 65 20 |the firs|t phase |
|00004750| 6f 66 20 63 6f 6e 6e 65 | 63 74 73 74 72 65 65 74 |of conne|ctstreet|
|00004760| 73 28 29 2c 20 65 78 63 | 65 70 74 20 74 68 61 74 |s(), exc|ept that|
|00004770| 0a 58 69 74 20 69 73 20 | 6e 6f 20 6c 6f 6e 67 65 |.Xit is |no longe|
|00004780| 72 20 63 6f 6e 64 69 74 | 69 6f 6e 65 64 20 6f 6e |r condit|ioned on|
|00004790| 20 73 74 72 65 65 74 6e | 75 6d 63 74 20 3e 20 31 | streetn|umct > 1|
|000047a0| 2c 20 6a 75 73 74 20 6f | 6e 20 6c 69 76 65 63 74 |, just o|n livect|
|000047b0| 20 3e 20 30 2e 20 0a 58 | 0a 58 5b 42 79 20 74 68 | > 0. .X|.X[By th|
|000047c0| 65 20 77 61 79 2c 20 74 | 68 65 72 65 27 73 20 6e |e way, t|here's n|
|000047d0| 6f 20 73 70 65 63 69 61 | 6c 20 73 69 67 6e 69 66 |o specia|l signif|
|000047e0| 69 63 61 6e 63 65 20 74 | 6f 20 22 61 6c 6c 65 79 |icance t|o "alley|
|000047f0| 73 22 20 61 73 20 6f 70 | 70 6f 73 65 64 20 74 6f |s" as op|posed to|
|00004800| 0a 58 22 73 74 72 65 65 | 74 73 22 2c 20 74 68 65 |.X"stree|ts", the|
|00004810| 20 6e 61 6d 65 20 6a 75 | 73 74 20 73 65 65 6d 65 | name ju|st seeme|
|00004820| 64 20 68 6f 6d 65 79 65 | 72 2e 5d 0a 58 0a 58 0a |d homeye|r.].X.X.|
|00004830| 58 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |X-------|--------|
|00004840| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00004850| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00004860| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00004870| 2d 2d 2d 2d 2d 2d 2d 2d | 0a 58 7c 20 66 72 65 65 |--------|.X| free|
|00004880| 73 70 61 63 65 2e 63 20 | 2d 2d 20 66 72 65 65 73 |space.c |-- frees|
|00004890| 70 61 63 65 28 29 0a 58 | 2d 2d 2d 2d 2d 2d 2d 2d |pace().X|--------|
|000048a0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000048b0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000048c0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000048d0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 0a |--------|-------.|
|000048e0| 58 0a 58 54 68 69 73 20 | 72 6f 75 74 69 6e 65 20 |X.XThis |routine |
|000048f0| 64 6f 65 73 20 73 74 65 | 70 20 31 31 29 2c 20 61 |does ste|p 11), a|
|00004900| 62 6f 76 65 2e 20 20 53 | 69 67 68 2e 20 20 54 68 |bove. S|igh. Th|
|00004910| 65 72 65 20 72 65 61 6c | 6c 79 20 6f 75 67 68 74 |ere real|ly ought|
|00004920| 20 74 6f 20 62 65 20 61 | 0a 58 6c 69 62 72 61 72 | to be a|.Xlibrar|
|00004930| 79 20 72 6f 75 74 69 6e | 65 20 74 6f 20 61 6c 6c |y routin|e to all|
|00004940| 6f 63 61 74 65 2c 20 61 | 6e 64 20 61 6e 6f 74 68 |ocate, a|nd anoth|
|00004950| 65 72 20 74 6f 20 66 72 | 65 65 2c 20 74 68 65 20 |er to fr|ee, the |
|00004960| 75 67 6c 79 20 6d 65 73 | 73 65 73 20 43 0a 58 75 |ugly mes|ses C.Xu|
|00004970| 73 65 73 20 66 6f 72 20 | 6d 75 6c 74 69 64 69 6d |ses for |multidim|
|00004980| 65 6e 73 69 6f 6e 61 6c | 20 61 72 72 61 79 73 2e |ensional| arrays.|
|00004990| 20 20 53 6f 20 66 61 72 | 20 61 73 20 49 20 63 61 | So far| as I ca|
|000049a0| 6e 20 66 69 67 75 72 65 | 2c 20 79 6f 75 20 63 61 |n figure|, you ca|
|000049b0| 6e 0a 58 61 6c 6c 6f 63 | 61 74 65 20 61 20 66 69 |n.Xalloc|ate a fi|
|000049c0| 78 65 64 20 73 69 7a 65 | 20 61 72 72 61 79 20 77 |xed size| array w|
|000049d0| 69 74 68 6f 75 74 20 74 | 68 65 20 69 6e 74 65 72 |ithout t|he inter|
|000049e0| 6d 65 64 69 61 74 65 20 | 70 6f 69 6e 74 65 72 20 |mediate |pointer |
|000049f0| 6c 69 73 74 20 6f 6e 6c | 79 0a 58 61 74 20 63 6f |list onl|y.Xat co|
|00004a00| 6d 70 69 6c 65 20 74 69 | 6d 65 2c 20 73 69 6e 63 |mpile ti|me, sinc|
|00004a10| 65 20 74 68 65 72 65 20 | 69 73 20 6e 6f 20 77 61 |e there |is no wa|
|00004a20| 79 20 74 6f 20 63 6f 6e | 76 69 6e 63 65 20 74 68 |y to con|vince th|
|00004a30| 65 20 63 6f 6d 70 69 6c | 65 64 20 63 6f 64 65 0a |e compil|ed code.|
|00004a40| 58 61 74 20 72 75 6e 20 | 74 69 6d 65 20 74 68 61 |Xat run |time tha|
|00004a50| 74 20 69 74 20 6b 6e 6f | 77 73 20 74 68 65 20 6d |t it kno|ws the m|
|00004a60| 61 6a 6f 72 20 64 69 6d | 65 6e 73 69 6f 6e 2c 20 |ajor dim|ension, |
|00004a70| 73 6f 20 72 65 67 75 6c | 61 72 20 69 6e 64 65 78 |so regul|ar index|
|00004a80| 69 6e 67 0a 58 77 6f 6e | 27 74 20 77 6f 72 6b 20 |ing.Xwon|'t work |
|00004a90| 66 6f 72 20 61 6e 20 61 | 72 72 61 79 20 64 79 6e |for an a|rray dyn|
|00004aa0| 61 6d 69 63 61 6c 6c 79 | 20 61 6c 6c 6f 63 61 74 |amically| allocat|
|00004ab0| 65 64 20 69 6e 74 6f 20 | 61 6e 20 61 72 72 61 79 |ed into |an array|
|00004ac0| 20 64 65 63 6c 61 72 65 | 64 0a 58 22 63 6d 61 7a | declare|d.X"cmaz|
|00004ad0| 65 5b 5d 5b 5d 22 2c 20 | 61 6e 64 20 74 68 65 20 |e[][]", |and the |
|00004ae0| 63 6f 6d 70 69 6c 65 72 | 20 63 6f 6d 70 6c 61 69 |compiler| complai|
|00004af0| 6e 73 20 69 66 20 79 6f | 75 20 74 72 79 2e 20 0a |ns if yo|u try. .|
|00004b00| 58 0a 58 49 6e 20 61 6e | 79 20 63 61 73 65 2c 20 |X.XIn an|y case, |
|00004b10| 74 68 69 73 20 64 6f 65 | 73 20 74 68 65 20 73 74 |this doe|s the st|
|00004b20| 61 6e 64 61 72 64 20 73 | 74 75 66 66 20 74 6f 20 |andard s|tuff to |
|00004b30| 67 69 76 65 20 62 61 63 | 6b 20 74 68 65 20 73 74 |give bac|k the st|
|00004b40| 6f 72 61 67 65 20 66 6f | 72 0a 58 73 74 61 74 6c |orage fo|r.Xstatl|
|00004b50| 69 73 74 20 61 6e 64 20 | 63 6d 61 7a 65 2e 20 20 |ist and |cmaze. |
|00004b60| 4f 6e 20 61 20 55 6e 69 | 78 20 62 6f 78 20 74 68 |On a Uni|x box th|
|00004b70| 69 73 20 69 73 20 65 78 | 63 65 73 73 69 76 65 20 |is is ex|cessive |
|00004b80| 6e 65 61 74 6e 65 73 73 | 2c 20 62 75 74 20 6f 6e |neatness|, but on|
|00004b90| 0a 58 61 6e 20 41 6d 69 | 67 61 20 74 68 61 74 20 |.Xan Ami|ga that |
|00004ba0| 64 6f 65 73 6e 27 74 20 | 64 6f 20 72 65 73 6f 75 |doesn't |do resou|
|00004bb0| 72 63 65 20 74 72 61 63 | 6b 69 6e 67 2c 20 74 68 |rce trac|king, th|
|00004bc0| 69 73 20 69 73 20 6d 61 | 6e 64 61 74 6f 72 79 20 |is is ma|ndatory |
|00004bd0| 74 6f 20 61 76 6f 69 64 | 0a 58 22 6c 65 61 6b 69 |to avoid|.X"leaki|
|00004be0| 6e 67 22 20 6d 65 6d 6f | 72 79 20 61 6e 64 20 66 |ng" memo|ry and f|
|00004bf0| 6f 72 63 69 6e 67 20 61 | 6e 20 65 76 65 6e 74 75 |orcing a|n eventu|
|00004c00| 61 6c 20 72 65 62 6f 6f | 74 2e 20 0a 58 0a 58 45 |al reboo|t. .X.XE|
|00004c10| 72 72 6f 72 20 63 68 65 | 63 6b 69 6e 67 20 69 73 |rror che|cking is|
|00004c20| 20 64 6f 6e 65 20 6f 6e | 20 74 68 65 20 66 72 65 | done on| the fre|
|00004c30| 65 28 29 20 63 61 6c 6c | 73 3b 20 49 20 64 6f 6e |e() call|s; I don|
|00004c40| 27 74 20 68 61 76 65 20 | 61 6e 79 20 72 65 63 6f |'t have |any reco|
|00004c50| 75 72 73 65 0a 58 69 66 | 20 61 6e 20 65 72 72 6f |urse.Xif| an erro|
|00004c60| 72 20 6f 63 63 75 72 73 | 20 69 6e 20 61 6e 79 20 |r occurs| in any |
|00004c70| 63 61 73 65 2c 20 62 75 | 74 20 61 74 20 6c 65 61 |case, bu|t at lea|
|00004c80| 73 74 20 49 20 63 61 6e | 20 63 6f 6d 70 6c 61 69 |st I can| complai|
|00004c90| 6e 20 62 65 66 6f 72 65 | 0a 58 64 79 69 6e 67 2e |n before|.Xdying.|
|00004ca0| 20 0a 58 0a 58 0a 58 2d | 2d 2d 2d 2d 2d 2d 2d 2d | .X.X.X-|--------|
|00004cb0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00004cc0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00004cd0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00004ce0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 0a 58 |--------|------.X|
|00004cf0| 7c 20 67 65 74 61 72 67 | 73 2e 63 0a 58 2d 2d 2d || getarg|s.c.X---|
|00004d00| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00004d10| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00004d20| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00004d30| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00004d40| 2d 2d 2d 2d 0a 58 0a 58 | 54 68 69 73 20 72 6f 75 |----.X.X|This rou|
|00004d50| 74 69 6e 65 20 61 63 63 | 6f 6d 70 6c 69 73 68 65 |tine acc|omplishe|
|00004d60| 73 20 73 74 65 70 20 31 | 29 20 61 62 6f 76 65 2e |s step 1|) above.|
|00004d70| 20 20 53 69 67 68 20 61 | 67 61 69 6e 2e 20 20 4c | Sigh a|gain. L|
|00004d80| 61 74 74 69 63 65 20 43 | 20 66 6f 72 0a 58 74 68 |attice C| for.Xth|
|00004d90| 65 20 41 6d 69 67 61 20 | 64 6f 65 73 6e 27 74 20 |e Amiga |doesn't |
|00004da0| 68 61 76 65 20 67 65 74 | 6f 70 74 73 28 29 20 61 |have get|opts() a|
|00004db0| 73 20 61 20 6c 69 62 72 | 61 72 79 20 72 6f 75 74 |s a libr|ary rout|
|00004dc0| 69 6e 65 2c 20 73 6f 20 | 49 20 77 72 6f 74 65 20 |ine, so |I wrote |
|00004dd0| 74 68 69 73 0a 58 73 70 | 65 63 69 61 6c 20 70 75 |this.Xsp|ecial pu|
|00004de0| 72 70 6f 73 65 20 62 65 | 61 73 74 2e 20 20 54 6f |rpose be|ast. To|
|00004df0| 20 61 76 6f 69 64 20 69 | 6e 74 65 6e 73 65 6c 79 | avoid i|ntensely|
|00004e00| 20 75 67 6c 79 20 63 6f | 64 65 2c 20 74 68 65 20 | ugly co|de, the |
|00004e10| 6e 69 63 65 0a 58 67 65 | 74 6f 70 74 73 28 29 20 |nice.Xge|topts() |
|00004e20| 66 65 61 74 75 72 65 20 | 6f 66 20 61 63 63 65 70 |feature |of accep|
|00004e30| 74 69 6e 67 20 62 6f 74 | 68 20 73 70 61 63 65 73 |ting bot|h spaces|
|00004e40| 20 61 6e 64 20 6e 6f 20 | 73 70 61 63 65 73 20 62 | and no |spaces b|
|00004e50| 65 74 77 65 65 6e 20 74 | 68 65 0a 58 66 6c 61 67 |etween t|he.Xflag|
|00004e60| 20 61 6e 64 20 74 68 65 | 20 76 61 6c 75 65 20 69 | and the| value i|
|00004e70| 73 20 66 6f 72 65 67 6f | 6e 65 20 68 65 72 65 3b |s forego|ne here;|
|00004e80| 20 49 20 6a 75 73 74 20 | 64 6f 6e 27 74 20 68 61 | I just |don't ha|
|00004e90| 76 65 20 74 68 61 74 20 | 6d 75 63 68 0a 58 70 61 |ve that |much.Xpa|
|00004ea0| 74 69 65 6e 63 65 2e 20 | 20 4c 65 61 76 69 6e 67 |tience. | Leaving|
|00004eb0| 20 74 68 65 20 73 70 61 | 63 65 20 6f 6e 6c 79 20 | the spa|ce only |
|00004ec0| 6f 70 74 69 6f 6e 20 6d | 61 6b 65 73 20 74 68 69 |option m|akes thi|
|00004ed0| 73 20 63 6f 64 65 20 6e | 65 61 74 20 61 6e 64 0a |s code n|eat and.|
|00004ee0| 58 65 61 73 79 2e 20 0a | 58 0a 58 54 68 65 20 72 |Xeasy. .|X.XThe r|
|00004ef0| 6f 75 74 69 6e 65 20 73 | 74 61 72 74 73 20 62 79 |outine s|tarts by|
|00004f00| 20 63 68 65 63 6b 69 6e | 67 20 66 6f 72 20 61 6e | checkin|g for an|
|00004f10| 79 20 61 72 67 75 6d 65 | 6e 74 73 2c 20 61 6e 64 |y argume|nts, and|
|00004f20| 20 69 66 20 6e 6f 6e 65 | 20 6a 75 73 74 0a 58 67 | if none| just.Xg|
|00004f30| 6f 65 73 20 64 6f 77 6e | 20 74 6f 20 63 6f 6d 70 |oes down| to comp|
|00004f40| 75 74 65 20 6c 69 73 74 | 73 69 7a 65 20 61 6e 64 |ute list|size and|
|00004f50| 20 28 63 6f 6d 70 69 6c | 65 20 74 69 6d 65 20 6f | (compil|e time o|
|00004f60| 6f 70 74 69 6f 6e 61 6c | 6c 79 29 20 64 6f 20 61 |optional|ly) do a|
|00004f70| 0a 58 68 65 61 64 65 72 | 20 61 6e 64 20 72 65 74 |.Xheader| and ret|
|00004f80| 75 72 6e 2e 20 20 49 66 | 20 74 68 65 72 65 20 61 |urn. If| there a|
|00004f90| 72 65 20 61 6e 20 6f 64 | 64 20 6e 75 6d 62 65 72 |re an od|d number|
|00004fa0| 20 6f 66 20 61 72 67 76 | 20 65 6e 74 72 69 65 73 | of argv| entries|
|00004fb0| 20 28 74 68 65 0a 58 66 | 75 6e 63 74 69 6f 6e 20 | (the.Xf|unction |
|00004fc0| 6e 61 6d 65 20 69 73 20 | 63 6f 75 6e 74 65 64 20 |name is |counted |
|00004fd0| 69 6e 20 61 72 67 63 2c | 20 73 6f 20 74 68 69 73 |in argc,| so this|
|00004fe0| 20 6d 65 61 6e 73 20 74 | 68 61 74 20 66 6c 61 67 | means t|hat flag|
|00004ff0| 73 20 61 6e 64 20 76 61 | 6c 75 65 73 0a 58 63 6f |s and va|lues.Xco|
|00005000| 6d 65 20 69 6e 20 70 61 | 69 72 73 29 2c 20 74 68 |me in pa|irs), th|
|00005010| 65 20 70 61 72 61 6d 65 | 74 65 72 73 20 61 72 65 |e parame|ters are|
|00005020| 20 66 65 74 63 68 65 64 | 20 69 6e 20 6f 72 64 65 | fetched| in orde|
|00005030| 72 20 69 6e 74 6f 20 74 | 68 65 0a 58 61 70 70 72 |r into t|he.Xappr|
|00005040| 6f 70 72 69 61 74 65 20 | 67 6c 6f 62 61 6c 20 70 |opriate |global p|
|00005050| 61 72 61 6d 65 74 65 72 | 20 76 61 72 69 61 62 6c |arameter| variabl|
|00005060| 65 73 2e 20 20 49 66 20 | 61 6e 20 65 76 65 6e 20 |es. If |an even |
|00005070| 6e 75 6d 62 65 72 20 6f | 66 20 61 72 67 76 0a 58 |number o|f argv.X|
|00005080| 65 6e 74 72 69 65 73 20 | 65 78 69 73 74 2c 20 74 |entries |exist, t|
|00005090| 68 65 20 72 6f 75 74 69 | 6e 65 20 63 6f 6d 70 6c |he routi|ne compl|
|000050a0| 61 69 6e 73 20 61 6e 64 | 20 65 78 69 74 73 2e 0a |ains and| exits..|
|000050b0| 58 0a 58 54 68 65 20 73 | 77 69 74 63 68 20 73 74 |X.XThe s|witch st|
|000050c0| 61 74 65 6d 65 6e 74 20 | 69 73 20 70 72 65 74 74 |atement |is prett|
|000050d0| 79 20 73 74 61 6e 64 61 | 72 64 3b 20 74 68 65 20 |y standa|rd; the |
|000050e0| 6f 6e 6c 79 20 69 6e 74 | 65 72 65 73 74 69 6e 67 |only int|eresting|
|000050f0| 20 65 6c 65 6d 65 6e 74 | 0a 58 69 73 20 74 68 65 | element|.Xis the|
|00005100| 20 2d 72 20 73 77 69 74 | 63 68 2c 20 77 68 69 63 | -r swit|ch, whic|
|00005110| 68 20 6c 6f 61 64 73 20 | 61 20 6c 6f 6e 67 20 69 |h loads |a long i|
|00005120| 6e 73 74 65 61 64 20 6f | 66 20 61 6e 20 69 6e 74 |nstead o|f an int|
|00005130| 65 67 65 72 2c 20 61 6e | 64 20 61 6c 73 6f 0a 58 |eger, an|d also.X|
|00005140| 63 61 6c 6c 73 20 53 45 | 45 44 52 41 4e 44 4f 4d |calls SE|EDRANDOM|
|00005150| 28 72 61 6e 64 6f 6d 73 | 65 65 64 29 20 74 6f 20 |(randoms|eed) to |
|00005160| 6f 76 65 72 72 69 64 65 | 20 74 68 65 20 70 72 65 |override| the pre|
|00005170| 76 69 6f 75 73 20 28 69 | 6e 20 6d 61 69 6e 28 29 |vious (i|n main()|
|00005180| 29 20 63 61 6c 6c 0a 58 | 74 6f 20 53 45 45 44 52 |) call.X|to SEEDR|
|00005190| 41 4e 44 4f 4d 28 74 69 | 6d 65 28 29 29 2e 20 20 |ANDOM(ti|me()). |
|000051a0| 54 68 69 73 20 6c 65 74 | 73 20 74 68 65 20 72 61 |This let|s the ra|
|000051b0| 6e 64 6f 6d 20 73 65 65 | 64 20 62 65 20 66 6f 72 |ndom see|d be for|
|000051c0| 63 65 64 2c 20 61 6c 6c | 6f 77 69 6e 67 0a 58 64 |ced, all|owing.Xd|
|000051d0| 75 70 6c 69 63 61 74 65 | 20 72 75 6e 73 20 66 6f |uplicate| runs fo|
|000051e0| 72 20 64 65 62 75 67 67 | 69 6e 67 20 6f 72 20 66 |r debugg|ing or f|
|000051f0| 6f 72 20 69 6e 63 6c 75 | 73 69 6f 6e 20 69 6e 20 |or inclu|sion in |
|00005200| 61 20 67 61 6d 65 20 77 | 68 65 72 65 20 74 68 65 |a game w|here the|
|00005210| 20 63 6f 64 65 0a 58 61 | 6e 64 20 73 65 65 64 73 | code.Xa|nd seeds|
|00005220| 20 61 72 65 20 63 68 65 | 61 70 65 72 20 74 6f 20 | are che|aper to |
|00005230| 73 74 6f 72 65 20 74 68 | 61 6e 20 74 68 65 20 72 |store th|an the r|
|00005240| 6f 6f 6d 73 2e 20 28 42 | 69 67 20 67 61 6d 65 21 |ooms. (B|ig game!|
|00005250| 29 0a 58 0a 58 54 68 65 | 20 63 68 65 63 6b 20 62 |).X.XThe| check b|
|00005260| 65 6c 6f 77 20 74 68 65 | 20 73 77 69 74 63 68 20 |elow the| switch |
|00005270| 69 73 20 61 62 6f 75 74 | 20 68 61 6c 66 20 6f 66 |is about| half of|
|00005280| 20 74 68 65 20 73 61 6e | 69 74 79 20 69 6e 20 74 | the san|ity in t|
|00005290| 68 65 20 77 68 6f 6c 65 | 0a 58 70 72 6f 67 72 61 |he whole|.Xprogra|
|000052a0| 6d 3a 0a 58 0a 58 28 28 | 6d 61 7a 65 77 69 64 74 |m:.X.X((|mazewidt|
|000052b0| 68 25 32 29 20 21 3d 20 | 31 29 20 2d 2d 20 54 68 |h%2) != |1) -- Th|
|000052c0| 65 20 6d 61 7a 65 20 77 | 69 64 74 68 20 6d 75 73 |e maze w|idth mus|
|000052d0| 74 20 62 65 20 6f 64 64 | 2e 0a 58 0a 58 28 28 6d |t be odd|..X.X((m|
|000052e0| 61 7a 65 68 65 69 67 68 | 74 25 32 29 20 21 3d 20 |azeheigh|t%2) != |
|000052f0| 31 29 20 2d 2d 20 54 68 | 65 20 6d 61 7a 65 20 68 |1) -- Th|e maze h|
|00005300| 65 69 67 68 74 20 6d 75 | 73 74 20 62 65 20 6f 64 |eight mu|st be od|
|00005310| 64 2e 0a 58 0a 58 28 6d | 61 7a 65 77 69 64 74 68 |d..X.X(m|azewidth|
|00005320| 20 3c 20 31 31 29 20 2d | 2d 20 54 68 65 20 6d 61 | < 11) -|- The ma|
|00005330| 7a 65 20 6d 75 73 74 20 | 62 65 20 61 74 20 6c 65 |ze must |be at le|
|00005340| 61 73 74 20 66 69 76 65 | 20 63 65 6c 6c 73 20 68 |ast five| cells h|
|00005350| 69 67 68 20 74 6f 20 6c | 65 61 76 65 0a 58 72 6f |igh to l|eave.Xro|
|00005360| 6f 6d 20 66 6f 72 20 6f | 6e 65 20 69 6e 74 65 72 |om for o|ne inter|
|00005370| 69 6f 72 20 72 6f 77 20 | 6f 66 20 62 75 69 6c 64 |ior row |of build|
|00005380| 69 6e 67 73 2e 20 0a 58 | 0a 58 28 6d 61 7a 65 68 |ings. .X|.X(mazeh|
|00005390| 65 69 67 68 74 20 3c 20 | 31 31 29 20 2d 2d 20 54 |eight < |11) -- T|
|000053a0| 68 65 20 6d 61 7a 65 20 | 6d 75 73 74 20 62 65 20 |he maze |must be |
|000053b0| 61 74 20 6c 65 61 73 74 | 20 66 69 76 65 20 63 65 |at least| five ce|
|000053c0| 6c 6c 73 20 77 69 64 65 | 20 74 6f 0a 58 6c 65 61 |lls wide| to.Xlea|
|000053d0| 76 65 20 72 6f 6f 6d 20 | 66 6f 72 20 6f 6e 65 20 |ve room |for one |
|000053e0| 69 6e 74 65 72 69 6f 72 | 20 72 6f 77 20 6f 66 20 |interior| row of |
|000053f0| 62 75 69 6c 64 69 6e 67 | 73 2e 20 0a 58 0a 58 28 |building|s. .X.X(|
|00005400| 6d 61 7a 65 67 61 74 65 | 73 20 3c 20 30 29 20 2d |mazegate|s < 0) -|
|00005410| 2d 20 54 68 65 72 65 20 | 6d 75 73 74 20 62 65 20 |- There |must be |
|00005420| 61 74 20 6c 65 61 73 74 | 20 7a 65 72 6f 20 67 61 |at least| zero ga|
|00005430| 74 65 73 2e 0a 58 0a 58 | 28 6d 61 7a 65 67 61 74 |tes..X.X|(mazegat|
|00005440| 65 73 20 3e 20 28 32 2a | 28 28 6d 61 7a 65 68 65 |es > (2*|((mazehe|
|00005450| 69 67 68 74 20 2d 20 36 | 29 2f 37 29 20 2b 20 32 |ight - 6|)/7) + 2|
|00005460| 2a 28 28 6d 61 7a 65 77 | 69 64 74 68 2d 20 36 29 |*((mazew|idth- 6)|
|00005470| 2f 37 29 29 29 20 2d 2d | 20 54 68 65 72 65 0a 58 |/7))) --| There.X|
|00005480| 63 61 6e 20 62 65 20 6e | 6f 20 6d 6f 72 65 20 67 |can be n|o more g|
|00005490| 61 74 65 73 20 74 68 61 | 6e 20 6f 6e 65 20 70 65 |ates tha|n one pe|
|000054a0| 72 20 74 68 72 65 65 20 | 73 69 64 65 20 63 65 6c |r three |side cel|
|000054b0| 6c 73 20 62 65 74 77 65 | 65 6e 20 74 68 65 20 75 |ls betwe|en the u|
|000054c0| 6e 75 73 65 64 0a 58 63 | 6f 72 6e 65 72 20 63 65 |nused.Xc|orner ce|
|000054d0| 6c 6c 73 2c 20 74 6f 20 | 61 73 73 75 72 65 20 74 |lls, to |assure t|
|000054e0| 68 61 74 20 61 6c 6c 20 | 67 61 74 65 73 20 77 69 |hat all |gates wi|
|000054f0| 6c 6c 20 66 69 74 2e 20 | 0a 58 0a 58 28 6c 65 66 |ll fit. |.X.X(lef|
|00005500| 74 67 61 74 65 73 20 3c | 20 30 29 20 2d 2d 20 54 |tgates <| 0) -- T|
|00005510| 68 65 72 65 20 6d 75 73 | 74 20 62 65 20 61 74 20 |here mus|t be at |
|00005520| 6c 65 61 73 74 20 7a 65 | 72 6f 20 67 61 74 65 73 |least ze|ro gates|
|00005530| 20 6c 65 66 74 20 61 74 | 20 74 68 65 20 65 6e 64 | left at| the end|
|00005540| 2e 0a 58 0a 58 28 6c 65 | 66 74 67 61 74 65 73 20 |..X.X(le|ftgates |
|00005550| 3e 20 6d 61 7a 65 67 61 | 74 65 73 29 20 2d 2d 20 |> mazega|tes) -- |
|00005560| 54 68 65 72 65 20 63 61 | 6e 6e 6f 74 20 62 65 20 |There ca|nnot be |
|00005570| 6d 6f 72 65 20 67 61 74 | 65 73 20 6c 65 66 74 20 |more gat|es left |
|00005580| 74 68 61 6e 20 74 68 65 | 72 65 0a 58 77 65 72 65 |than the|re.Xwere|
|00005590| 20 74 6f 20 62 65 67 69 | 6e 2e 20 0a 58 0a 58 28 | to begi|n. .X.X(|
|000055a0| 6d 61 7a 65 63 6f 75 72 | 74 73 20 3c 20 30 29 20 |mazecour|ts < 0) |
|000055b0| 2d 2d 20 54 68 65 72 65 | 20 6d 75 73 74 20 62 65 |-- There| must be|
|000055c0| 20 61 74 20 6c 65 61 73 | 74 20 7a 65 72 6f 20 63 | at leas|t zero c|
|000055d0| 6f 75 72 74 79 61 72 64 | 73 2e 0a 58 0a 58 28 6d |ourtyard|s..X.X(m|
|000055e0| 61 7a 65 63 6f 75 72 74 | 73 20 3e 20 28 28 28 6d |azecourt|s > (((m|
|000055f0| 61 7a 65 68 65 69 67 68 | 74 20 2d 20 35 29 2f 36 |azeheigh|t - 5)/6|
|00005600| 29 2a 28 28 6d 61 7a 65 | 77 69 64 74 68 20 2d 20 |)*((maze|width - |
|00005610| 35 29 2f 36 29 29 29 20 | 2d 2d 0a 58 43 6f 75 72 |5)/6))) |--.XCour|
|00005620| 74 79 61 72 64 73 20 6d | 75 73 74 20 68 61 76 65 |tyards m|ust have|
|00005630| 20 72 6f 6f 6d 20 66 6f | 72 20 61 74 20 6c 65 61 | room fo|r at lea|
|00005640| 73 74 20 74 77 6f 20 73 | 70 61 63 65 73 20 62 65 |st two s|paces be|
|00005650| 74 77 65 65 6e 20 74 68 | 65 6d 2c 0a 58 6f 74 68 |tween th|em,.Xoth|
|00005660| 65 72 77 69 73 65 20 74 | 68 65 79 20 77 6f 6e 27 |erwise t|hey won'|
|00005670| 74 20 66 69 74 20 77 68 | 65 6e 20 6d 61 6b 65 63 |t fit wh|en makec|
|00005680| 6f 75 72 74 73 28 29 20 | 69 73 20 72 75 6e 2e 0a |ourts() |is run..|
|00005690| 58 0a 58 28 28 6d 61 7a | 65 63 6f 75 72 74 73 20 |X.X((maz|ecourts |
|000056a0| 2b 20 6d 61 7a 65 67 61 | 74 65 73 29 20 3c 20 31 |+ mazega|tes) < 1|
|000056b0| 29 20 2d 2d 20 54 68 65 | 72 65 20 6d 75 73 74 20 |) -- The|re must |
|000056c0| 62 65 20 61 74 20 6c 65 | 61 73 74 20 6f 6e 65 20 |be at le|ast one |
|000056d0| 73 74 72 65 65 74 2e 0a | 58 0a 58 28 6d 61 7a 65 |street..|X.X(maze|
|000056e0| 75 6e 75 73 65 64 20 3e | 20 28 28 28 6d 61 7a 65 |unused >| (((maze|
|000056f0| 68 65 69 67 68 74 20 2d | 20 31 29 2f 31 34 29 2a |height -| 1)/14)*|
|00005700| 28 28 6d 61 7a 65 77 69 | 64 74 68 20 2d 20 31 29 |((mazewi|dth - 1)|
|00005710| 2f 31 34 29 29 29 20 2d | 2d 20 55 6e 75 73 65 64 |/14))) -|- Unused|
|00005720| 0a 58 63 65 6c 6c 73 20 | 6d 75 73 74 20 68 61 76 |.Xcells |must hav|
|00005730| 65 20 72 6f 6f 6d 20 66 | 6f 72 20 61 74 20 6c 65 |e room f|or at le|
|00005740| 61 73 74 20 74 68 72 65 | 65 20 73 71 75 61 72 65 |ast thre|e square|
|00005750| 73 20 62 65 74 77 65 65 | 6e 20 74 68 65 6d 2c 0a |s betwee|n them,.|
|00005760| 58 6f 74 68 65 72 77 69 | 73 65 20 74 68 65 79 20 |Xotherwi|se they |
|00005770| 63 61 6e 20 74 72 61 70 | 20 44 45 41 44 20 63 65 |can trap| DEAD ce|
|00005780| 6c 6c 73 20 61 77 61 79 | 20 66 72 6f 6d 20 73 74 |lls away| from st|
|00005790| 72 65 65 74 73 20 61 6e | 64 20 77 6f 6e 27 74 20 |reets an|d won't |
|000057a0| 66 69 74 20 77 68 65 6e | 0a 58 6d 61 6b 65 75 6e |fit when|.Xmakeun|
|000057b0| 75 73 65 64 28 29 20 69 | 73 20 72 75 6e 2e 2e 20 |used() i|s run.. |
|000057c0| 0a 58 0a 58 28 6d 61 7a | 65 73 74 72 61 69 67 68 |.X.X(maz|estraigh|
|000057d0| 74 6e 65 73 73 20 3c 20 | 30 29 20 2d 2d 20 4e 65 |tness < |0) -- Ne|
|000057e0| 67 61 74 69 76 65 20 73 | 74 72 61 69 67 68 74 6e |gative s|traightn|
|000057f0| 65 73 73 20 6d 61 6b 65 | 73 20 6e 6f 20 73 65 6e |ess make|s no sen|
|00005800| 73 65 2e 20 20 5b 5a 65 | 72 6f 0a 58 6d 65 61 6e |se. [Ze|ro.Xmean|
|00005810| 73 20 64 6f 6e 27 74 20 | 64 6f 20 73 74 72 61 69 |s don't |do strai|
|00005820| 67 68 74 65 6e 69 6e 67 | 2c 20 61 6e 64 20 74 68 |ghtening|, and th|
|00005830| 61 74 27 73 20 4f 4b 2e | 5d 0a 58 0a 58 28 6d 61 |at's OK.|].X.X(ma|
|00005840| 7a 65 73 74 72 61 69 67 | 68 74 6e 65 73 73 20 3e |zestraig|htness >|
|00005850| 20 39 39 38 29 20 2d 2d | 20 54 68 65 72 65 20 6d | 998) --| There m|
|00005860| 75 73 74 20 62 65 20 61 | 74 20 6c 65 61 73 74 20 |ust be a|t least |
|00005870| 6f 6e 65 20 63 68 61 6e | 63 65 20 70 65 72 0a 58 |one chan|ce per.X|
|00005880| 74 68 6f 75 73 61 6e 64 | 20 6f 66 20 61 63 63 65 |thousand| of acce|
|00005890| 70 74 69 6e 67 20 61 20 | 62 65 6e 64 20 69 6e 20 |pting a |bend in |
|000058a0| 74 68 65 20 73 74 72 65 | 65 74 2c 20 6f 72 20 61 |the stre|et, or a|
|000058b0| 6e 20 69 6e 66 69 6e 69 | 74 65 20 6c 6f 6f 70 20 |n infini|te loop |
|000058c0| 6d 69 67 68 74 0a 58 6f | 63 63 75 72 2e 20 39 39 |might.Xo|ccur. 99|
|000058d0| 39 20 69 73 20 74 68 65 | 20 68 69 67 68 65 73 74 |9 is the| highest|
|000058e0| 20 76 61 6c 75 65 20 72 | 65 74 75 72 6e 65 64 20 | value r|eturned |
|000058f0| 62 79 20 74 68 65 20 72 | 61 6e 64 6f 6d 20 72 6f |by the r|andom ro|
|00005900| 6c 6c 20 6d 6f 64 64 65 | 64 0a 58 61 67 61 69 6e |ll modde|d.Xagain|
|00005910| 73 74 20 31 30 30 30 2c | 20 73 6f 20 39 39 38 20 |st 1000,| so 998 |
|00005920| 69 73 20 74 68 65 20 6c | 61 72 67 65 73 74 20 61 |is the l|argest a|
|00005930| 63 63 70 65 74 61 62 6c | 65 20 73 74 72 61 69 67 |ccpetabl|e straig|
|00005940| 68 74 6e 65 73 73 20 70 | 61 72 61 6d 65 74 65 72 |htness p|arameter|
|00005950| 2e 20 0a 58 0a 58 49 66 | 20 61 6c 6c 20 74 68 65 |. .X.XIf| all the|
|00005960| 20 70 61 72 61 6d 65 74 | 65 72 73 20 61 72 65 20 | paramet|ers are |
|00005970| 72 69 67 68 74 2c 20 74 | 68 65 20 6c 69 73 74 73 |right, t|he lists|
|00005980| 69 7a 65 20 28 6e 75 6d | 62 65 72 20 6f 66 20 63 |ize (num|ber of c|
|00005990| 65 6c 6c 0a 58 73 74 72 | 75 63 74 75 72 65 73 20 |ell.Xstr|uctures |
|000059a0| 69 6e 20 73 74 61 74 6c | 69 73 74 29 20 69 73 20 |in statl|ist) is |
|000059b0| 63 6f 6d 70 75 74 65 64 | 20 66 72 6f 6d 20 74 68 |computed| from th|
|000059c0| 65 20 72 65 71 75 65 73 | 74 65 64 20 6d 61 7a 65 |e reques|ted maze|
|000059d0| 20 77 69 64 74 68 20 61 | 6e 64 0a 58 68 65 69 67 | width a|nd.Xheig|
|000059e0| 68 74 2e 20 49 66 20 74 | 68 65 20 48 45 41 44 45 |ht. If t|he HEADE|
|000059f0| 52 20 6f 70 74 69 6f 6e | 20 69 73 20 6f 6e 20 28 |R option| is on (|
|00005a00| 49 20 61 6c 77 61 79 73 | 20 75 73 65 20 69 74 29 |I always| use it)|
|00005a10| 20 61 20 73 69 6e 67 6c | 65 20 6c 69 6e 65 20 6f | a singl|e line o|
|00005a20| 66 0a 58 70 61 72 61 6d | 65 74 65 72 73 20 69 73 |f.Xparam|eters is|
|00005a30| 20 70 72 69 6e 74 65 64 | 20 74 6f 20 73 74 61 6e | printed| to stan|
|00005a40| 64 61 72 64 20 6f 75 74 | 20 61 6c 6f 6e 67 20 77 |dard out| along w|
|00005a50| 69 74 68 20 74 68 65 20 | 65 76 65 6e 74 75 61 6c |ith the |eventual|
|00005a60| 20 6d 61 7a 65 2e 0a 58 | 5b 41 6c 6c 20 6f 74 68 | maze..X|[All oth|
|00005a70| 65 72 20 6f 75 74 70 75 | 74 20 67 6f 65 73 20 74 |er outpu|t goes t|
|00005a80| 6f 20 74 68 65 20 73 74 | 61 6e 64 61 72 64 20 65 |o the st|andard e|
|00005a90| 72 72 6f 72 20 75 6e 69 | 74 2e 5d 0a 58 0a 58 0a |rror uni|t.].X.X.|
|00005aa0| 58 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |X-------|--------|
|00005ab0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00005ac0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00005ad0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00005ae0| 2d 2d 2d 2d 2d 2d 2d 2d | 0a 58 7c 20 69 6e 74 65 |--------|.X| inte|
|00005af0| 72 69 6f 72 63 65 6c 6c | 2e 63 20 2d 2d 20 69 6e |riorcell|.c -- in|
|00005b00| 74 65 72 69 6f 72 63 65 | 6c 6c 28 63 65 6c 6c 69 |teriorce|ll(celli|
|00005b10| 64 29 0a 58 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |d).X----|--------|
|00005b20| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00005b30| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00005b40| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00005b50| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 0a 58 0a 58 54 |--------|---.X.XT|
|00005b60| 68 69 73 20 73 69 6d 70 | 6c 65 20 66 75 6e 63 74 |his simp|le funct|
|00005b70| 69 6f 6e 20 6a 75 73 74 | 20 63 68 65 63 6b 73 20 |ion just| checks |
|00005b80| 74 68 61 74 20 74 68 65 | 20 70 61 73 73 65 64 20 |that the| passed |
|00005b90| 63 65 6c 6c 20 68 61 73 | 20 61 6c 6c 20 66 6f 75 |cell has| all fou|
|00005ba0| 72 0a 58 6e 65 69 67 68 | 62 6f 72 73 20 75 73 69 |r.Xneigh|bors usi|
|00005bb0| 6e 67 20 6e 68 62 72 65 | 78 69 73 74 73 28 29 2e |ng nhbre|xists().|
|00005bc0| 20 20 4c 6f 74 73 20 6f | 66 20 73 74 75 66 66 20 | Lots o|f stuff |
|00005bd0| 69 6e 20 74 6f 77 6e 6d | 61 7a 65 20 73 70 65 63 |in townm|aze spec|
|00005be0| 69 66 69 65 73 0a 58 69 | 6e 74 65 72 69 6f 72 20 |ifies.Xi|nterior |
|00005bf0| 63 65 6c 6c 73 20 6f 6e | 6c 79 2e 20 0a 58 0a 58 |cells on|ly. .X.X|
|00005c00| 0a 58 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |.X------|--------|
|00005c10| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00005c20| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00005c30| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00005c40| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 0a 58 7c 20 6d 61 6b |--------|-.X| mak|
|00005c50| 65 63 6f 75 72 74 73 2e | 63 20 2d 2d 20 6d 61 6b |ecourts.|c -- mak|
|00005c60| 65 63 6f 75 72 74 73 28 | 29 0a 58 2d 2d 2d 2d 2d |ecourts(|).X-----|
|00005c70| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00005c80| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00005c90| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00005ca0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00005cb0| 2d 2d 0a 58 0a 58 54 68 | 69 73 20 72 6f 75 74 69 |--.X.XTh|is routi|
|00005cc0| 6e 65 20 64 6f 65 73 20 | 73 74 65 70 20 34 63 29 |ne does |step 4c)|
|00005cd0| 2c 20 61 62 6f 76 65 2e | 20 20 49 6e 20 72 65 73 |, above.| In res|
|00005ce0| 70 6f 6e 73 65 20 74 6f | 20 74 68 65 20 6d 61 7a |ponse to| the maz|
|00005cf0| 65 63 6f 75 72 74 73 0a | 58 70 61 72 61 6d 65 74 |ecourts.|Xparamet|
|00005d00| 65 72 20 76 61 6c 75 65 | 2c 20 74 68 69 73 20 72 |er value|, this r|
|00005d10| 6f 75 74 69 6e 65 20 70 | 6c 61 63 65 73 20 22 63 |outine p|laces "c|
|00005d20| 6f 75 72 74 79 61 72 64 | 73 22 2c 20 53 54 52 45 |ourtyard|s", STRE|
|00005d30| 45 54 20 63 65 6c 6c 73 | 20 69 6e 20 74 68 65 0a |ET cells| in the.|
|00005d40| 58 69 6e 74 65 72 69 6f | 72 20 6f 66 20 74 68 65 |Xinterio|r of the|
|00005d50| 20 74 6f 77 6e 20 6d 61 | 7a 65 2c 20 73 70 61 63 | town ma|ze, spac|
|00005d60| 65 73 20 74 68 65 6d 20 | 6f 75 74 20 62 79 20 6d |es them |out by m|
|00005d70| 61 6b 69 6e 67 20 73 75 | 72 65 20 62 65 66 6f 72 |aking su|re befor|
|00005d80| 65 20 74 68 65 79 0a 58 | 61 72 65 20 70 6c 61 63 |e they.X|are plac|
|00005d90| 65 64 20 74 68 61 74 20 | 61 6c 6c 20 6e 65 69 67 |ed that |all neig|
|00005da0| 68 62 6f 72 20 63 65 6c | 6c 73 20 61 6e 64 20 74 |hbor cel|ls and t|
|00005db0| 68 65 20 72 61 6e 64 6f | 6d 6c 79 20 63 68 6f 73 |he rando|mly chos|
|00005dc0| 65 6e 20 63 65 6c 6c 20 | 61 72 65 0a 58 49 53 4f |en cell |are.XISO|
|00005dd0| 4c 41 54 45 44 20 63 65 | 6c 6c 73 2c 20 61 6e 64 |LATED ce|lls, and|
|00005de0| 20 75 73 65 73 20 61 20 | 73 69 64 65 20 65 66 66 | uses a |side eff|
|00005df0| 65 63 74 20 6f 66 20 6d | 61 6b 65 73 74 72 65 65 |ect of m|akestree|
|00005e00| 74 28 29 20 74 6f 20 74 | 75 72 6e 20 74 68 65 6d |t() to t|urn them|
|00005e10| 0a 58 69 6e 74 6f 20 4c | 49 56 45 20 6f 72 20 44 |.Xinto L|IVE or D|
|00005e20| 45 41 44 20 63 65 6c 6c | 73 20 61 73 20 65 61 63 |EAD cell|s as eac|
|00005e30| 68 20 63 6f 75 72 74 79 | 61 72 64 20 69 73 20 70 |h courty|ard is p|
|00005e40| 6c 61 63 65 64 2c 20 65 | 66 66 65 63 74 69 76 65 |laced, e|ffective|
|00005e50| 6c 79 0a 58 66 65 6e 64 | 69 6e 67 20 6f 66 66 20 |ly.Xfend|ing off |
|00005e60| 6e 65 69 67 68 62 6f 72 | 73 20 61 20 62 69 74 2e |neighbor|s a bit.|
|00005e70| 20 0a 58 0a 58 42 65 63 | 61 75 73 65 20 74 68 65 | .X.XBec|ause the|
|00005e80| 72 65 20 61 72 65 20 73 | 6f 20 6d 61 6e 79 20 49 |re are s|o many I|
|00005e90| 53 4f 4c 41 54 45 44 20 | 63 65 6c 6c 73 20 77 68 |SOLATED |cells wh|
|00005ea0| 65 6e 20 74 68 69 73 20 | 69 73 20 64 6f 6e 65 2c |en this |is done,|
|00005eb0| 20 69 74 20 69 73 0a 58 | 62 65 74 74 65 72 20 74 | it is.X|better t|
|00005ec0| 6f 20 72 6f 6c 6c 20 74 | 68 65 20 72 61 6e 64 6f |o roll t|he rando|
|00005ed0| 6d 69 7a 65 72 20 61 67 | 61 69 6e 73 20 74 68 65 |mizer ag|ains the|
|00005ee0| 20 77 68 6f 6c 65 20 6d | 61 7a 65 20 61 6e 64 20 | whole m|aze and |
|00005ef0| 61 63 63 65 70 74 20 74 | 68 65 0a 58 6d 69 73 73 |accept t|he.Xmiss|
|00005f00| 65 73 20 77 68 65 72 65 | 20 61 20 6e 6f 6e 2d 49 |es where| a non-I|
|00005f10| 53 4f 4c 41 54 45 44 20 | 63 65 6c 6c 20 69 73 20 |SOLATED |cell is |
|00005f20| 63 68 6f 73 65 6e 2c 20 | 74 68 61 6e 20 74 6f 20 |chosen, |than to |
|00005f30| 72 6f 6c 6c 20 61 67 61 | 69 6e 73 74 20 74 68 65 |roll aga|inst the|
|00005f40| 0a 58 6c 65 6e 67 74 68 | 20 6f 66 20 74 68 65 20 |.Xlength| of the |
|00005f50| 49 53 4f 4c 41 54 45 44 | 20 6c 69 73 74 20 61 6e |ISOLATED| list an|
|00005f60| 64 20 77 61 6c 6b 20 69 | 74 20 66 72 6f 6d 20 74 |d walk i|t from t|
|00005f70| 68 65 20 65 6e 64 20 65 | 61 63 68 20 74 69 6d 65 |he end e|ach time|
|00005f80| 2e 20 20 49 66 0a 58 6f | 6e 65 20 68 61 62 69 74 |. If.Xo|ne habit|
|00005f90| 75 61 6c 6c 79 20 6d 61 | 64 65 20 74 68 65 20 63 |ually ma|de the c|
|00005fa0| 6f 75 72 74 79 61 72 64 | 20 63 65 6c 6c 73 20 76 |ourtyard| cells v|
|00005fb0| 65 72 79 20 68 69 67 68 | 2c 20 69 74 20 6d 69 67 |ery high|, it mig|
|00005fc0| 68 74 20 62 65 20 62 65 | 74 74 65 72 0a 58 74 6f |ht be be|tter.Xto|
|00005fd0| 20 64 6f 20 74 68 69 73 | 20 74 68 65 20 6f 74 68 | do this| the oth|
|00005fe0| 65 72 20 77 61 79 2e 20 | 0a 58 0a 58 54 68 65 20 |er way. |.X.XThe |
|00005ff0| 72 61 6e 64 6f 6d 20 72 | 6f 6c 6c 20 63 6f 75 6c |random r|oll coul|
|00006000| 64 20 62 65 20 69 6d 70 | 72 6f 76 65 64 2c 20 62 |d be imp|roved, b|
|00006010| 75 74 20 66 6f 72 20 73 | 6d 61 6c 6c 20 6d 61 7a |ut for s|mall maz|
|00006020| 65 73 20 69 74 20 64 6f | 65 73 6e 27 74 0a 58 6d |es it do|esn't.Xm|
|00006030| 61 74 74 65 72 20 6d 75 | 63 68 2e 20 20 54 68 65 |atter mu|ch. The|
|00006040| 20 62 69 61 73 20 6f 66 | 20 69 67 6e 6f 72 69 6e | bias of| ignorin|
|00006050| 67 20 74 68 65 20 6d 69 | 73 6d 61 74 63 68 20 62 |g the mi|smatch b|
|00006060| 65 74 77 65 65 6e 20 74 | 68 65 20 6d 6f 64 75 6c |etween t|he modul|
|00006070| 75 73 0a 58 61 6e 64 20 | 74 68 65 20 6c 65 6e 67 |us.Xand |the leng|
|00006080| 74 68 20 6f 66 20 74 68 | 65 20 69 6e 74 65 72 76 |th of th|e interv|
|00006090| 61 6c 20 72 65 74 75 72 | 6e 65 64 20 62 79 20 52 |al retur|ned by R|
|000060a0| 41 4e 44 4f 4d 28 29 20 | 69 6e 20 61 20 6d 61 7a |ANDOM() |in a maz|
|000060b0| 65 20 33 32 4b 20 6f 6e | 20 61 0a 58 73 69 64 65 |e 32K on| a.Xside|
|000060c0| 20 77 6f 75 6c 64 20 70 | 72 6f 62 61 62 6c 79 20 | would p|robably |
|000060d0| 62 65 20 70 72 65 74 74 | 79 20 6f 62 76 69 6f 75 |be prett|y obviou|
|000060e0| 73 2e 20 0a 58 0a 58 42 | 65 63 61 75 73 65 20 69 |s. .X.XB|ecause i|
|000060f0| 74 20 77 61 73 20 65 61 | 73 69 65 72 20 74 68 61 |t was ea|sier tha|
|00006100| 6e 20 65 78 70 6c 69 63 | 69 74 6c 79 20 63 6f 6d |n explic|itly com|
|00006110| 70 65 6e 73 61 74 69 6e | 67 20 66 6f 72 20 74 68 |pensatin|g for th|
|00006120| 65 0a 58 69 6e 74 65 72 | 66 65 72 65 6e 63 65 20 |e.Xinter|ference |
|00006130| 66 72 6f 6d 20 55 4e 55 | 53 45 44 20 63 65 6c 6c |from UNU|SED cell|
|00006140| 73 2c 20 61 20 4d 41 58 | 54 52 49 45 53 20 6c 69 |s, a MAX|TRIES li|
|00006150| 6d 69 74 20 69 73 20 65 | 6e 66 6f 72 63 65 64 20 |mit is e|nforced |
|00006160| 66 6f 72 0a 58 70 6c 61 | 63 69 6e 67 20 65 61 63 |for.Xpla|cing eac|
|00006170| 68 20 63 6f 75 72 74 79 | 61 72 64 20 63 65 6c 6c |h courty|ard cell|
|00006180| 2e 20 20 54 68 65 20 6c | 69 6d 69 74 20 69 73 20 |. The l|imit is |
|00006190| 6b 65 70 74 20 76 65 72 | 79 20 68 69 67 68 20 74 |kept ver|y high t|
|000061a0| 6f 20 70 72 65 76 65 6e | 74 0a 58 69 6e 74 65 72 |o preven|t.Xinter|
|000061b0| 66 65 72 65 6e 63 65 20 | 77 69 74 68 20 74 68 65 |ference |with the|
|000061c0| 20 73 74 72 61 69 67 68 | 74 6e 65 73 73 20 70 61 | straigh|tness pa|
|000061d0| 72 61 6d 65 74 65 72 20 | 6f 74 68 65 72 20 70 6c |rameter |other pl|
|000061e0| 61 63 65 73 20 74 68 61 | 74 20 69 74 20 69 73 0a |aces tha|t it is.|
|000061f0| 58 75 73 65 64 2c 20 62 | 75 74 20 77 69 74 68 20 |Xused, b|ut with |
|00006200| 69 74 20 69 6e 20 68 65 | 72 65 2c 20 6d 61 6b 65 |it in he|re, make|
|00006210| 63 6f 75 72 74 73 20 69 | 73 20 67 75 61 72 61 6e |courts i|s guaran|
|00006220| 74 65 65 64 20 74 6f 20 | 74 65 72 6d 69 6e 61 74 |teed to |terminat|
|00006230| 65 0a 58 65 76 65 6e 74 | 75 61 6c 6c 79 2e 20 20 |e.Xevent|ually. |
|00006240| 4f 6e 20 74 68 65 20 6f | 74 68 65 72 20 68 61 6e |On the o|ther han|
|00006250| 64 2c 20 69 74 20 69 73 | 20 6e 6f 74 20 67 75 61 |d, it is| not gua|
|00006260| 72 61 6e 74 65 65 64 20 | 74 6f 20 70 6c 61 63 65 |ranteed |to place|
|00006270| 20 61 73 20 6d 61 6e 79 | 0a 58 63 6f 75 72 74 79 | as many|.Xcourty|
|00006280| 61 72 64 73 20 61 73 20 | 74 68 65 20 75 73 65 72 |ards as |the user|
|00006290| 20 73 70 65 63 69 66 69 | 65 64 2c 20 77 68 69 63 | specifi|ed, whic|
|000062a0| 68 20 69 73 20 6f 6e 65 | 20 72 65 61 73 6f 6e 20 |h is one| reason |
|000062b0| 66 6f 72 20 74 68 65 20 | 73 61 6e 69 74 79 0a 58 |for the |sanity.X|
|000062c0| 63 68 65 63 6b 20 61 74 | 20 74 68 65 20 73 74 61 |check at| the sta|
|000062d0| 72 74 20 6f 66 20 63 6f | 6e 6e 65 63 74 73 74 72 |rt of co|nnectstr|
|000062e0| 65 65 74 73 28 29 2e 20 | 0a 58 0a 58 0a 58 2d 2d |eets(). |.X.X.X--|
|000062f0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00006300| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00006310| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00006320| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00006330| 2d 2d 2d 2d 2d 0a 58 7c | 20 6d 61 6b 65 67 61 74 |-----.X|| makegat|
|00006340| 65 73 2e 63 0a 58 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |es.c.X--|--------|
|00006350| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00006360| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00006370| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00006380| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 0a 58 0a |--------|-----.X.|
|00006390| 58 54 68 69 73 20 72 6f | 75 74 69 6e 65 20 64 6f |XThis ro|utine do|
|000063a0| 65 73 20 73 74 65 70 20 | 34 62 29 2c 20 61 62 6f |es step |4b), abo|
|000063b0| 76 65 2e 20 20 49 6e 20 | 72 65 73 70 6f 6e 73 65 |ve. In |response|
|000063c0| 20 74 6f 20 74 68 65 20 | 6d 61 6b 65 67 61 74 65 | to the |makegate|
|000063d0| 73 0a 58 70 61 72 61 6d | 65 74 65 72 20 76 61 6c |s.Xparam|eter val|
|000063e0| 75 65 2c 20 74 68 69 73 | 20 72 6f 75 74 69 6e 65 |ue, this| routine|
|000063f0| 20 70 6c 61 63 65 73 20 | 22 67 61 74 65 73 22 2c | places |"gates",|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.