home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / volume15 / xbomb / part01 < prev    next >
Encoding:
Internet Message Format  |  1993-01-26  |  50.5 KB

  1. Path: uunet!news.tek.com!master!saab!billr
  2. From: billr@saab.CNA.TEK.COM (Bill Randle)
  3. Newsgroups: comp.sources.games
  4. Subject: v15i048:  xbomb - minesweeper game with extra features, Part01/04
  5. Message-ID: <4223@master.CNA.TEK.COM>
  6. Date: 18 Jan 93 20:08:38 GMT
  7. Sender: news@master.CNA.TEK.COM
  8. Lines: 1855
  9. Approved: billr@saab.CNA.TEK.COM
  10. Xref: uunet comp.sources.games:1547
  11.  
  12. Submitted-by: johnh@FICUS.CS.UCLA.EDU (John Heidemann)
  13. Posting-number: Volume 15, Issue 48
  14. Archive-name: xbomb/Part01
  15. Environment: X11, Xlib
  16.  
  17. [From the authors:]
  18. [[xbomb is an rewrite and extension of the minesweeper game found on
  19. various PCs.  The object of the game is to clear a field of deadly
  20. bombs.  To do this requires only two mouse buttons, one key and a
  21. devastatingly clever man page which describes the game in greater
  22. detail.
  23.  
  24. This version of minesweeper has MANY MANY features not available
  25. in other versions.  We have:
  26.  
  27.         o Ted Mode--you'll love it (it's hard to explain, but you
  28.           *will* love it
  29.  
  30.         o User-defined solvers (for that "boring" stuff between the
  31.           fun part
  32.  
  33.         o A new and different scoring function
  34.  
  35. And much much more!]]
  36.  
  37. #! /bin/sh
  38. # This is a shell archive.  Remove anything before this line, then unpack
  39. # it by saving it into a file and typing "sh file".  To overwrite existing
  40. # files, type "sh file -c".  You can also feed this as standard input via
  41. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  42. # will see the following message at the end:
  43. #        "End of archive 1 (of 4)."
  44. # Contents:  README MANIFEST Makefile.std bitmaps bitmaps/old
  45. #   bitmaps/roman bitmaps/standard graphics.c map.c patchlevel.h
  46. #   xbomb.man
  47. # Wrapped by billr@saab on Mon Jan 18 12:03:06 1993
  48. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  49. if test -f 'README' -a "${1}" != "-c" ; then 
  50.   echo shar: Will not clobber existing file \"'README'\"
  51. else
  52. echo shar: Extracting \"'README'\" \(1625 characters\)
  53. sed "s/^X//" >'README' <<'END_OF_FILE'
  54. Xxbomb is Copyright (C) 1992 by Matthew Merzbacher, Los Angeles, CA.
  55. XAll rights reserved.  Permission is granted to freely distribute
  56. Xthis as long as this copyright message is retained intact.
  57. XPermission to distribute this as part of a commerical product
  58. Xrequires explicit permission of the author.
  59. X
  60. X------------------------------------------------------------
  61. X
  62. XPermission is also granted to play xbomb while bathing,
  63. Xprovided appropriate electrical protection is in place.
  64. X
  65. X------------------------------------------------------------
  66. X
  67. Xxbomb is an rewrite and extension of the minesweeper game found on
  68. Xvarious PCs.  The object of the game is to clear a field of deadly
  69. Xbombs.  To do this requires only two mouse buttons, one key and a
  70. Xdevastatingly clever man page which describes the game in greater
  71. Xdetail.
  72. X
  73. XThis version of minesweeper has MANY MANY features not available
  74. Xin other versions.  We have:
  75. X
  76. X    o Ted Mode--you'll love it (it's hard to explain, but you
  77. X          *will* love it
  78. X    
  79. X    o User-defined solvers (for that "boring" stuff between the
  80. X      fun part
  81. X
  82. X    o A new and different scoring function
  83. X
  84. XAnd much much more!
  85. X
  86. XTo install:
  87. X
  88. X0.  Edit the Imakefile as necessary.
  89. X1.  xmkmf
  90. X2.  make depend
  91. X3.  make
  92. X4.  make install
  93. X5.  make install.man
  94. X
  95. XThe latest version of xbomb is available for anonymous ftp
  96. Xfrom ftp.cs.ucla.edu in pub/ficus.
  97. X
  98. XXbomb has been successfully built and installed on:
  99. X    Sun4, SunOS 4.1.1, X11R5
  100. X    Sun4, SunOS 4.1.1, X11R4
  101. X    Sun3, unknown OS and X version
  102. X    DECstation, unknown OS and X version
  103. X    SGI, unknown OS and X version
  104. X
  105. XIf you successfully build this on other platforms, please let us know.
  106. X
  107. END_OF_FILE
  108. if test 1625 -ne `wc -c <'README'`; then
  109.     echo shar: \"'README'\" unpacked with wrong size!
  110. fi
  111. # end of 'README'
  112. fi
  113. if test -f 'MANIFEST' -a "${1}" != "-c" ; then 
  114.   echo shar: Will not clobber existing file \"'MANIFEST'\"
  115. else
  116. echo shar: Extracting \"'MANIFEST'\" \(2308 characters\)
  117. sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
  118. X   File Name        Archive #    Description
  119. X-----------------------------------------------------------
  120. X Imakefile                  2    
  121. X MANIFEST                   1    This shipping list
  122. X Makefile.std               1    
  123. X README                     1    
  124. X TODO                       4    
  125. X actions.c                  2    
  126. X applications.c             3    
  127. X bitmap.files               2    
  128. X bitmaps                    1    
  129. X bitmaps/old                1    
  130. X bitmaps/old/bomb.bit       4    
  131. X bitmaps/old/ebomb.bit      4    
  132. X bitmaps/old/empty.bit      4    
  133. X bitmaps/old/flag.bit       4    
  134. X bitmaps/old/icon.bit       4    
  135. X bitmaps/old/known0.bit     4    
  136. X bitmaps/old/known1.bit     3    
  137. X bitmaps/old/known2.bit     4    
  138. X bitmaps/old/known3.bit     4    
  139. X bitmaps/old/known4.bit     3    
  140. X bitmaps/old/known5.bit     3    
  141. X bitmaps/old/known6.bit     3    
  142. X bitmaps/old/known7.bit     3    
  143. X bitmaps/old/known8.bit     3    
  144. X bitmaps/old/known9.bit     4    
  145. X bitmaps/roman              1    
  146. X bitmaps/roman/known0.bit   3    
  147. X bitmaps/roman/known1.bit   3    
  148. X bitmaps/roman/known2.bit   3    
  149. X bitmaps/roman/known3.bit   3    
  150. X bitmaps/roman/known4.bit   3    
  151. X bitmaps/roman/known5.bit   3    
  152. X bitmaps/roman/known6.bit   3    
  153. X bitmaps/roman/known7.bit   3    
  154. X bitmaps/roman/known8.bit   3    
  155. X bitmaps/roman/known9.bit   3    
  156. X bitmaps/standard           1    
  157. X bitmaps/standard/blank.bit  3    
  158. X bitmaps/standard/bomb.bit  3    
  159. X bitmaps/standard/ebomb.bit  3    
  160. X bitmaps/standard/empty.bit  3    
  161. X bitmaps/standard/flag.bit  3    
  162. X bitmaps/standard/known0.bit  3    
  163. X bitmaps/standard/known1.bit  3    
  164. X bitmaps/standard/known2.bit  3    
  165. X bitmaps/standard/known3.bit  3    
  166. X bitmaps/standard/known4.bit  3    
  167. X bitmaps/standard/known5.bit  3    
  168. X bitmaps/standard/known6.bit  3    
  169. X bitmaps/standard/known7.bit  3    
  170. X bitmaps/standard/known8.bit  3    
  171. X bitmaps/standard/known9.bit  3    
  172. X bitmaps/standard/think.bit  3    
  173. X debug_solver               3    
  174. X forced_solver.c            3    
  175. X graphics.c                 1    
  176. X icon.bit                   4    
  177. X infer_solver.c             2    
  178. X main.c                     2    
  179. X map.c                      1    
  180. X patchlevel.h               1    
  181. X pattern_solver.c           2    
  182. X prob_solver.c              3    
  183. X score.c                    2    
  184. X solver_io.c                2    
  185. X solver_io.h                4    
  186. X solvers.c                  2    
  187. X statistics                 3    
  188. X xbomb.h                    3    
  189. X xbomb.man                  1    
  190. END_OF_FILE
  191. if test 2308 -ne `wc -c <'MANIFEST'`; then
  192.     echo shar: \"'MANIFEST'\" unpacked with wrong size!
  193. fi
  194. # end of 'MANIFEST'
  195. fi
  196. if test -f 'Makefile.std' -a "${1}" != "-c" ; then 
  197.   echo shar: Will not clobber existing file \"'Makefile.std'\"
  198. else
  199. echo shar: Extracting \"'Makefile.std'\" \(14703 characters\)
  200. sed "s/^X//" >'Makefile.std' <<'END_OF_FILE'
  201. X# Makefile generated by imake - do not edit!
  202. X# $XConsortium: imake.c,v 1.65 91/07/25 17:50:17 rws Exp $
  203. X#
  204. X# The cpp used on this machine replaces all newlines and multiple tabs and
  205. X# spaces in a macro expansion with a single space.  Imake tries to compensate
  206. X# for this, but is not always successful.
  207. X#
  208. X
  209. X# -------------------------------------------------------------------------
  210. X# Makefile generated from "Imake.tmpl" and <Imakefile>
  211. X# $XConsortium: Imake.tmpl,v 1.139 91/09/16 08:52:48 rws Exp $
  212. X#
  213. X# Platform-specific parameters may be set in the appropriate <vendor>.cf
  214. X# configuration files.  Site-specific parameters should be set in the file
  215. X# site.def.  Full rebuilds are recommended if any parameters are changed.
  216. X#
  217. X# If your C preprocessor does not define any unique symbols, you will need
  218. X# to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing
  219. X# "make World" the first time).
  220. X#
  221. X
  222. X# -------------------------------------------------------------------------
  223. X# site-specific configuration parameters that need to come before
  224. X# the platform-specific parameters - edit site.def to change
  225. X
  226. X# site:  $XConsortium: site.def,v 1.2 91/07/30 20:26:44 rws Exp $
  227. X
  228. X# -------------------------------------------------------------------------
  229. X# platform-specific configuration parameters - edit sun.cf to change
  230. X
  231. X# platform:  $XConsortium: sun.cf,v 1.72.1.1 92/03/18 13:13:37 rws Exp $
  232. X
  233. X# operating system:  SunOS 4.1.1
  234. X
  235. X# $XConsortium: sunLib.rules,v 1.7 91/12/20 11:19:47 rws Exp $
  236. X
  237. X# -------------------------------------------------------------------------
  238. X# site-specific configuration parameters that go after
  239. X# the platform-specific parameters - edit site.def to change
  240. X
  241. X# site:  $XConsortium: site.def,v 1.2 91/07/30 20:26:44 rws Exp $
  242. X
  243. X            SHELL = /bin/sh
  244. X
  245. X              TOP = .
  246. X      CURRENT_DIR = .
  247. X
  248. X               AR = ar clq
  249. X  BOOTSTRAPCFLAGS =
  250. X               CC = cc
  251. X               AS = as
  252. X
  253. X         COMPRESS = compress
  254. X              CPP = /lib/cpp $(STD_CPP_DEFINES)
  255. X    PREPROCESSCMD = cc -E $(STD_CPP_DEFINES)
  256. X          INSTALL = install
  257. X               LD = ld
  258. X             LINT = lint
  259. X      LINTLIBFLAG = -C
  260. X         LINTOPTS = -axz
  261. X               LN = ln -s
  262. X             MAKE = make
  263. X               MV = mv
  264. X               CP = cp
  265. X
  266. X           RANLIB = ranlib
  267. X  RANLIBINSTFLAGS =
  268. X
  269. X               RM = rm -f
  270. X            TROFF = psroff
  271. X         MSMACROS = -ms
  272. X              TBL = tbl
  273. X              EQN = eqn
  274. X     STD_INCLUDES =
  275. X  STD_CPP_DEFINES =
  276. X      STD_DEFINES =
  277. X EXTRA_LOAD_FLAGS =
  278. X  EXTRA_LIBRARIES =
  279. X             TAGS = etags
  280. X
  281. X    SHAREDCODEDEF = -DSHAREDCODE
  282. X         SHLIBDEF = -DSUNSHLIB
  283. X
  284. X    PROTO_DEFINES =
  285. X
  286. X     INSTPGMFLAGS = -s
  287. X
  288. X     INSTBINFLAGS = -m 0755
  289. X     INSTUIDFLAGS = -m 4755
  290. X     INSTLIBFLAGS = -m 0644
  291. X     INSTINCFLAGS = -m 0444
  292. X     INSTMANFLAGS = -m 0444
  293. X     INSTDATFLAGS = -m 0444
  294. X    INSTKMEMFLAGS = -g kmem -m 2755
  295. X
  296. X      PROJECTROOT = /usr/local
  297. X
  298. X     TOP_INCLUDES = -I$(INCROOT)
  299. X
  300. X      CDEBUGFLAGS = -O
  301. X        CCOPTIONS =
  302. X
  303. X      ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(STD_INCLUDES)
  304. X       ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(DEFINES)
  305. X           CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES)
  306. X        LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES)
  307. X
  308. X           LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
  309. X
  310. X        LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) $(LOCAL_LDFLAGS) -L$(USRLIBDIR)
  311. X
  312. X   LDCOMBINEFLAGS = -X -r
  313. X      DEPENDFLAGS =
  314. X
  315. X        MACROFILE = sun.cf
  316. X           RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut
  317. X
  318. X    IMAKE_DEFINES =
  319. X
  320. X         IRULESRC = $(CONFIGDIR)
  321. X        IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES)
  322. X
  323. X     ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules \
  324. X            $(IRULESRC)/Project.tmpl $(IRULESRC)/site.def \
  325. X            $(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES)
  326. X
  327. X# -------------------------------------------------------------------------
  328. X# X Window System Build Parameters
  329. X# $XConsortium: Project.tmpl,v 1.138 91/09/10 09:02:12 rws Exp $
  330. X
  331. X# -------------------------------------------------------------------------
  332. X# X Window System make variables; this need to be coordinated with rules
  333. X
  334. X          PATHSEP = /
  335. X        USRLIBDIR = $(DESTDIR)/usr/local/lib
  336. X           BINDIR = $(DESTDIR)/usr/dist/bin
  337. X          INCROOT = $(DESTDIR)/usr/include
  338. X     BUILDINCROOT = $(TOP)
  339. X      BUILDINCDIR = $(BUILDINCROOT)/X11
  340. X      BUILDINCTOP = ..
  341. X           INCDIR = $(INCROOT)/X11
  342. X           ADMDIR = /usr/adm
  343. X           LIBDIR = $(USRLIBDIR)/X11
  344. X        CONFIGDIR = $(LIBDIR)/config
  345. X       LINTLIBDIR = $(DESTDIR)/usr/lib/lint
  346. X
  347. X          FONTDIR = $(LIBDIR)/fonts
  348. X         XINITDIR = $(LIBDIR)/xinit
  349. X           XDMDIR = $(LIBDIR)/xdm
  350. X           TWMDIR = $(LIBDIR)/twm
  351. X          MANPATH = /usr/dist/man
  352. X    MANSOURCEPATH = $(MANPATH)/man
  353. X        MANSUFFIX = 1
  354. X     LIBMANSUFFIX = 3
  355. X           MANDIR = $(MANSOURCEPATH)$(MANSUFFIX)
  356. X        LIBMANDIR = $(MANSOURCEPATH)$(LIBMANSUFFIX)
  357. X           NLSDIR = $(LIBDIR)/nls
  358. X        PEXAPIDIR = $(LIBDIR)/PEX
  359. X      XAPPLOADDIR = $(LIBDIR)/app-defaults
  360. X       FONTCFLAGS = -t
  361. X
  362. X     INSTAPPFLAGS = $(INSTDATFLAGS)
  363. X
  364. X            IMAKE = imake
  365. X           DEPEND = makedepend
  366. X              RGB = rgb
  367. X
  368. X            FONTC = bdftopcf
  369. X
  370. X        MKFONTDIR = mkfontdir
  371. X        MKDIRHIER = /bin/sh $(BINDIR)/mkdirhier
  372. X
  373. X        CONFIGSRC = $(TOP)/config
  374. X       DOCUTILSRC = $(TOP)/doc/util
  375. X        CLIENTSRC = $(TOP)/clients
  376. X          DEMOSRC = $(TOP)/demos
  377. X           LIBSRC = $(TOP)/lib
  378. X          FONTSRC = $(TOP)/fonts
  379. X       INCLUDESRC = $(TOP)/X11
  380. X        SERVERSRC = $(TOP)/server
  381. X          UTILSRC = $(TOP)/util
  382. X        SCRIPTSRC = $(UTILSRC)/scripts
  383. X       EXAMPLESRC = $(TOP)/examples
  384. X       CONTRIBSRC = $(TOP)/../contrib
  385. X           DOCSRC = $(TOP)/doc
  386. X           RGBSRC = $(TOP)/rgb
  387. X        DEPENDSRC = $(UTILSRC)/makedepend
  388. X         IMAKESRC = $(CONFIGSRC)
  389. X         XAUTHSRC = $(LIBSRC)/Xau
  390. X          XLIBSRC = $(LIBSRC)/X
  391. X           XMUSRC = $(LIBSRC)/Xmu
  392. X       TOOLKITSRC = $(LIBSRC)/Xt
  393. X       AWIDGETSRC = $(LIBSRC)/Xaw
  394. X       OLDXLIBSRC = $(LIBSRC)/oldX
  395. X      XDMCPLIBSRC = $(LIBSRC)/Xdmcp
  396. X      BDFTOSNFSRC = $(FONTSRC)/bdftosnf
  397. X      BDFTOSNFSRC = $(FONTSRC)/clients/bdftosnf
  398. X      BDFTOPCFSRC = $(FONTSRC)/clients/bdftopcf
  399. X     MKFONTDIRSRC = $(FONTSRC)/clients/mkfontdir
  400. X         FSLIBSRC = $(FONTSRC)/lib/fs
  401. X    FONTSERVERSRC = $(FONTSRC)/server
  402. X     EXTENSIONSRC = $(TOP)/extensions
  403. X         XILIBSRC = $(EXTENSIONSRC)/lib/xinput
  404. X      PHIGSLIBSRC = $(EXTENSIONSRC)/lib/PEX
  405. X
  406. X# $XConsortium: sunLib.tmpl,v 1.14.1.1 92/03/17 14:58:46 rws Exp $
  407. X
  408. XSHLIBLDFLAGS = -assert pure-text
  409. XPICFLAGS = -pic
  410. X
  411. X  DEPEXTENSIONLIB =
  412. X     EXTENSIONLIB = -lXext
  413. X
  414. X          DEPXLIB = $(DEPEXTENSIONLIB)
  415. X             XLIB = $(EXTENSIONLIB) -lX11
  416. X
  417. X        DEPXMULIB = $(USRLIBDIR)/libXmu.sa.$(SOXMUREV)
  418. X       XMULIBONLY = -lXmu
  419. X           XMULIB = -lXmu
  420. X
  421. X       DEPOLDXLIB =
  422. X          OLDXLIB = -loldX
  423. X
  424. X      DEPXTOOLLIB = $(USRLIBDIR)/libXt.sa.$(SOXTREV)
  425. X         XTOOLLIB = -lXt
  426. X
  427. X        DEPXAWLIB = $(USRLIBDIR)/libXaw.sa.$(SOXAWREV)
  428. X           XAWLIB = -lXaw
  429. X
  430. X        DEPXILIB =
  431. X           XILIB = -lXi
  432. X
  433. X        SOXLIBREV = 4.10
  434. X          SOXTREV = 4.10
  435. X         SOXAWREV = 5.0
  436. X        SOOLDXREV = 4.10
  437. X         SOXMUREV = 4.10
  438. X        SOXEXTREV = 4.10
  439. X      SOXINPUTREV = 4.10
  440. X
  441. X      DEPXAUTHLIB = $(USRLIBDIR)/libXau.a
  442. X         XAUTHLIB =  -lXau
  443. X      DEPXDMCPLIB = $(USRLIBDIR)/libXdmcp.a
  444. X         XDMCPLIB =  -lXdmcp
  445. X
  446. X        DEPPHIGSLIB = $(USRLIBDIR)/libphigs.a
  447. X           PHIGSLIB =  -lphigs
  448. X
  449. X       DEPXBSDLIB = $(USRLIBDIR)/libXbsd.a
  450. X          XBSDLIB =  -lXbsd
  451. X
  452. X LINTEXTENSIONLIB = $(LINTLIBDIR)/llib-lXext.ln
  453. X         LINTXLIB = $(LINTLIBDIR)/llib-lX11.ln
  454. X          LINTXMU = $(LINTLIBDIR)/llib-lXmu.ln
  455. X        LINTXTOOL = $(LINTLIBDIR)/llib-lXt.ln
  456. X          LINTXAW = $(LINTLIBDIR)/llib-lXaw.ln
  457. X           LINTXI = $(LINTLIBDIR)/llib-lXi.ln
  458. X        LINTPHIGS = $(LINTLIBDIR)/llib-lphigs.ln
  459. X
  460. X          DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)
  461. X
  462. X         DEPLIBS1 = $(DEPLIBS)
  463. X         DEPLIBS2 = $(DEPLIBS)
  464. X         DEPLIBS3 = $(DEPLIBS)
  465. X
  466. X# -------------------------------------------------------------------------
  467. X# Imake rules for building libraries, programs, scripts, and data files
  468. X# rules:  $XConsortium: Imake.rules,v 1.123 91/09/16 20:12:16 rws Exp $
  469. X
  470. X# -------------------------------------------------------------------------
  471. X# start of Imakefile
  472. X
  473. X#
  474. X# xbomb imakefile
  475. X#
  476. X# %W% (UCLA) %G%
  477. X#
  478. X
  479. X#
  480. X# BEGIN: User customizable things.
  481. X#
  482. X
  483. X# You probably want to change where things go
  484. X         EXEDIR = /usr/dist/games
  485. X       XBLIBDIR = /usr/dist/games/lib/xbomb
  486. X      SCOREFILE = $(XBLIBDIR)/xbomb_score
  487. X      BITMAPDIR = $(XBLIBDIR)/bitmaps
  488. X
  489. X      SOLVERDIR = $(XBLIBDIR)/solvers
  490. X
  491. X# You may want to make things not-setuid.
  492. X# If so, scores must be world-writable.
  493. X     XBOMBFLAGS = -o games -m 4755
  494. X    SOLVERFLAGS = -o games
  495. X    BITMAPFLAGS = -o games -m 644
  496. X    CDEBUGFLAGS = -g
  497. X
  498. X           PERL = /usr/local/bin/perl
  499. X
  500. X# Your man pages may have funny endings.
  501. X GAMESMANSUFFIX = 6
  502. X
  503. X# Things for various kinds of system brain-damange.
  504. X
  505. X# If your C libraries lack strdup, define LACKS_STRDUP.
  506. X# (It's such a hard thing to QA, I can see why they don't provide it.)
  507. X
  508. X#
  509. X# END: User customizable things.
  510. X#
  511. X
  512. XDEFINES = -D_PATH_SCORE='"$(SCOREFILE)"' -D_PATH_SOLVERS='"$(SOLVERDIR)"' -D_PATH_BITMAPS='"$(BITMAPDIR)"'
  513. X
  514. XSRCS = $(XBOMB_SRCS) pattern_solver.c forced_solver.c prob_solver.c \
  515. X    solver_io.c infer_solver.c
  516. XTOSHAR += $(SRCS)
  517. X
  518. XHFILES = patchlevel.h solver_io.h xbomb.h icon.bit
  519. XTOSHAR += $(HFILES)
  520. X
  521. XMANPAGE = xbomb.man
  522. X
  523. XTOSHAR += $(MANPAGE)
  524. X
  525. X#
  526. X# xbomb is done by hand
  527. X#
  528. XXBOMB_SRCS = main.c map.c applications.c actions.c graphics.c solvers.c score.c
  529. XXBOMB_OBJS = main.o map.o applications.o actions.o graphics.o solvers.o score.o
  530. X
  531. Xall:: xbomb
  532. X
  533. Xxbomb: $(XBOMB_OBJS)
  534. X    $(RM) $@
  535. X    $(CC) -o $@ $(XBOMB_OBJS) $(LDOPTIONS)  $(LDLIBS) $(XLIB) $(EXTRA_LOAD_FLAGS)
  536. X
  537. Xclean::
  538. X    $(RM) xbomb
  539. X
  540. Xinstall:: xbomb
  541. X    @if [ -d $(DESTDIR)$(EXEDIR) ]; then set +x; \
  542. X    else (set -x; $(MKDIRHIER) $(DESTDIR)$(EXEDIR)); fi
  543. X    $(INSTALL) -c $(INSTPGMFLAGS) $(XBOMBFLAGS) xbomb $(DESTDIR)$(EXEDIR)
  544. X
  545. Xinstall.man:: xbomb.man
  546. X    @if [ -d $(DESTDIR)$(OURMANSUFFIX) ]; then set +x; \
  547. X    else (set -x; $(MKDIRHIER) $(DESTDIR)$(OURMANSUFFIX)); fi
  548. X    $(INSTALL) -c $(INSTMANFLAGS) xbomb.man $(MANSOURCEPATH)$(GAMESMANSUFFIX)/xbomb.$(GAMESMANSUFFIX)
  549. X
  550. Xclean::
  551. X    $(RM) xbomb
  552. X
  553. X#
  554. X# solvers follow
  555. X#
  556. X
  557. Xall:: pattern_solver
  558. X
  559. Xpattern_solver: pattern_solver.o solver_io.o
  560. X    $(RM) $@
  561. X    $(CC) -o $@ pattern_solver.o solver_io.o $(LDOPTIONS)  $(LDLIBS)  $(EXTRA_LOAD_FLAGS)
  562. X
  563. Xclean::
  564. X    $(RM) pattern_solver
  565. X
  566. Xinstall:: pattern_solver
  567. X    @if [ -d $(DESTDIR)$(SOLVERDIR) ]; then set +x; \
  568. X    else (set -x; $(MKDIRHIER) $(DESTDIR)$(SOLVERDIR)); fi
  569. X    $(INSTALL) -c $(INSTPGMFLAGS) $(SOLVERFLAGS) pattern_solver $(DESTDIR)$(SOLVERDIR)
  570. X
  571. Xclean::
  572. X    $(RM) $(PROGRAM)
  573. X
  574. Xall:: forced_solver
  575. X
  576. Xforced_solver: forced_solver.o solver_io.o
  577. X    $(RM) $@
  578. X    $(CC) -o $@ forced_solver.o solver_io.o $(LDOPTIONS)  $(LDLIBS)  $(EXTRA_LOAD_FLAGS)
  579. X
  580. Xclean::
  581. X    $(RM) forced_solver
  582. X
  583. Xinstall:: forced_solver
  584. X    @if [ -d $(DESTDIR)$(SOLVERDIR) ]; then set +x; \
  585. X    else (set -x; $(MKDIRHIER) $(DESTDIR)$(SOLVERDIR)); fi
  586. X    $(INSTALL) -c $(INSTPGMFLAGS) $(SOLVERFLAGS) forced_solver $(DESTDIR)$(SOLVERDIR)
  587. X
  588. Xclean::
  589. X    $(RM) $(PROGRAM)
  590. X
  591. Xall:: prob_solver
  592. X
  593. Xprob_solver: prob_solver.o solver_io.o
  594. X    $(RM) $@
  595. X    $(CC) -o $@ prob_solver.o solver_io.o $(LDOPTIONS)  $(LDLIBS)  $(EXTRA_LOAD_FLAGS)
  596. X
  597. Xclean::
  598. X    $(RM) prob_solver
  599. X
  600. Xinstall:: prob_solver
  601. X    @if [ -d $(DESTDIR)$(SOLVERDIR) ]; then set +x; \
  602. X    else (set -x; $(MKDIRHIER) $(DESTDIR)$(SOLVERDIR)); fi
  603. X    $(INSTALL) -c $(INSTPGMFLAGS) $(SOLVERFLAGS) prob_solver $(DESTDIR)$(SOLVERDIR)
  604. X
  605. Xclean::
  606. X    $(RM) $(PROGRAM)
  607. X
  608. Xall:: infer_solver
  609. X
  610. Xinfer_solver: infer_solver.o solver_io.o
  611. X    $(RM) $@
  612. X    $(CC) -o $@ infer_solver.o solver_io.o $(LDOPTIONS)  $(LDLIBS)  $(EXTRA_LOAD_FLAGS)
  613. X
  614. Xclean::
  615. X    $(RM) infer_solver
  616. X
  617. Xinstall:: infer_solver
  618. X    @if [ -d $(DESTDIR)$(SOLVERDIR) ]; then set +x; \
  619. X    else (set -x; $(MKDIRHIER) $(DESTDIR)$(SOLVERDIR)); fi
  620. X    $(INSTALL) -c $(INSTPGMFLAGS) $(SOLVERFLAGS) infer_solver $(DESTDIR)$(SOLVERDIR)
  621. X
  622. Xclean::
  623. X    $(RM) $(PROGRAM)
  624. X
  625. Xstatistics.script: statistics
  626. X    sed "s;/usr/.*/perl;$(PERL);" <statistics >statistics.script
  627. X
  628. XTOSHAR += statistics
  629. X
  630. Xinstall:: statistics.script
  631. X    @if [ -d $(DESTDIR)$(SOLVERDIR) ]; then set +x; \
  632. X    else (set -x; $(MKDIRHIER) $(DESTDIR)$(SOLVERDIR)); fi
  633. X    $(INSTALL) -c $(INSTBINFLAGS) statistics.script $(DESTDIR)$(SOLVERDIR)/statistics
  634. X
  635. Xdebug_solver.script: debug_solver
  636. X    sed "s;/usr/.*/perl;$(PERL);" <debug_solver >debug_solver.script
  637. X
  638. XTOSHAR += debug_solver
  639. X
  640. Xinstall:: debug_solver.script
  641. X    @if [ -d $(DESTDIR)$(SOLVERDIR) ]; then set +x; \
  642. X    else (set -x; $(MKDIRHIER) $(DESTDIR)$(SOLVERDIR)); fi
  643. X    $(INSTALL) -c $(INSTBINFLAGS) debug_solver.script $(DESTDIR)$(SOLVERDIR)/debug_solver
  644. X
  645. X#
  646. X# administrative stuff
  647. X#
  648. X
  649. Xdepend::
  650. X    $(DEPEND) $(DEPENDFLAGS) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS)
  651. X
  652. X# bitmap installation
  653. X
  654. Xinstall:: install.bitmaps
  655. X
  656. Xinstall.bitmaps: bitmap.files
  657. X    @if [ -d $(BITMAPDIR) ]; then set +x; \
  658. X    else (set -x; $(MKDIRHIER) $(BITMAPDIR)); fi
  659. X    for i in `cat bitmap.files`; \
  660. X    do \
  661. X        j=`echo $$i|sed 's:^./bitmaps:./:'`; \
  662. X        if [ "$$j" != "./" ]; then \
  663. X            if [ -d $$i ]; then \
  664. X                echo Installing dir $$i...; \
  665. X                @if [ -d $(BITMAPDIR)/$$j ]; then set +x; \
  666. X    else (set -x; $(MKDIRHIER) $(BITMAPDIR)/$$j); fi; \
  667. X            else \
  668. X                echo Installing bitmap $$i...; \
  669. X                $(INSTALL) -c $(BITMAPFLAGS) $$i $(BITMAPDIR)/`dirname $$j`; \
  670. X            fi; \
  671. X        fi; \
  672. X    done
  673. X    @echo Bitmaps installed.
  674. X
  675. X#
  676. X# distribution
  677. X#
  678. X
  679. XTOSHAR += README TODO Imakefile Makefile.std
  680. X
  681. Xbitmap.files:
  682. X    find ./bitmaps \( -name \*.bit -o -type d \) -print >bitmap.files
  683. X
  684. Xkit: Makefile.std
  685. X    makekit $(TOSHAR) `cat bitmap.files`
  686. X
  687. Xshar: Makefile.std
  688. X    shar $(TOSHAR) `cat bitmap.files` >xbomb.shar
  689. X
  690. XMakefile.std:
  691. X    cp Makefile Makefile.std
  692. X
  693. X# -------------------------------------------------------------------------
  694. X# common rules for all Makefiles - do not edit
  695. X
  696. Xemptyrule::
  697. X
  698. Xclean::
  699. X    $(RM_CMD) "#"*
  700. X
  701. XMakefile::
  702. X    -@if [ -f Makefile ]; then set -x; \
  703. X    $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
  704. X    else exit 0; fi
  705. X    $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR)
  706. X
  707. Xtags::
  708. X    $(TAGS) -tw *.[ch]
  709. X
  710. Xsaber:
  711. X    # load $(ALLDEFINES) $(SRCS)
  712. X
  713. Xosaber:
  714. X    # load $(ALLDEFINES) $(OBJS)
  715. X
  716. X# -------------------------------------------------------------------------
  717. X# empty rules for directories that do not have SUBDIRS - do not edit
  718. X
  719. Xinstall::
  720. X    @echo "install in $(CURRENT_DIR) done"
  721. X
  722. Xinstall.man::
  723. X    @echo "install.man in $(CURRENT_DIR) done"
  724. X
  725. XMakefiles::
  726. X
  727. Xincludes::
  728. X
  729. X# -------------------------------------------------------------------------
  730. X# dependencies generated by makedepend
  731. X
  732. END_OF_FILE
  733. if test 14703 -ne `wc -c <'Makefile.std'`; then
  734.     echo shar: \"'Makefile.std'\" unpacked with wrong size!
  735. fi
  736. # end of 'Makefile.std'
  737. fi
  738. if test ! -d 'bitmaps' ; then
  739.     echo shar: Creating directory \"'bitmaps'\"
  740.     mkdir 'bitmaps'
  741. fi
  742. if test ! -d 'bitmaps/old' ; then
  743.     echo shar: Creating directory \"'bitmaps/old'\"
  744.     mkdir 'bitmaps/old'
  745. fi
  746. if test ! -d 'bitmaps/roman' ; then
  747.     echo shar: Creating directory \"'bitmaps/roman'\"
  748.     mkdir 'bitmaps/roman'
  749. fi
  750. if test ! -d 'bitmaps/standard' ; then
  751.     echo shar: Creating directory \"'bitmaps/standard'\"
  752.     mkdir 'bitmaps/standard'
  753. fi
  754. if test -f 'graphics.c' -a "${1}" != "-c" ; then 
  755.   echo shar: Will not clobber existing file \"'graphics.c'\"
  756. else
  757. echo shar: Extracting \"'graphics.c'\" \(13258 characters\)
  758. sed "s/^X//" >'graphics.c' <<'END_OF_FILE'
  759. X
  760. X/*
  761. X * graphics.c
  762. X * @(#)graphics.c    1.32 (UCLA) 10/16/92
  763. X *
  764. X * xbomb is Copyright (C) 1992 by Matthew Merzbacher, Los Angeles, CA.
  765. X * All rights reserved.  Permission is granted to freely distribute
  766. X * this as long as this copyright message is retained intact.
  767. X * Permission to distribute this as part of a commerical product
  768. X * requires explicit permission of the author.
  769. X *
  770. X */
  771. X
  772. X#include "icon.bit"
  773. X
  774. X#include "xbomb.h"
  775. X#include <sys/param.h>
  776. X
  777. X    
  778. Xint borderWidth = -1;
  779. Xchar *geom = "";
  780. Xchar *bitdir = NULL;
  781. X
  782. X    
  783. XDisplay     *dpy;
  784. Xint         screen;
  785. XGC          gc;
  786. X    
  787. XWindow      rootWindow, puzzleWindow;
  788. Xlong        FgPixel, BgPixel, BdPixel;
  789. X    
  790. XPixmap pixmaps[20];
  791. X    
  792. X
  793. X
  794. XPixmap
  795. XpiecePixmap(x,y) 
  796. X    int x, y;
  797. X{ 
  798. X    if (map[x][y].status == KEMPTY) {
  799. X        if (!ted)
  800. X            return(pixmaps[map[x][y].neighbors]);
  801. X        else
  802. X            return(pixmaps[map[x][y].neighbors - map[x][y].neighbor_kbombs]);
  803. X    }
  804. X    if (map[x][y].status == KBOMB)
  805. X        return(pixmaps[BOMB]);
  806. X    if (map[x][y].status == EBOMB)
  807. X        return(pixmaps[EBOMB]);
  808. X    if (map[x][y].flag)
  809. X        return(pixmaps[FLAG]);
  810. X    if (map[x][y].status == BOMB)
  811. X        return(pixmaps[EMPTY]);
  812. X    if (map[x][y].status == EMPTY)
  813. X        return(pixmaps[EMPTY]);
  814. X    
  815. X    fprintf(stderr,"Unknown status: (%d, %d) %d\n", x, y, map[x][y].status);
  816. X}
  817. X
  818. Xvoid
  819. Xputpix(c, r)
  820. X    int c, r;
  821. X{
  822. X    XCopyPlane(dpy, piecePixmap(c,r), puzzleWindow, gc,
  823. X           0, 0, WIDTH, HEIGHT,
  824. X           c*WIDTH, (r+1)*HEIGHT, 1);
  825. X}
  826. X
  827. X
  828. Xint
  829. Xxfcb(file, w, h, ret)
  830. X    char *file;
  831. X    int *w, *h;
  832. X    Pixmap *ret;
  833. X{
  834. X    int hx, hy;
  835. X    int retcode;
  836. X    char s[80];
  837. X
  838. X    retcode = XReadBitmapFile(dpy, rootWindow, file, w, h, ret, &hx, &hy);
  839. X
  840. X    if ((retcode == BitmapOpenFailed) || (retcode == BitmapSuccess)) {
  841. X        return(retcode);
  842. X    }
  843. X
  844. X    switch(retcode) {
  845. X    case BitmapFileInvalid:
  846. X        sprintf(s,"Invalid bitmap file format: %s", file);
  847. X        bail(s);
  848. X        break;
  849. X    case BitmapNoMemory:
  850. X        sprintf(s,"Insufficient Memory opening file: %s", file);
  851. X        bail(s);
  852. X        break;
  853. X    default:
  854. X        bail("A very bad thing has happened while reading a bitmap");
  855. X    }
  856. X}
  857. X
  858. X
  859. Xstatic struct bit_to_load {
  860. X    char *name;
  861. X    int place;
  862. X} btl[] = {
  863. X    "bomb.bit", BOMB,
  864. X    "empty.bit", EMPTY,
  865. X    "ebomb.bit", EBOMB,
  866. X    "flag.bit", FLAG,
  867. X    "blank.bit", BLANK,
  868. X    "think.bit", THINK,
  869. X    "known0.bit", 0,
  870. X    "known1.bit", 1,
  871. X    "known2.bit", 2,
  872. X    "known3.bit", 3,
  873. X    "known4.bit", 4,
  874. X    "known5.bit", 5,
  875. X    "known6.bit", 6,
  876. X    "known7.bit", 7,
  877. X    "known8.bit", 8,
  878. X    "known9.bit", 9,
  879. X    NULL, 19
  880. X    };
  881. X
  882. X
  883. Xmake_bitmaps()
  884. X{
  885. X    int dummyw, dummyh;
  886. X    int i, gotit;
  887. X    char filename[MAXPATHLEN];
  888. X
  889. X    static char *defbitdir = "standard";
  890. X
  891. X    for (i = 0; btl[i].name != NULL; i++) {
  892. X        gotit = 0;
  893. X        if (bitdir) {
  894. X            sprintf(filename, "%s/%s/%s", 
  895. X                _PATH_BITMAPS, bitdir, btl[i].name);
  896. X            if (xfcb(filename, &dummyw, &dummyh, 
  897. X                 &(pixmaps[btl[i].place])) == BitmapSuccess)
  898. X                gotit = 1;
  899. X        }
  900. X        if (!gotit) {
  901. X            sprintf(filename, "%s/%s/%s", 
  902. X                _PATH_BITMAPS, defbitdir, btl[i].name);
  903. X            if (xfcb(filename, &dummyw, &dummyh, 
  904. X                 &(pixmaps[btl[i].place])) == BitmapOpenFailed)
  905. X            {
  906. X                sprintf(filename, "Unable to open bitmap: %s", 
  907. X                    btl[i].name);
  908. X                bail(filename);
  909. X            }
  910. X        }
  911. X    }
  912. X                            
  913. X
  914. X/***
  915. X    xfcb("bitmaps/bomb.bit", &dummyw, &dummyh, &(pixmaps[BOMB]));
  916. X    xfcb("bitmaps/empty.bit", &dummyw, &dummyh, &(pixmaps[EMPTY]));
  917. X    xfcb("bitmaps/ebomb.bit", &dummyw, &dummyh, &(pixmaps[EBOMB]));
  918. X    xfcb("bitmaps/flag.bit", &dummyw, &dummyh, &(pixmaps[FLAG]));
  919. X    xfcb("bitmaps/blank.bit", &dummyw, &dummyh, &(pixmaps[BLANK]));
  920. X    xfcb("bitmaps/think.bit", &dummyw, &dummyh, &(pixmaps[THINK]));
  921. X    xfcb("bitmaps/known0.bit", &dummyw, &dummyh, &(pixmaps[0]));
  922. X    xfcb("bitmaps/known1.bit", &dummyw, &dummyh, &(pixmaps[1]));
  923. X    xfcb("bitmaps/known2.bit", &dummyw, &dummyh, &(pixmaps[2]));
  924. X    xfcb("bitmaps/known3.bit", &dummyw, &dummyh, &(pixmaps[3]));
  925. X    xfcb("bitmaps/known4.bit", &dummyw, &dummyh, &(pixmaps[4]));
  926. X    xfcb("bitmaps/known5.bit", &dummyw, &dummyh, &(pixmaps[5]));
  927. X    xfcb("bitmaps/known6.bit", &dummyw, &dummyh, &(pixmaps[6]));
  928. X    xfcb("bitmaps/known7.bit", &dummyw, &dummyh, &(pixmaps[7]));
  929. X    xfcb("bitmaps/known8.bit", &dummyw, &dummyh, &(pixmaps[8]));
  930. X    xfcb("bitmaps/known9.bit", &dummyw, &dummyh, &(pixmaps[9]));
  931. X***/
  932. X}
  933. X
  934. Xvoid
  935. Xcleanup_pixmaps()
  936. X{
  937. X    if (pixmaps[EMPTY] != NULL) XFreePixmap(dpy, pixmaps[EMPTY]);
  938. X    if (pixmaps[BOMB] != NULL) XFreePixmap(dpy, pixmaps[BOMB]);
  939. X    if (pixmaps[EBOMB] != NULL) XFreePixmap(dpy, pixmaps[EBOMB]);
  940. X    if (pixmaps[FLAG] != NULL) XFreePixmap(dpy, pixmaps[FLAG]);
  941. X    if (pixmaps[BLANK] != NULL) XFreePixmap(dpy, pixmaps[BLANK]);
  942. X    if (pixmaps[THINK] != NULL) XFreePixmap(dpy, pixmaps[THINK]);
  943. X    if (pixmaps[0] != NULL) XFreePixmap(dpy, pixmaps[0]);
  944. X    if (pixmaps[1] != NULL) XFreePixmap(dpy, pixmaps[1]);
  945. X    if (pixmaps[2] != NULL) XFreePixmap(dpy, pixmaps[2]);
  946. X    if (pixmaps[3] != NULL) XFreePixmap(dpy, pixmaps[3]);
  947. X    if (pixmaps[4] != NULL) XFreePixmap(dpy, pixmaps[4]);
  948. X    if (pixmaps[5] != NULL) XFreePixmap(dpy, pixmaps[5]);
  949. X    if (pixmaps[6] != NULL) XFreePixmap(dpy, pixmaps[6]);
  950. X    if (pixmaps[7] != NULL) XFreePixmap(dpy, pixmaps[7]);
  951. X    if (pixmaps[8] != NULL) XFreePixmap(dpy, pixmaps[8]);
  952. X    if (pixmaps[9] != NULL) XFreePixmap(dpy, pixmaps[9]);
  953. X}
  954. X
  955. X
  956. XrequestColor(name)
  957. X    char *name;
  958. X{
  959. X    XColor truecolor, availcolor;
  960. X    
  961. X    if (XAllocNamedColor(dpy,
  962. X                 DefaultColormap(dpy, DefaultScreen(dpy)),
  963. X                 name, &availcolor, &truecolor) == 0) {
  964. X        fprintf(stderr, "Color '%s' unknown\n", name);
  965. X        exit(1);
  966. X    }
  967. X#if 0
  968. X    if (truecolor.red != availcolor.red ||
  969. X        truecolor.green != availcolor.green ||
  970. X        truecolor.blue != availcolor.blue) {
  971. X        fprintf(stderr, "Warning: %s color may be wrong\n", name);
  972. X    }
  973. X#endif
  974. X    
  975. X    return availcolor.pixel;
  976. X}
  977. X
  978. X
  979. X
  980. Xvoid 
  981. Xxmess(mess) 
  982. X    char *mess;
  983. X{
  984. X    XDrawString(dpy, puzzleWindow, gc, 10, HEIGHT*(height + 2) + 8, 
  985. X        mess, strlen(mess));
  986. X}
  987. X
  988. X
  989. Xint
  990. Xeventloop()
  991. X{
  992. X    XEvent event;
  993. X    XExposeEvent *ee = (XExposeEvent *)&event;
  994. X    XKeyPressedEvent *ke = (XKeyPressedEvent *)&event;
  995. X    XButtonPressedEvent *be = (XButtonPressedEvent *)&event;
  996. X    char keybuff[10];
  997. X    int nchar;
  998. X    char *mess1 = "You won!";
  999. X    char *mess2 = "(press anything to exit - 'r' to get your seed - 'n' to play again)";
  1000. X    char *mess2a = "(press anything to play again - 'r' to get your seed - 'q' to quit)";
  1001. X    char *mess3 = "Kabooom!";
  1002. X    char *autosolstr = "!@#$%^&*()";
  1003. X    char *solstr = "1234567890";
  1004. X    char schar;
  1005. X    int i, r, c;
  1006. X    int row, column, nrow, ncolumn;
  1007. X
  1008. X    while(1) {
  1009. X        if (dead || ((numempty == 1) && (numflags == 0))) {
  1010. X            if (!dead) xmess(mess1);
  1011. X            else {
  1012. X                reveal();
  1013. X                xmess(mess3);
  1014. X            }
  1015. X            if (playagain)
  1016. X                XDrawString(dpy, puzzleWindow, gc, 10, 
  1017. X                        HEIGHT*(height + 2) + 25, mess2a, 
  1018. X                        strlen(mess2a));
  1019. X            else
  1020. X                XDrawString(dpy, puzzleWindow, gc, 10, 
  1021. X                        HEIGHT*(height + 2) + 25, mess2, 
  1022. X                        strlen(mess2));
  1023. X            while (1) {
  1024. X                XNextEvent(dpy, &event);
  1025. X                switch(event.type) {
  1026. X                case KeyPress:
  1027. X                    nchar = XLookupString(ke, keybuff, 1, NULL, NULL);
  1028. X                    if (nchar > 0) {
  1029. X                        if (keybuff[0] == 'r')
  1030. X                            printf("Using seed: %i\n",seed);
  1031. X                        if ((playagain && keybuff[0] != 'q') || (keybuff[0] == 'n'))
  1032. X                            return(1);
  1033. X                    }
  1034. X                    finish();
  1035. X                    break;
  1036. X
  1037. X                case ButtonPress:
  1038. X                    if (playagain)
  1039. X                        return(1);
  1040. X                    finish();
  1041. X                    break;
  1042. X
  1043. X                case Expose:
  1044. X                    if (! ee->count)
  1045. X                        repaint();
  1046. X                    break;
  1047. X
  1048. X                default:
  1049. X                    break;
  1050. X                }
  1051. X            }
  1052. X        }
  1053. X
  1054. X        XNextEvent(dpy, &event);
  1055. X        switch(event.type) {
  1056. X        case KeyPress:
  1057. X            nchar = XLookupString(ke, keybuff, 1, NULL, NULL);
  1058. X            i = 0;
  1059. X            
  1060. X            if (nchar > 0) {
  1061. X                switch (keybuff[0]) {
  1062. X                case '\021':
  1063. X                    finish();
  1064. X
  1065. X                case 'g':
  1066. X                case 'G':
  1067. X                    place_random(keybuff[0]=='g' ? EMPTY : BOMB);
  1068. X                    break;
  1069. X
  1070. X                case 'S':
  1071. X                case 's':
  1072. X                    scan_em();
  1073. X                    break;
  1074. X
  1075. X                case 'p':
  1076. X                    place_em();
  1077. X                    print_score();
  1078. X                    break;
  1079. X                
  1080. X                case 'P':
  1081. X                case 'B':
  1082. X                case 'b':
  1083. X                    while (place_em() || scan_em())
  1084. X                        print_score();
  1085. X                    print_score();
  1086. X                    break;
  1087. X
  1088. X                case 'h':
  1089. X                case 'H':
  1090. X                case '?':
  1091. X                    help_me();
  1092. X                    break;
  1093. X                    
  1094. X                case '0':
  1095. X                    keybuff[0] += 10;
  1096. X                case '1':
  1097. X                case '2':
  1098. X                case '3':
  1099. X                case '4':
  1100. X                case '5':
  1101. X                case '6':
  1102. X                case '7':
  1103. X                case '8':
  1104. X                case '9':
  1105. X                    for (i = 0; solstr[i] != keybuff[0]; i++);
  1106. X                    invoke_solvers(i,
  1107. X                               XTOCOLUMN(be->x),
  1108. X                               YTOROW(be->y));
  1109. X                    print_score();
  1110. X                    break;
  1111. X                
  1112. X                case '!':
  1113. X                case '@':
  1114. X                case '#':
  1115. X                case '$':
  1116. X                case '%':
  1117. X                case '^':
  1118. X                case '&':
  1119. X                case '*':
  1120. X                case '(':
  1121. X                case ')':
  1122. X                    for (i = 0; autosolstr[i] != keybuff[0]; i++);
  1123. X
  1124. X                    if (solvers[i]) {
  1125. X                        while (invoke_solvers(i, -1, -1) ||
  1126. X                               place_em() || 
  1127. X                               scan_em())
  1128. X                            print_score();
  1129. X                        }
  1130. X                    break;
  1131. X                }
  1132. X            }
  1133. X            break;
  1134. X            
  1135. X        case ButtonPress:
  1136. X            button = event.xbutton.button;
  1137. X            shifted = (event.xbutton.state & ShiftMask) ? 1 : 0;
  1138. X            column = XTOCOLUMN(be->x);
  1139. X            row = YTOROW(be->y);
  1140. X            break;
  1141. X            
  1142. X        case ButtonRelease:
  1143. X            ncolumn = XTOCOLUMN(be->x);
  1144. X            nrow = YTOROW(be->y);
  1145. X            if ((button == event.xbutton.button)
  1146. X                && (ncolumn == column) && (nrow == row)
  1147. X                && (column > 0) && (column <= width)
  1148. X                && (row > 0) && (row <= height))
  1149. X                do_move(column, row);
  1150. X            break;
  1151. X            
  1152. X        case Expose:
  1153. X            if (! ee->count)
  1154. X                repaint();
  1155. X            break;
  1156. X            
  1157. X        default:
  1158. X            break;
  1159. X        }
  1160. X    }
  1161. X}
  1162. X
  1163. Xreveal()
  1164. X{
  1165. X    int c, r;
  1166. X    
  1167. X    for (c = 1; c <= width; c++)
  1168. X        for (r = 1; r <= height; r++) {
  1169. X            if (map[c][r].status == BOMB) map[c][r].status = EBOMB;
  1170. X        }
  1171. X    
  1172. X    repaint();
  1173. X    
  1174. X}
  1175. X
  1176. Xhelp_me() {
  1177. X    int sm;
  1178. X    char *mess1 = "Keyboard: s = scan; p = place; b = both (s & p); ^Q = quit";
  1179. X    char *mess2 = "Mouse: Left = empty; Right|Center|<Shift>-Any = flag";
  1180. X
  1181. X    sm = strlen(mess1);
  1182. X    XDrawString(dpy, puzzleWindow, gc, WIDTH, 
  1183. X            (height+3)*HEIGHT-25, mess1, sm);
  1184. X
  1185. X    sm = strlen(mess2);
  1186. X    XDrawString(dpy, puzzleWindow, gc, WIDTH,
  1187. X            (height+3)*HEIGHT-5, mess2, sm);
  1188. X
  1189. X}
  1190. X
  1191. Xrepaint()
  1192. X{
  1193. X    int c, r;
  1194. X    char *mess1 = "!sbmoB";
  1195. X    char *mess2 = "? for help";
  1196. X    int sm;
  1197. X
  1198. X    XClearWindow(dpy, puzzleWindow);
  1199. X    
  1200. X    for (c = 1; c <= width; c++)
  1201. X        for (r = 1; r <= height; r++) {
  1202. X            putpix(c, r);
  1203. X        }
  1204. X    
  1205. X    print_score();
  1206. X
  1207. X    sm = strlen(mess1);
  1208. X    XDrawString(dpy, puzzleWindow, gc, WIDTH*((width+1)/2) - sm, 
  1209. X            HEIGHT+12, mess1, sm);
  1210. X
  1211. X    sm = strlen(mess2);
  1212. X    XDrawString(dpy, puzzleWindow, gc, WIDTH*((width+1)/2) - sm, 
  1213. X            HEIGHT+30, mess2, sm);
  1214. X    
  1215. X}
  1216. X
  1217. X
  1218. Xdo_move(c, r)
  1219. X    int c, r;
  1220. X{
  1221. X    int move;
  1222. X    
  1223. X    move = FLAG;
  1224. X    
  1225. X    if ((button == Button1) & !shifted) move = CHECK;
  1226. X    
  1227. X    switch (move) {
  1228. X        
  1229. X    case CHECK:
  1230. X        move_somewhere(c, r);
  1231. X        break;
  1232. X        
  1233. X    case FLAG:
  1234. X        place_flag(c, r);
  1235. X        break;
  1236. X    }
  1237. X    
  1238. X    putpix(c, r);
  1239. X    
  1240. X    print_score();
  1241. X    
  1242. X}
  1243. X
  1244. X
  1245. X
  1246. X
  1247. Xgraphics_main(argc, argv)
  1248. X    int argc;
  1249. X    char **argv;
  1250. X{
  1251. X    int i, temp;
  1252. X    Visual visual;
  1253. X    XGCValues xgcv;
  1254. X    XSetWindowAttributes xswa;
  1255. X    XSizeHints sizehints;
  1256. X    
  1257. X    int total_width, total_height;
  1258. X    int maxwidth, maxheight;
  1259. X
  1260. X    /*************************************/
  1261. X    /** configure the window size hints **/
  1262. X    /*************************************/
  1263. X    
  1264. X    maxwidth = DisplayWidth(dpy, screen)/WIDTH - 2;
  1265. X    maxheight = DisplayHeight(dpy, screen)/HEIGHT - 4;
  1266. X    
  1267. X    if (maxwidth > MAXWIDTH) maxwidth = MAXWIDTH;
  1268. X    if (maxheight > MAXHEIGHT) maxheight = MAXHEIGHT;
  1269. X    
  1270. X    if (width < 2)
  1271. X        width = DEFWIDTH;
  1272. X    
  1273. X    if (width > maxwidth)
  1274. X        width = maxwidth;
  1275. X    
  1276. X    if (height < 2)
  1277. X        height = DEFHEIGHT;
  1278. X    
  1279. X    if (height > maxheight)
  1280. X        height = maxheight;
  1281. X    
  1282. X    if (numbombs < 1)
  1283. X        numbombs = width*height/4;
  1284. X    
  1285. X    if (numbombs > (width*height)/2)
  1286. X        numbombs = (width*height)/2;
  1287. X    
  1288. X    
  1289. X    total_width = (WIDTH * (width+2));
  1290. X    total_height = (HEIGHT * (height+3));
  1291. X    
  1292. X    sizehints.flags = PMinSize | PMaxSize | PPosition | PSize;
  1293. X    sizehints.min_width = total_width;
  1294. X    sizehints.min_height = total_height;
  1295. X    sizehints.max_width = total_width;
  1296. X    sizehints.max_height = total_height;
  1297. X    sizehints.width = total_width;
  1298. X    sizehints.height = total_height;
  1299. X    sizehints.x = 100;
  1300. X    sizehints.y = 300;
  1301. X    
  1302. X    if (geom && strlen(geom)) {
  1303. X        int mmwidth, mmheight, flags;
  1304. X        
  1305. X        flags = XParseGeometry(geom, &sizehints.x, &sizehints.y,
  1306. X                       &mmwidth, &mmheight);
  1307. X        if (flags & (XValue | YValue))
  1308. X            sizehints.flags |= USPosition;
  1309. X    }
  1310. X    
  1311. X    /*******************************************************************/
  1312. X    /** create the puzzle main window and set its standard properties **/
  1313. X    /*******************************************************************/
  1314. X    
  1315. X    xswa.event_mask = ExposureMask | ButtonPressMask |
  1316. X        ButtonReleaseMask | KeyPressMask;
  1317. X    xswa.background_pixel = BgPixel;
  1318. X    xswa.border_pixel = BdPixel;
  1319. X    xswa.cursor = XCreateFontCursor(dpy, XC_hand1);
  1320. X    
  1321. X    visual.visualid = CopyFromParent;
  1322. X    
  1323. X    rootWindow = RootWindow(dpy, screen);
  1324. X    
  1325. X    puzzleWindow = XCreateWindow(dpy, rootWindow,
  1326. X                     sizehints.x, sizehints.y,
  1327. X                     sizehints.width, sizehints.height,
  1328. X                     borderWidth,
  1329. X                     DefaultDepth(dpy,screen),
  1330. X                     InputOutput,
  1331. X                     &visual,
  1332. X                     CWCursor | CWEventMask | CWBackPixel | CWBorderPixel,
  1333. X                     &xswa);
  1334. X    
  1335. X    /*******************************************************************/
  1336. X    /** define its name and icon-bitmap                               **/
  1337. X    /*******************************************************************/
  1338. X    
  1339. X    XSetStandardProperties(dpy, puzzleWindow, "!sbmob","!sbmoB",
  1340. X                   XCreateBitmapFromData(dpy, rootWindow,
  1341. X                             icon_bits,
  1342. X                             icon_width, icon_height),
  1343. X                   argv, argc, &sizehints);
  1344. X    
  1345. X    XMapWindow(dpy, puzzleWindow);
  1346. X    
  1347. X    xgcv.foreground = FgPixel;
  1348. X    xgcv.background = BgPixel;
  1349. X    xgcv.line_width = 0;
  1350. X    xgcv.font = XLoadFont(dpy, "rk16");
  1351. X    gc = XCreateGC(dpy, puzzleWindow,
  1352. X               GCForeground|GCBackground|GCLineWidth|GCFont,
  1353. X               &xgcv);
  1354. X    
  1355. X    make_bitmaps();
  1356. X}
  1357. END_OF_FILE
  1358. if test 13258 -ne `wc -c <'graphics.c'`; then
  1359.     echo shar: \"'graphics.c'\" unpacked with wrong size!
  1360. fi
  1361. # end of 'graphics.c'
  1362. fi
  1363. if test -f 'map.c' -a "${1}" != "-c" ; then 
  1364.   echo shar: Will not clobber existing file \"'map.c'\"
  1365. else
  1366. echo shar: Extracting \"'map.c'\" \(2414 characters\)
  1367. sed "s/^X//" >'map.c' <<'END_OF_FILE'
  1368. X
  1369. X/*
  1370. X * map.c
  1371. X * @(#)map.c    1.27 (UCLA) 10/22/92
  1372. X *
  1373. X * xbomb is Copyright (C) 1992 by Matthew Merzbacher, Los Angeles, CA.
  1374. X * All rights reserved.  Permission is granted to freely distribute
  1375. X * this as long as this copyright message is retained intact.
  1376. X * Permission to distribute this as part of a commerical product
  1377. X * requires explicit permission of the author.
  1378. X *
  1379. X */
  1380. X
  1381. X#include "xbomb.h"
  1382. X
  1383. X
  1384. Xstruct cell map[MAXWIDTH+2][MAXHEIGHT+2];
  1385. X
  1386. Xvoid
  1387. Xcreate_cute_map()
  1388. X{
  1389. X    int x, y;
  1390. X    int mode=0;
  1391. X    int nb = numbombs;
  1392. X    int ns = width * height;
  1393. X
  1394. X    onlyprint = 1;   /* so they can't score */
  1395. X
  1396. X    for (x = 1; x <= width; x++)
  1397. X        for (y = 1; y <= height; y++)
  1398. X            switch (mode) {
  1399. X            case 0:
  1400. X                map[x][y].status = EMPTY;
  1401. X                ns--;
  1402. X                if (lrand48() % ns >= nb)
  1403. X                    break;
  1404. X                mode = 1;
  1405. X            case 1:
  1406. X                map[x][y].status = BOMB;
  1407. X                if (!--nb)
  1408. X                    mode = 2;
  1409. X                break;
  1410. X            case 2:
  1411. X                map[x][y].status = EMPTY;
  1412. X                break;
  1413. X            };
  1414. X}
  1415. X
  1416. X
  1417. Xcreate_map()
  1418. X{
  1419. X    int x, y, nb, nok;
  1420. X
  1421. X    for (x = 1; x <= width; x++)
  1422. X        for (y = 1; y <= height; y++) {
  1423. X            map[x][y].status = EMPTY;
  1424. X            map[x][y].flag = 0;
  1425. X            map[x][y].neighbors = 0;
  1426. X            map[x][y].neighbor_kbombs = 0;
  1427. X        }
  1428. X    
  1429. X    for (x = 0; x <= width+1; x++) {
  1430. X        map[x][0].status = BORDER;
  1431. X        map[x][height+1].status = BORDER;
  1432. X    }
  1433. X    
  1434. X    for (y = 0; y <= height+1; y++) {
  1435. X        map[0][y].status = BORDER;
  1436. X        map[width+1][y].status = BORDER;
  1437. X    }
  1438. X
  1439. X    for (nb = numbombs; nb > 0; nb--) {
  1440. X        do {
  1441. X            x = lrand48()%width + 1;
  1442. X            y = lrand48()%height + 1;
  1443. X            nok = (map[x][y].status != EMPTY);
  1444. X            if (!startwithzero) 
  1445. X              nok = nok || ((x == 1) && (y == 1));
  1446. X        } while (nok);
  1447. X        map[x][y].status = BOMB;
  1448. X    }
  1449. X
  1450. X
  1451. X    numempty = width*height - numbombs;
  1452. X    numflags = numbombs;
  1453. X
  1454. X    /* if (lrand48() % 20 == 0) create_cute_map(); */
  1455. X
  1456. X    
  1457. X    for (x = 1; x <= width; x++)
  1458. X        for (y = 1; y <= height; y++)
  1459. X            if (map[x][y].status == EMPTY) {
  1460. X                map[x][y].neighbors = 0;
  1461. X                apply_neighbor(x,y,apply_inc_if_bomb, &map[x][y].neighbors);
  1462. X            };
  1463. X
  1464. X    if (startwithzero) {
  1465. X        for (x = 1; x <= width; x++)
  1466. X            for (y = 1; y <= height; y++)
  1467. X                if ((map[x][y].status == EMPTY) &&
  1468. X                    (map[x][y].neighbors == 0)) {
  1469. X                    map[x][y].status = KEMPTY;
  1470. X                    follow(x,y);
  1471. X                    return(0);
  1472. X                    }
  1473. X        for (x = 1; x <= width; x++)
  1474. X            for (y = 1; y <= height; y++)
  1475. X                if (map[x][y].status == EMPTY) {
  1476. X                    map[x][y].status = KEMPTY;
  1477. X                    return(0);
  1478. X                    }
  1479. X        }
  1480. X    
  1481. X    if (map[1][1].status == EMPTY) {
  1482. X        map[1][1].status = KEMPTY;
  1483. X        if (map[1][1].neighbors == 0) follow(1,1);
  1484. X    };
  1485. X}
  1486. X
  1487. END_OF_FILE
  1488. if test 2414 -ne `wc -c <'map.c'`; then
  1489.     echo shar: \"'map.c'\" unpacked with wrong size!
  1490. fi
  1491. # end of 'map.c'
  1492. fi
  1493. if test -f 'patchlevel.h' -a "${1}" != "-c" ; then 
  1494.   echo shar: Will not clobber existing file \"'patchlevel.h'\"
  1495. else
  1496. echo shar: Extracting \"'patchlevel.h'\" \(39 characters\)
  1497. sed "s/^X//" >'patchlevel.h' <<'END_OF_FILE'
  1498. X#define VERSION 1
  1499. X#define PATCHLEVEL 2
  1500. END_OF_FILE
  1501. if test 39 -ne `wc -c <'patchlevel.h'`; then
  1502.     echo shar: \"'patchlevel.h'\" unpacked with wrong size!
  1503. fi
  1504. # end of 'patchlevel.h'
  1505. fi
  1506. if test -f 'xbomb.man' -a "${1}" != "-c" ; then 
  1507.   echo shar: Will not clobber existing file \"'xbomb.man'\"
  1508. else
  1509. echo shar: Extracting \"'xbomb.man'\" \(10580 characters\)
  1510. sed "s/^X//" >'xbomb.man' <<'END_OF_FILE'
  1511. X.TH XBOMB 6 "5 October 1992"
  1512. X
  1513. X.SH NAME
  1514. Xxbomb \- hunt the bombs
  1515. X
  1516. X.SH SYNOPSIS
  1517. X.B xbomb
  1518. X[
  1519. X.B options
  1520. X]
  1521. X
  1522. X.SH DESCRIPTION
  1523. X.LP
  1524. X.B xbomb
  1525. Xis an rewrite and extension of the
  1526. X.B minesweeper
  1527. Xgame found on various PCs.  The object of the game is to clear a field
  1528. Xof deadly bombs.  To do this requires only two mouse buttons, one key
  1529. Xand devastatingly clever wit.
  1530. X
  1531. XThe board is a rectangle of hidden bombs and empty spots.  When a bomb
  1532. Xis stepped on, you die, and the game is over.  When an empty spot is 
  1533. Xstepped on, you find out how many bombs are adjacent to the spot (horizontally,
  1534. Xvertically or diagonally).  With clever deduction, you can figure out where 
  1535. Xthe bombs must lie (and the bombs never lie).
  1536. X
  1537. XThe left mouse button establishes that a space on the board is empty.
  1538. XIt's as if you strolled onto that particular space.  If it is empty, then
  1539. Xit immediately becomes a number (as described above).  If there's a bomb,
  1540. Xthen, well, you can always play again.
  1541. X
  1542. XAny non-left mouse button (or 
  1543. X.I any 
  1544. Xshifted button) toggles a flag.  Flags are reminders to yourself that
  1545. Xthere's probably a bomb at that particular spot.  To help you out, the
  1546. Xtotal number of bombs left unflagged is presented in the upper left.
  1547. XIf you misplace a flag, then the number is decremented, but you don't
  1548. Xdie.
  1549. X
  1550. XThere are a few keystrokes that can help you (or kill you).
  1551. X
  1552. X.IP "\fB^Q\fP"
  1553. XQuit the game.  Always the best key to know when running a new program.
  1554. X
  1555. X.IP \fBg,G\fP
  1556. XMake a random guess somewhere on the board.  If it's empty, then you
  1557. Xget some knowledge.  If not, you die.  True afficianados scoff at this
  1558. Xmove.
  1559. X
  1560. X.IP \fBs,S\fP
  1561. XScan the board.  This turns all flags into bombs.  If a flag was placed
  1562. Xon an empty spot, then you die.  If not, it's a good way of establishing
  1563. Xyour hypotheses.
  1564. X
  1565. X.IP \fBp\fP
  1566. XPlace obvious flags.  Sometimes a flag position is obvious.  If, for example,
  1567. Xyou have an 8 on the board, then all of its neighbors must have bombs.
  1568. XThe 'p' key places any obvious flags.
  1569. X
  1570. X.IP "\fBP,B, or b\fP"
  1571. XPlace and Scan (both).  This places obvious flags, scans 'em, and repeats.
  1572. XMost useful.
  1573. X
  1574. X.IP "\fB0, 1, 2 ... 9\fP"
  1575. XInvoke a solver.  Solvers are set with the -S option, described below.
  1576. X
  1577. XYou are now ready to play, but you should probably use a few of the more
  1578. Xconvenient options, so read on...
  1579. X
  1580. X.SH "OPTIONS"
  1581. X.B Xbomb
  1582. Xhas more options than you can shake a stick at.  Here they are, in
  1583. Xsome kind of bizarre order, starting with common X options.  You are not
  1584. Xobliged to specify any of these, and you can specify most of them in your 
  1585. X.Xdefaults file as well (see below).  We recommend the latter approach.
  1586. X
  1587. X.IP "\fB-bg color\fP"
  1588. Xuse the specified color as the background color.
  1589. X
  1590. X.IP "\fB -fg color \fP"
  1591. Xuse the specified color as the foreground color.
  1592. X
  1593. X.IP "\fB -bd color \fP"
  1594. Xuse the specified color as the border color.
  1595. X
  1596. X.IP "\fB -bw width \fP"
  1597. Xspecify the border width.
  1598. X
  1599. X.IP "\fB -d display \fP"
  1600. Xuse a different server for display.
  1601. X
  1602. X.IP "\fB -g geometry \fP"
  1603. Xspecify the geometry.  The actual size of the window for 
  1604. X.B xbomb
  1605. Xis dictated by
  1606. Xthe width and height, but you can give an initial position.  I like +2+2 to
  1607. Xput it in the (almost) upper left.
  1608. X
  1609. XNow for the more interesting Non-X options...
  1610. X
  1611. X.IP "\fB -A \fP"
  1612. XAuto-replay mode.  If this is set, then when you die, you have to explicitly
  1613. Xquit to get out of the game.
  1614. X
  1615. X.IP "\fB -h height \fP"
  1616. XUse a board that is height spaces high.  A good value for this is 24.
  1617. XDefault is 20.
  1618. X
  1619. X.IP "\fB -w width \fP"
  1620. XUse a board that is width spaces wide.  A good value for this is 34.
  1621. XDefault is 20.
  1622. X
  1623. X.IP "\fB -f \fP"
  1624. XUse a better follow algorithm.  Consider an empty spot that has three
  1625. Xadjacent bombs.  If all three bombs have been established (using the 's'
  1626. Xkey), then the remainder of the neighbor spots must be empty.  The better
  1627. Xfollowing algorithm does this for you.  Playing the game without it a few
  1628. Xtimes will convince you that it's a godsend.
  1629. X
  1630. X.IP "\fB -n N \fP"
  1631. XHide N bombs on the map.  By default, N will be one quarter of the width
  1632. Xtimes the height.  Maximum, N will be one half the width times the height.
  1633. XSolving a maze filled with a quarter bombs is tough,
  1634. Xand solving a maze filled with more than a quarter bombs can quite ridiculious.
  1635. XOur record (for a 24x34 map) is 225 bombs (204 is one quarter).
  1636. X
  1637. X.IP "\fB -na name \fP"
  1638. XPlay using name instead of your userid.  The name must be at most 8 
  1639. Xcharacters long.
  1640. X
  1641. X.IP "\fB -q \fP"
  1642. XQuiet mode.  Only report the scores if you manage to break into the 
  1643. Xhigh scorers list.
  1644. X
  1645. X.IP "\fB -r seed \fP"
  1646. XPlay with a particular random seed.  This disables scoring, so don't
  1647. Xeven try it.  You can find out the random seed for a game when you die
  1648. Xby hitting 'r'.
  1649. X
  1650. X.IP "\fB -Re e \fP"
  1651. XStart the game with e random guessed empty squares.  Pretty dangerous, but
  1652. Xit's only a game.
  1653. X
  1654. X.IP "\fB -Rb f \fP"
  1655. XStart the game with f random guessed flags.  Extremely dangerous!
  1656. X
  1657. X.IP "\fB -s \fP"
  1658. XPrint the high score list.  By default (in the regular game), only the
  1659. Xtop 5 plus any scores you got are printed.  This prints the entire list.
  1660. X
  1661. X.IP "\fB -S solver \fP or \fB -S[1-9] solver \fP"
  1662. XAssign a solver.  Solvers (described below) are user programs that
  1663. Xdo better jobs of figuring out where empty spots and flags should be.
  1664. XThere are several solvers distributed with 
  1665. X.B xbomb ,
  1666. Xand this manual page
  1667. Xdescribes how to build them yourself.  A solver is bound to a given number key
  1668. Xso that when you hit that key, the solver is invoked.  If you don't
  1669. Xspecify a number, 
  1670. X.B xbomb
  1671. Xuses the next available spot.
  1672. X
  1673. XSolvers are given by pathname relative to the current directory,
  1674. Xor relative to the xbomb library (perhaps
  1675. X.B /usr/local/games/lib/xbomb
  1676. X).
  1677. X
  1678. X.IP "\fB -t \fP"
  1679. XTed mode!  Ted mode automatically decrements numbers whenever a bomb has
  1680. Xbeen established next to them.  Thus, when you do an 's' the numbers all
  1681. Xdecrement.  Now the numbers indicate the number of neighboring unplaced
  1682. Xbombs rather than the total number, and which makes the game lots easier
  1683. X(and more fun, if you ask me).
  1684. XWhy is it called Ted mode?  Ask Ted.
  1685. X
  1686. X.IP "\fB -z \fP"
  1687. XInstead of starting the game in the upper left corner, this will find a zero
  1688. Xsomewhere in the maze and start you there.  It makes the game easier, but
  1689. Xit also eliminates you from high scoring.
  1690. X
  1691. X.SH "X RESOURCES"
  1692. X
  1693. XMost of the options listed above can be specified as 
  1694. X.B xbomb
  1695. Xresources.  
  1696. XOf course, command line options override resources.
  1697. XHere's a full list.  Hopefully they're obvious from the corresponding
  1698. Xoptions listed above.
  1699. X
  1700. X.nf
  1701. Xxbomb.Foreground:        color
  1702. Xxbomb.Background:          color
  1703. Xxbomb.BorderColor:         color
  1704. Xxbomb.BorderWidth:         width
  1705. Xxbomb.Display:             display
  1706. Xxbomb.Geometry:            geometry
  1707. Xxbomb.AutoPlay:            on
  1708. Xxbomb.Follow:              on
  1709. Xxbomb.Width:               width
  1710. Xxbomb.Height:            height
  1711. Xxbomb.NumberBombs:        N
  1712. Xxbomb.Name:            name
  1713. Xxbomb.RandomEmpty:        e
  1714. Xxbomb.RandomBombs:        b
  1715. Xxbomb.Quiet:            on
  1716. Xxbomb.Solver[1-9]:        solver
  1717. Xxbomb.TedMode:            on
  1718. Xxbomb.StartWithZero:    on
  1719. X.fi
  1720. X
  1721. X
  1722. XI personally like the following:
  1723. X
  1724. X.nf
  1725. Xxbomb.Foreground:               PapayaWhip
  1726. Xxbomb.Background:               DarkBlue
  1727. Xxbomb.AutoPlay:                 on
  1728. Xxbomb.Follow:                   on
  1729. Xxbomb.TedMode:                  on
  1730. Xxbomb.Geometry:                 +2+2
  1731. Xxbomb.Height:                   24
  1732. Xxbomb.Width:                    34
  1733. Xxbomb.Solver1:                  pattern_solver
  1734. Xxbomb.Solver2:            statistics
  1735. Xxbomb.Solver3:                  prob_solver
  1736. Xxbomb.Quiet:                    on
  1737. X.fi
  1738. X
  1739. XNote that I have to specify the number of bombs on the command line, or
  1740. XI'll get the default (one quarter).
  1741. X
  1742. X.SH "SOLVER INTERFACE"
  1743. X
  1744. X.B Xbomb
  1745. Xallows ``solvers'' to assist the player in doing tedious parts
  1746. Xof the game.
  1747. XTo allow flexibility (and prevent cheating),
  1748. Xthese solvers are separate programs from the game itself.
  1749. XSolvers communcate only through standard input and output
  1750. Xwith the game.
  1751. X
  1752. XEach a user invokes a solver,
  1753. X.B xbomb 
  1754. Xprints the current state of the game to the
  1755. Xsolver's standard input (after starting the solver, of course).
  1756. XThe format of the game is:
  1757. X
  1758. X    INFORMATION
  1759. X
  1760. X    MAP
  1761. X
  1762. X``Information'' is a number line containing either ``numbombs N''
  1763. Xor ``mouse X Y'' (N, X, and Y are numbers).
  1764. X``Map'' is the line ``map'' followed by an ASCII copy of the map
  1765. Xterminated by a blank line.
  1766. XIn the map,
  1767. Xdigits show the number of neighboring bombs,
  1768. XX's show bombs that have been verified,
  1769. Xf's designate flags,
  1770. Xe's indicate squares flagged as ``empty'' (not yet implemented),
  1771. Xand periods are unknown squares.
  1772. X
  1773. XAfter a solver receives a map,
  1774. Xit must respond with any actions it wishes to take
  1775. Xfollowed by a blank line.  Each action is of the form ``X Y A''
  1776. Xwhere X and Y are the grid location and A is either ``f''
  1777. Xfor flag as a bomb, ``m'' for move to this location,
  1778. Xor ``e'' for flag as empty (``e'' is not yet implemented).
  1779. XA solver 
  1780. X.I must
  1781. Xrespond with at least a single blank line
  1782. Xor the game will not continue.
  1783. X
  1784. X.B xbomb
  1785. Xcomes with a bunch of solvers,  Well, three (or so).  Try 'em out.
  1786. XIn particular, 
  1787. X.B pattern_solver
  1788. Xis a must if you want to get anywhere in the world.  There is *no*
  1789. Xtruth to the rumor that it will be entered in next year's Obfuscated
  1790. XC code contest.
  1791. X
  1792. X.SH AUTHORS
  1793. X
  1794. X.B xbomb 
  1795. Xis mostly the fault of Matthew Merzbacher (matthew@cs.ucla.edu),
  1796. Xwho created absolutely no bugs at all.
  1797. XHe had altogether too much help from John Heidemann (johnh@cs.ucla.edu), 
  1798. Xwho was responsible for the solver interface,
  1799. Xand so introduced a bug allowing anyone to write the score file.
  1800. XMichial Gunter (gunter@cs.ucla.edu)
  1801. Xdid the random seed code,
  1802. Xintroducing a bug allowing anyone to complete any maze perfectly.
  1803. X
  1804. XLots of playtesters could
  1805. Xfill this man page, but we'll mention only Dave Ratner (ratner@cs.ucla.edu)
  1806. Xbecause he likes to see his name in print, Scott Turner (srt@aero.org)
  1807. Xbecause he was the first non-UCLA installer and because he always mentions
  1808. Xus in his man pages,
  1809. Xand Trent Bills (tbills@cse.unl.edu)
  1810. Xbecause we want him to include us in his man pages someday.
  1811. X
  1812. XIf you like this code, send us thanks, money, 
  1813. Xor a postcard from your next vacation.
  1814. X
  1815. X.nf
  1816. XMatthew Merzbacher
  1817. XJohn Heidemann
  1818. XMichial Gunter
  1819. XDave Ratner
  1820. X
  1821. XUCLA Computer Science
  1822. X3436 Boelter Hall
  1823. X405 Hilgard Ave.
  1824. XLos Angeles, CA
  1825. X90024
  1826. X.fi
  1827. X
  1828. X.SH LEGALESE
  1829. X
  1830. X.B xbomb
  1831. Xis Copyright (C) 1992 by Matthew Merzbacher, Los Angeles, CA.
  1832. XAll rights reserved.  Permission is granted to freely distribute
  1833. Xthis as long as this copyright message is retained intact.
  1834. XPermission to distribute this as part of a commerical product
  1835. Xrequires explicit permission of the author.
  1836. X
  1837. X
  1838. X.SH BUGS
  1839. XRapid, repeated solver invocations cause the program to bomb
  1840. Xwith a failed pipe.  Fix this, and you win a cookie.
  1841. X
  1842. X.SH "SEE ALSO"
  1843. X.BR X11(1)
  1844. END_OF_FILE
  1845. if test 10580 -ne `wc -c <'xbomb.man'`; then
  1846.     echo shar: \"'xbomb.man'\" unpacked with wrong size!
  1847. fi
  1848. # end of 'xbomb.man'
  1849. fi
  1850. echo shar: End of archive 1 \(of 4\).
  1851. cp /dev/null ark1isdone
  1852. MISSING=""
  1853. for I in 1 2 3 4 ; do
  1854.     if test ! -f ark${I}isdone ; then
  1855.     MISSING="${MISSING} ${I}"
  1856.     fi
  1857. done
  1858. if test "${MISSING}" = "" ; then
  1859.     echo You have unpacked all 4 archives.
  1860.     rm -f ark[1-9]isdone
  1861. else
  1862.     echo You still need to unpack the following archives:
  1863.     echo "        " ${MISSING}
  1864. fi
  1865. ##  End of shell archive.
  1866. exit 0
  1867.