xtriangles
==========

A Triangles Widget

Web: https://www.sillycycle.com/puzzles.html

Download: Primary site: https://www.sillycycle.com/puzzles
          Secondary site: http://ibiblio.org/pub/Linux/games/strategy

Maintainer: David A. Bagley <bagleyd AT verizon.net>

  To build you need at minimum both of these, X11 and Xt (unless you are
  looking to build win32).
    sudo apt-get install libx11-dev
    sudo apt-get install libxt-dev
  You may need to install one of these to build Motif version:
    sudo apt-get install libmotif-dev (strongly recommended)
    sudo apt-get install lesstif2-dev (defunct)
  As an alternative to Motif you can use Athena (and its variants):
    sudo apt-get install xaw7-dev
    (Also could use XAW3D xaw3d-1.6.3-3-x86_64.pkg.tar.zst)
  You need to install XPM if you want color icons:
    sudo apt-get install libxpm-dev (strongly recommended)
  To install XMU if you want editres:
    sudo apt-get install libxmu-dev (probably not useful)
  To install sound libraries (defunct):
    sudo apt-get install librplay3-dev
    sudo apt-get install libesd0-dev
    sudo apt-get install libaudiofile-dev
    sudo apt-get install nas-dev
    sudo apt-get install pulse-dev
    In place of these it is just configured by default with
      --enable-def-play=play.sh
  Then should be a simple
    configure; make

  Try resizing the puzzle.  Notice the puzzle resizes to take advantage of
  the "room" available.

  Note: if using Athena and want the popups to be able to be closed when
    using a close window button in top bar, uncomment translations stuff
    in app-defaults file (.ad file) prior to "make install".  This may
    lead to warnings if for example the Motif version also exists.

  Try editing the file XTriangles.ad to get a certain feature and then
  copying to $(HOME)/XTriangles (where XTriangles is the file name) and
  running xtriangles again.  There is also a Windows port (wtriangles).

  If you were looking for a auto-solver, sorry.

  Refer to the man page for detailed command line options and instructions
  on how to operate.

MATHEMATICAL STUFF USED IN CONSTRUCTION

  Assuming it is a triangle of i triangles in each row and the
  numbering starts from 1.
    Corner 1-> 1
           2-> i^2-2i+2
           3-> i^2

    Center -> i%3 =>
           0: None
           1: j(j+1)+1 where j=2(i-1)/3
           2: j(j+1)+1 where j=2(i-2)/3+1

    Max_Width -> i units
    Max_Height -> 3^(1/2)i/2 units

    Start -> x= i/2 units
             y=0
             side=UP
             fin=1
             step=1
    Next -> (fin==n) =>
         true: x+= -step/2 units; y+=3^(1/2)/2 units; side=UP;
               step+=2; fin+=step
         default: side=!side; x+=1/2 unit;
               y+= (side==UP)?-3^(1/2)/2:3^(1/2)/2

    Same row? -> (m'==n') where s'=sqrt_trunc(s-1) {k}
    Same trbl? -> (((m-1) - m'*m')/2 == ((n-1) - n'*n')/2)) {i}
    Same tlbr? -> (((m'+1)(m'+1) - m)/2 == ((n'+1)(n'+1) - n)/2) {j}

FOUND A BUG?

  Send bugs reports and fixes to the author. For bugs, please include
  as much information as to their location as possible, since I may not
  be able to duplicate them.
