• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

Hexagons.adH A D29-Jul-1999285 1413

Hexagons.cH A D02-Aug-199951.5 KiB1,7481,571

Hexagons.hH A D29-Jul-19992.2 KiB8241

HexagonsP.hH A D29-Jul-19994.1 KiB165114

HexagonsU.cH A D29-Jul-19996.3 KiB285224

ImakefileH A D31-Jul-19995 KiB183152

Makefile.inH A D10-Aug-19996.4 KiB257141

READMEH A D11-Aug-19996.9 KiB193155

config.guessH A D03-Feb-199719.9 KiB694598

config.subH A D03-Feb-199718.8 KiB928817

configureH A D10-Aug-199980.3 KiB2,7312,230

configure.inH A D10-Aug-199912.8 KiB467424

hexagons.scoresH A D05-Feb-1997315 2724

hexagons.xbmH A D03-Feb-19973.2 KiB4746

install-shH A D03-Feb-19975.5 KiB251152

make.comH A D05-Feb-19975.5 KiB209208

mkinstalldirsH A D03-Feb-1997579 3119

mouse-l.xbmH A D03-Feb-1997302 76

mouse-r.xbmH A D03-Feb-1997305 76

rngs.cH A D29-Jul-1999590 2913

xhexagons.cH A D29-Jul-199910.7 KiB398332

xhexagons.manH A D29-Jul-19995.6 KiB177153

xmhexagons.cH A D29-Jul-199915.2 KiB531454

README

1  X-BASED HEXAGONS
2  ================ Hexagons X widget, V5.5.2
3
4Primary site: ftp://ftp.tux.org/pub/tux/bagleyd/xpuzzles
5Secondary site: ftp://ftp.x.org/contrib/games/puzzles
6Web page: http://www.tux.org/~bagleyd/puzzles.html
7Maintainer: David A. Bagley <bagleyd@tux.org>
8
9  It has been tested on the following platforms:
10    Sun Ultra       SunOS 5.6-5.7
11    PC  Pentium     Linux 2.0.9
12    IBM PowerPC     AIX 4.3.1.0
13    HP  898         HP-UX 10.20
14
15  Previous versions tested on:
16    Sun SPARC       SunOS 5.5.1 (X11R5 & X11R6)
17    Sun SPARC       SunOS 4.1.3
18    PC  486         Linux 1.2.13(*)
19    DEC VAX & ALPHA VMS 6.1
20    HP  3xx & 700   HP-UX 9.01
21
22    * Keypad may not work, since various keycodes may not be defined
23      by default.  Check that "KP_1 - KP_9, Home, Up, Prior, Left,
24      Begin, Right, End, Down, Next" are defined towards the end of
25      /usr/lib/X11/etc/xmodmap.std .  If not defined
26      cp /usr/lib/X11/etc/xmodmap.std /usr/lib/X11/xinit/.Xmodmap
27      and then motify this or create your own at ${HOME}/.Xmodmap .
28      You should just have to uncomment them (get rid of some '!').
29      This should be done before X is started.  Also it may work better
30      with the Num-Lock on.
31
32  If you have to do any editing to get this to work, please mail me
33  the changes.
34
35HOW TO BUILD?
36
37  An ANSI C compiler is required for build.
38
39  To build, it should be easy.  There are 3 choices.
40
41    configure:
42      Relatively new so there is a good possiblity that it is not set up
43      correctly on your system.  You may want to set SCOREFILE and DATAFILE
44      in Makefile.in .
45
46      configure ; make
47
48    imake:
49      Sometimes this is not setup correctly by the distributer ... i.e. not
50      my fault.  You may want to set SCOREFILE and DATAFILE in Imakefile .
51      If you have Motif you may want to do this quick edit in the Imakefile:
52        Uncomment line "#define XpmLibrary".
53
54      xmkmf ; make
55
56    make.com (VMS users only):
57      You may want to set SCOREFILE and DATAFILE in make.com .
58
59      @make
60
61  Then just run "xhexagons" (or "xmhexagons" if you have Motif).
62  If you do a "make install" "SCOREFILE" and "DATAFILE" must be
63  set correctly.
64
65  You should have Hexagons.ad copied to $(HOME)/Hexagons or
66  /usr/lib/X11/app-defaults/Hexagons to run, especially if the background
67  is similar to one of the faces. Edit this file for your preferences.
68  You might want to move xhexagons into /usr/bin/X11 (or wherever your
69  X binaries are).
70  You might also want to move xhexagons.man to /usr/man/man6/xhexagons.6
71
72  If you were looking for a auto-solver, sorry.
73
74  Keep in mind that Hexagons is a widget that can be simply stuck in
75  other X programs. (If you find a use for this, let me know).
76
77  Refer to the man page for detailed command line options.
78
79  If you want further information on puzzles, I'll be glad :-) to send
80  it to you.
81
82MATHEMATICAL STUFF USED IN CONSTRUCTION
83
84  Lets start out with a triangle of hexagons for simplicity's sake
85  and then expand these ideas to a hexagon of hexagons
86
87  Assuming it is a triangle of i hexagons in each row and the
88  numbering starts from 1.
89    Corner 1-> 1
90           2-> i(i+1)/2 - i + 1
91           3-> i(i+1)/2
92
93    Center ->i%3 =>
94           1: (2i'-1)*(2i')/2-i'+1 where i'= (i+2)/3
95           default: None
96
97    Max_Width -> i * 3^(1/2) units
98    Max_Height -> (3/2)i+(1/2) units
99
100    Start -> x= i * 3^(1/2)/2 units
101             y=0
102             fin=i
103             step=i
104    Next -> (n==fin) =>
105             true: x+= -3^(1/2) * (2 * step - 1)/2 units; y+=3/2 units;
106                   step++; fin+=step
107             default: x+= 3^(1/2) units
108
109    Same row? -> (m'==n') where s'=(1+sqrt_trunc(1+8*(s - 1)))/2 {k}
110                              i.e. s = s'(s'-1)/2
111    Same trbl? -> (m-1)-m'(m'-1)/2 == (n-1)-n'(n'-1)/2 {i}
112    Same tlbr? -> (m'+1)m'/2-m == (n'+1)n'/2-n {j}
113
114    Now assuming it is a hexagon of i hexagons in each row and
115    the numbering starts from 1.
116
117    Corner 1-> 1
118           2-> i
119           3-> Center - i + 1
120           4-> Center + i - 1
121           5-> 3i(i-1) - i + 2
122           6-> 3i(i-1) + 1
123
124    Center -> 3i(i-1)/2 + 1
125
126    Max_Width -> (2i-1) * 3^(1/2) units
127    Max_Height -> 3i-1 units
128
129    Start -> x= i * 3^(1/2)/2 units
130        y=0
131        fin=i
132        step=i
133    Next -> (n<=center) =>
134        true: (n==fin)
135            true: x+= -3^(1/2) * (2 * step - 1)/2 units; y+=3/2 units;
136                  step++; fin+=step
137            default: x+= 3^(1/2) units
138        default: (n==fin)
139            true: step--; x+= -3^(1/2) * (2 * step - 1)/2 units;
140                  y+=3/2 units; fin+=step
141            default: x+= 3^(1/2) units
142
143    Same row? -> (m'==n') {k} where (s<=center) =>
144        true: s' = (1+sqrt_trunc(1+8*(s+i*(i-1)/2)))/2-i
145                       i.e. s = s'*(2s'-1)-(i)(i-1)/2
146        default: s' = 3*i-2-(1+sqrt_trunc(1+8*(3i(i-1)+1+i*(i-1)/2-s)))/2)
147    Same trbl? -> (m''==n'') {i} where (s<=center) =>
148        true: s'' = (s+i*(i-1)/2)-(s'+i)*(s'+i-1)/2
149        default: s'' = 2*i-2-(3i(i-1)+i*(i-1)/2-s-(3*i-s'-2)*(3*i-s'-3)/2)
150    Same tlbr? -> (m''==n'') {j} where (s<=center) =>
151        true: s'' = -1-((s+i*(i-1)/2)-(s'+i+1)*(s'+i)/2)
152        default: s'' = 2*i-1+(3i(i-1)+i*(i-1)/2-s-(3*i-s'-1)*(3*i-s'-2)/2)
153
154FOUND A BUG?
155
156  Send bugs reports and fixes to the author. For bugs, please include
157  as much information as to their location as possible, since I may not
158  have the resources to duplicate the them.
159
160HISTORY
161
162  [Aug 11, 99]  V5.5.2: Fixed runtime library problems when using configure.
163  [Jul 31, 99]  V5.5.1: Imakefile fix for xhexagons and removed HP usleep
164    warning.
165  [Jun 20, 99]  V5.5: Added -rv, -mono, -base
166  [Jan 01, 97]  V5.4: Username, concurrency check, configure, man page
167    updates.
168  [Apr 08, 96]  V5.3: Minor changes.
169  [Jan 31, 96]  V5.2: If corners mode, a tile is now moved by a more
170    intuitive drag and drop approach.  Tiles will invert,
171    when selected.  Now using dynamic allocation, so there
172    is no maximum size.
173  [Dec 15, 95]  V5.1: Minor updates, RNG for 32/64 bit, border color
174    to make faces look more realistic.
175  [Oct 01, 95]  V5.0: Xt/Motif, your choice.
176  [May 16, 95]  V4.10: Warnings removed from Sun's cc and lint and now
177    include a random number generator.
178  [Mar 13, 95]  V4.5: Removed lint warnings and added a VMS make.com .
179  [Nov 11, 94]  V4.4: Conservative guess for random number generator.
180  [Nov 02, 94]  V4.3: Now allows undos, saves, and recalls.
181  [Aug 23, 94]  V4.2: Switched left and middle buttons on the mouse to
182    have up and down consistent with vi's "j", "k" keys.
183  [Jun 28, 94]  V4.1: Can accommodate a auto-solver.
184  [Jun 07, 94]  V4.0: Xt version.
185    I got some good ideas from oclock.
186  [Apr 01, 93]  V3.0: Motif version.
187    I got some good ideas from Douglas A. Young's
188    book: "The X Window System Programming and Applications
189    with Xt OSF/Motif Edition", particularly his dial widget.
190    I got some good ideas on presentation from Q. Zhao's tetris.
191  [Jan 07, 92]  V2.0: XView version.
192  [Sep 06, 91]  V1.0: SunView version.
193