[PATCH 1/3] wmtictactoe: Add version 1.1 to repository.

Doug Torrance <[email protected]>
Newsgroups gmane.compw.window-managers.windowmaker.devel
Message-ID <[email protected]>
Obtained from:
http://www.cs.mun.ca/~gstarkes/wmaker/dockapps/files/wmtictactoe-1.1-1.tar.gz
---
 wmtictactoe/BUGS                               |    0
 wmtictactoe/CHANGES                            |   32 +
 wmtictactoe/COPYING                            |  339 +++++++
 wmtictactoe/INSTALL                            |   17 +
 wmtictactoe/README                             |  142 +++
 wmtictactoe/TODO                               |   18 +
 wmtictactoe/licenca_gnu.html                   |  381 ++++++++
 wmtictactoe/wmgeneral/list.c                   |  169 ++++
 wmtictactoe/wmgeneral/list.h                   |   59 ++
 wmtictactoe/wmgeneral/misc.c                   |  164 ++++
 wmtictactoe/wmgeneral/misc.h                   |    9 +
 wmtictactoe/wmgeneral/wmgeneral.c              |  479 ++++++++++
 wmtictactoe/wmgeneral/wmgeneral.c~             |  479 ++++++++++
 wmtictactoe/wmgeneral/wmgeneral.h              |   61 ++
 wmtictactoe/wmtictactoe/Makefile               |   21 +
 wmtictactoe/wmtictactoe/wmtictactoe-master.xpm |  220 +++++
 wmtictactoe/wmtictactoe/wmtictactoe.c          | 1117 ++++++++++++++++++++++++
 17 files changed, 3707 insertions(+)
 create mode 100644 wmtictactoe/BUGS
 create mode 100644 wmtictactoe/CHANGES
 create mode 100644 wmtictactoe/COPYING
 create mode 100644 wmtictactoe/INSTALL
 create mode 100644 wmtictactoe/README
 create mode 100644 wmtictactoe/TODO
 create mode 100644 wmtictactoe/licenca_gnu.html
 create mode 100644 wmtictactoe/wmgeneral/list.c
 create mode 100644 wmtictactoe/wmgeneral/list.h
 create mode 100644 wmtictactoe/wmgeneral/misc.c
 create mode 100644 wmtictactoe/wmgeneral/misc.h
 create mode 100644 wmtictactoe/wmgeneral/wmgeneral.c
 create mode 100644 wmtictactoe/wmgeneral/wmgeneral.c~
 create mode 100644 wmtictactoe/wmgeneral/wmgeneral.h
 create mode 100755 wmtictactoe/wmtictactoe/Makefile
 create mode 100644 wmtictactoe/wmtictactoe/wmtictactoe-master.xpm
 create mode 100644 wmtictactoe/wmtictactoe/wmtictactoe.c

diff --git a/wmtictactoe/BUGS b/wmtictactoe/BUGS
new file mode 100644
index 0000000..e69de29
diff --git a/wmtictactoe/CHANGES b/wmtictactoe/CHANGES
new file mode 100644
index 0000000..d1e5ddf
--- /dev/null
+++ b/wmtictactoe/CHANGES
@@ -0,0 +1,32 @@
+wmTicTacToe changes.
+
+Version         Description
+----------------------------------------------------------------
+1.1             - Released 990830
+		- Added "deadmatch" game mode
+		
+1.0-2           - Released 990601
+                - Added "quiet mode"... 
+		- hey! today is lupy's birthday... congratulations my friend!
+		
+1.0             - Released 990508
+                - Now, you can change the game mode on the fly and...
+			I GOTTA GO! it's 10:55PM and I wanna go to night!
+                        (COESC party is waiting for me! hehehehe)
+                        bye!
+
+0.4             - Released 990422
+                - Implemented scoreboard
+		- I tried to improve the X play algorithm...
+		
+0.3		- Released 990331
+		- bugs fixed by Adriel Ziesemer Júnior
+		- Adriel improved the X play algorithm...
+		- Adriel implemented the offensive and defensive
+		  game mode
+
+0.2		- Released 990327
+		- some bugs fixed
+		- X player algorithm is very fast and smart now!
+
+0.1		- Released 990325
diff --git a/wmtictactoe/COPYING b/wmtictactoe/COPYING
new file mode 100644
index 0000000..a43ea21
--- /dev/null
+++ b/wmtictactoe/COPYING
@@ -0,0 +1,339 @@
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+                          675 Mass Ave, Cambridge, MA 02139, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+	Appendix: How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) 19yy  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) 19yy name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/wmtictactoe/INSTALL b/wmtictactoe/INSTALL
new file mode 100644
index 0000000..4c733f0
--- /dev/null
+++ b/wmtictactoe/INSTALL
@@ -0,0 +1,17 @@
+Installation instructions for wmTicTacToe.
+
+Requirements
+--------------------------------------------------------------
+To know read... :)
+
+Installation
+--------------------------------------------------------------
+1) % tar -zxvf wmtictactoe-1.1.tar.gz
+2) % cd wmtictactoe-1.1/wmtictactoe
+3) % make
+as root type:
+4) % make install
+or copy 'wmtictactoe' somewhere in your $PATH like /usr/local/bin;
+5) % wmtictactoe & (or wmtictactoe -h for help)
+
+Be sure to read the TODO file too!
diff --git a/wmtictactoe/README b/wmtictactoe/README
new file mode 100644
index 0000000..bb494ad
--- /dev/null
+++ b/wmtictactoe/README
@@ -0,0 +1,142 @@
+==========================--- wmTicTacToe-1.1 ---=========================
+
+
+Author
+===================================---------------------------------------
+
+	André Ribeiro Camargo ([email protected])
+	I'm 22 years old and I live on Brazil.
+	Well, there are not many things to say...	
+
+
+Description
+-----------------------------------=======================================
+
+	wmTicTacToe, as you can imagine, is a dock application game for
+Window Maker(but it will be run on others window managers too.  You can
+test it... and after, give me your feedback...) 
+
+	wmTicTacToe is being developped on Pentium 133 machine running
+Linux/Conectiva Guarani, and I can't test on other machines 'cos I don't
+know people that have one... If YOU test it, give me your feedback,
+please...
+
+
+Why write a game so... useless!? :P
+===================================----------------------------------------
+
+	Well, it's a short history... :)
+	I wanna programming for linux, but I didn't know how... Then, I
+have a class called "Prática de Programação", where, pupil have that
+create a software(any kind of software), immediatelly I thought: - WhY nOt
+cReaTE a SmaLL gAme fOr mY faVoriTe wInDoW mAnAgeR!? Five days after, here
+it is... version 0.1, of course... :)
+
+	ps.: I take 10 points... great :)
+
+
+How do I play wmTicTacToe?
+-----------------------------------========================================
+
+	It's very simple!
+	You can play versus XFree(computer) or versus GNUstep(a friend, etc).
+	To active _deadmatch_ game mode, it run wmtictactoe with option:
+	-deadmatch
+	Click with right button change between scoreboard and gameboard.
+        In scoreboard, click with middle button reset the score, with
+right button go to gameboard screen and click with left button change the 
+game mode.
+        In gameboard, click with left button to play, right button go to 
+scoreboard screen and middle button to reset the game...
+        ... and, don't forget, the game has Offensive and Defensive mode!
+	
+Deadmatch!
+===================================----------------------------------------
+
+	In the version 1.1 was added one more game mode, where you can play
+versus other human player...
+
+
+Files
+-----------------------------------========================================
+
+README		 This file.
+INSTALL		 Installation instructions.
+BUGS		 Things you don't want to know ;-)
+CHANGES 	 Description of changes.
+COPYING		 GNU General Public License Version 2.
+TODO		 Stuff I've planned for future wmTicTacToe releases.
+licenca_gnu.html GNU General Public License Version 2 translated to Portuguese.
+
+
+Bugs 
+===================================----------------------------------------
+
+	If you discover any bugs in this software, please send a bugreport
+to [email protected] and describe the problem as detailed as you
+can.
+
+
+Copyright 
+-----------------------------------========================================
+
+	wmTicTacToe is copyright (c) 1999 by André Ribeiro Camargo and
+licensed through the GNU General Public License 2. Read the COPYING or 
+licenca_gnu.html files for the complete GNU license.
+
+
+Thanks
+===================================----------------------------------------
+
+	Thanks to:
+	
+	- creator of asclock: Beat Christen
+	- creator of wmbreak: Adam Hunter
+	- creators of wmmon.app: Martijn Pieterse and Antoine Nulle
+	- creator of wmmail: Per Liden
+
+	without this guys with yours dock applications, I can't write
+wmTicTacToe... 
+
+	- Adriel Ziesemer Júnior([email protected])
+
+	for yours many ideas, C help and bug fixes... :)
+	ps.: when do you port your "sonic" game to linux?
+
+	- my mom and dad...
+
+	of course... hehehehehhe :)
+
+
+	- XMMS developers team...
+
+	yeah... *it runs better than WinAmp!*
+
+	- my poor PC!
+
+	someday I throw away my Pentium(TM) and I buy a RISC
+machine... ;))) I'm accepting donations of machines(like silicon Octane, suns
+sparcStations or digital Alphas... etc :)
+
+	- and... *tchan tchan* xiiiiiiiiiiiiiiiiiibengue!
+
+	"dazed and confused"
+	ps.: thanks so much to Rodrigo Gruppelli(GRUPIS/OpIvy @ #mundo 
+		brasNet ircnet)... 
+             ...For reminder me of xibengue, linux help and to be my official
+	        beta tester... :)))
+		
+	- Jeff Mottishaw([email protected])
+	
+	for to suggest "deadmatch" game mode...
+	thank you mottie :)
+
+
+        Enjoy it! 
+	'cos "Space: the final frontier"
+	Pato Fu rulez!
+	urbana legio omnia vincit!
+	Força Sempre!
+
+
+
diff --git a/wmtictactoe/TODO b/wmtictactoe/TODO
new file mode 100644
index 0000000..86ca87e
--- /dev/null
+++ b/wmtictactoe/TODO
@@ -0,0 +1,18 @@
+TODO list for wmTicTacToe
+--------------------------------------------------------------
+
+...this is a list of things I've already planned for next version(or nexteds):
+
+	- create a super hiper nice very good X play algorithm;
+	- Alfredo Kojima(Window Maker's creator) suggested deadmatch games 
+          over internet; If you're interessing, go ahead! ;)
+	- something more?
+
+Your feedback! If you have nice suggestions, ideas, whatever,
+that aren't on this list, feel free to mail them to:
+
+	[email protected]
+
+If you don't let me know... how am I suppose to know? ;-)
+
+
diff --git a/wmtictactoe/licenca_gnu.html b/wmtictactoe/licenca_gnu.html
new file mode 100644
index 0000000..e24573f
--- /dev/null
+++ b/wmtictactoe/licenca_gnu.html
@@ -0,0 +1,381 @@
+<HTML>
+<HEAD>
+   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+   <META NAME="Author" CONTENT="Jorge Godoy">
+   <META NAME="Author" CONTENT="Arnaldo Carvalho de Melo - Correções em 25/2/1999">
+   <META NAME="GENERATOR" CONTENT="Mozilla/4.04 [en] (X11; I; Linux 2.0.33 i586) [Netscape]">
+</HEAD>
+<BODY>
+
+<CENTER><TT><FONT SIZE=+1>Licença pública GNU</FONT></TT></CENTER>
+<TT></TT>
+<CENTER><TT><FONT SIZE=+1>GNU GENERAL PUBLIC LICENSE Version 2, June 1991</FONT></TT></CENTER>
+
+<br><br><center>
+     This is an unofficial translation of the GNU General Public License
+     into Portuguese. It was not published by the Free Software
+     Foundation, and does not legally state the distribution terms for
+     software that uses the GNU GPL -- only the original English text of
+     the GNU GPL does that. However, we hope that this translation will
+     help Portuguese speakers understand the GNU GPL better.
+</center><br><br>
+
+
+<CENTER><TT><FONT SIZE=+1></FONT></TT></CENTER>
+<TT>Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave,
+Cambridge, MA 02139, USA</TT><TT></TT>
+
+<P><TT>É permitido a qualquer pessoa copiar e distribuir cópias
+tal desse documento de licença, sem a implementação
+de qualquer mudança.</TT><TT></TT>
+
+<P><TT>F.3.1 Introdução</TT><TT></TT>
+
+<P><TT>As licenças de muitos softwares são desenvolvidas
+para cercear a liberdade de uso, compartilhamento e mudanças. A
+GNU Licença Pública Geral ao contr&aacute;rio, pretende
+garantir a liberdade de compartilhar e alterar softwares de livre distribuição
+- tornando-os de livre distribuição também para quaisquer
+usu&aacute;rios. A Licença Pública Geral aplica-se &agrave;
+maioria dos softwares da Free Software Foundation e a qualquer autor que
+esteja de acordo de utiliz&aacute;-la (alguns softwares da FSF são
+cobertos pela GNU Library General Public License).</TT><TT></TT>
+
+<P><TT>Quando nos referimos a softwares de livre distribuição,
+referimo-nos &agrave; liberdade e não ao preço. Nossa Licença
+Pública Geral foi criada para garantir a liberdade de distribuição
+de cópias de softwares de livre distribuição (e cobrar
+por isso caso seja do interesse do distribuidor), o qual recebeu os códigos
+fonte, o qual pode ser alterado ou utilizado em parte em novos programas.</TT><TT></TT>
+
+<P><TT>Para assegurar os direitos dos desenvolvedores, algumas restriç&otilde;es
+são feitas, proibindo a todas as pessoas a negação
+desses direitos ou a solicitação de sua abdicação.
+Essas restriç&otilde;es aplicam-se ainda a certas responsabilidades
+sobre a distribuição ou modificação do software.</TT><TT></TT>
+
+<P><TT>Por exemplo, ao se distribuir cópias de determinado programa,
+por uma taxa determinada ou gratuitamente,&nbsp; deve-se informar sobre
+todos os direitos incidentes sobre esse programa, assegurando-se que os
+fontes estejam disponíveis assim como a Licença Pública
+Geral GNU.</TT><TT></TT>
+
+<P><TT>A proteção dos direitos envolve dois passos: (1) copyright
+do software e (2) licença que d&aacute; permissão legal para
+cópia, distribuição e/ou modificação
+do softwares.</TT><TT></TT>
+
+<P><TT>Ainda para a proteção da FSF e do autor é importante
+que todos entendam que não h&aacute; garantias para softwares de
+livre distribuição. Caso o software seja modificado por alguém
+e passado adiante, este software não mais refletir&aacute; o trabalho
+original do autor não podendo portanto ser garantido por aquele.</TT><TT></TT>
+
+<P><TT>Finalmente, qualquer programa de livre distribuição
+é constantemente ameaçado pelas patentes de softwares. Buscamos
+evitar o perigo de que distribuidores destes programas obtenham patentes
+individuais, tornado-se seus donos efetivos. Para evitar isso foram feitas
+declaraç&otilde;es expressas de que qualquer solicitação
+de patente deve ser feita&nbsp; permitindo o uso por qualquer indivíduo,
+sem a necessidade de licença de uso.</TT><TT></TT>
+
+<P><TT>Os termos e condiç&otilde;es precisas para cópia,
+distribuição e modificação seguem abaixo:</TT><TT></TT>
+
+<P><TT>F.3.2 Licença Pública Geral GNU</TT><TT></TT>
+
+<P><TT>TERMOS E CONDI&Ccedil;&Otilde;ES PARA C&Oacute;PIA, DISTRIBUI&Ccedil;&Atilde;O
+E MODIFICA&Ccedil;&Atilde;O</TT><TT></TT>
+
+<P><TT>0</TT><TT></TT>
+
+<P><TT>Esta licença se aplica a qualquer programa ou outro trabalho
+que contenha um aviso colocado pelo detentor dos direitos autorais dizendo
+que aquele poder&aacute; ser distribuído nas condiç&otilde;es
+da Licença Pública Geral. O Programa, abaixo refere-se a
+qualquer software ou trabalho e a um trabalho baseado em um Programa&nbsp;
+e significa tanto o Programa em si como quaisquer trabalhos derivados&nbsp;
+de acordo com a lei de direitos autorais, o que significa dizer, um trabalho
+que contenha o Programa ou uma parte deste, na sua forma original ou com
+modificaç&otilde;es ou traduzido para uma outra língua (tradução
+est&aacute; incluída sem limitaç&otilde;es no termo <I>modificação</I>).</TT><TT></TT>
+
+<P><TT>Atividades distintas de cópia, distribuição&nbsp;
+e modificação não estão cobertas por esta Licença,
+estando fora de seu escopo. O ato de executar o Programa não est&aacute;
+restringido e a saída do Programa é coberta somente caso
+seu conteúdo contenha trabalhos baseados no Programa (independentemente
+de terem sidos gerados pela execução do Programa). Se isso
+é verdadeiro depende das funç&otilde;es executadas pelo Programa.</TT><TT></TT>
+
+<P><TT>1</TT><TT></TT>
+
+<P><TT>O código fonte do Programa, da forma como foi recebido, pode
+ser copiado e distribuído, em qualquer media, desde que seja providenciada
+um aviso adequado sobre os copyrights e a negação de garantias,
+e todos os avisos que se referem &agrave; Licença Pública
+Geral e &agrave; ausência de garantias estejam inalterados e que
+qualquer produtos oriundo do Programa esteja acompanhado desta Licença
+Pública Geral.</TT><TT></TT>
+
+<P><TT>&Eacute; permitida a cobrança de taxas pelo ato físico
+de transferência ou gravação de cópias, e podem
+ser dadas garantias e suporte em troca da cobrança de valores.</TT><TT></TT>
+
+<P><TT>2</TT><TT></TT>
+
+<P><TT>Pode-se modificar a cópia ou cópias do Programa de
+qualquer forma que se deseje, ou ainda criar-se um trabalho baseado no
+Programa, e copi&aacute;-la e distribuir tais modificaç&otilde;es
+sob os termos da seção 1 acima e do seguinte:</TT>
+<UL><TT>1. Deve existir aviso em destaque de que os dados originais foram
+alterados&nbsp; nos arquivos e as datas das mudanças;</TT>
+<BR><TT>2. Deve existir aviso de que o trabalho distribuído ou publicado
+é, de forma total ou em parte derivado do Programa&nbsp; ou de alguma
+parte sua, e que pode ser licenciado totalmente sem custos para terceiros
+sob os termos desta Licença.</TT>
+<BR><TT>3. Caso o programa modificado seja executado de forma interativa,
+é obrigatório, no início de sua execução,
+apresentar a informação de copyright e da ausência
+de garantias (ou de que a garantia corre por conta de terceiros), e que
+os usu&aacute;rios podem redistribuir o programa sob estas condiç&otilde;es,
+indicando ao usu&aacute;rio como acessar esta Licença na sua íntegra.</TT></UL>
+<TT>Esses requisitos aplicam-se a trabalhos de modificação
+em geral. Caso algumas seç&otilde;es identific&aacute;veis não
+sejam derivadas do Programa, e podem ser consideradas como partes independentes,
+então esta Licença e seus Termos não se aplicam &agrave;quelas
+seç&otilde;es quando distribuídas separadamente. Porém
+ao distribuir aquelas seç&otilde;es como&nbsp; parte de um trabalho
+baseado no Programa, a distribuição como um todo deve conter
+os termos desta Licença, cujas permiss&otilde;es estendem-se ao
+trabalho como um todo, e não a cada uma das partes independentemente
+de quem os tenha desenvolvido.</TT><TT></TT>
+
+<P><TT>Mais do que tencionar contestar os direitos sobre o trabalho desenvolvido
+por alguém, esta seção objetiva propiciar a correta
+distribuição de trabalhos derivados do Programa.</TT><TT></TT>
+
+<P><TT>Adicionalmente, a mera adição de outro trabalho ao
+Programa, porém não baseado nele nem a um trabalho baseado
+nele,&nbsp; a um volume de armazenamento ou media de distribuição
+não obriga a utilização desta Licença e de
+seus termos ao trabalho.</TT><TT></TT>
+
+<P><TT>3</TT><TT></TT>
+
+<P><TT>São permitidas a cópia e a distribuição
+do Programa (ou a um trabalho baseado neste) na forma de código
+objeto ou execut&aacute;vel de acordo com os termos das Seç&otilde;es
+1 e 2 acima, desde que atendido o seguinte:</TT>
+<UL><TT>1. Esteja acompanhado dos códigos fonte legíveis,
+os quais devem ser distribuídos na forma da Seç&otilde;es
+1 e 2 acima, em mídia normalmente utilizada para manuseio de softwares
+ou</TT>
+<BR><TT>2. Esteja acompanhado de oferta escrita, v&aacute;lida por, no
+mínimo 3 anos, de disponibilizar a terceiros, por um custo não
+superior ao custo do meio físico de armazenamento , uma cópia
+completa&nbsp; dos códigos fonte em meio magnético, de acordo
+com as Seç&otilde;es 1 e 2 acima.</TT>
+<BR><TT>3. Esteja acompanhada com a mesma informação recebida
+em relação &agrave; oferta da distribuição
+do código fonte correspondente. (esta alternativa somente é
+permitida para distribuiç&otilde;es não comerciais e somente
+se o programa recebido na forma de objeto ou execut&aacute;vel tenha tal
+oferta, de acordo com a sub-seção 2 acima).</TT></UL>
+<TT>O código fonte de um trabalho é a melhor forma de produzirem-se
+alteraç&otilde;es naquele trabalho.&nbsp; Códigos fontes
+completos significam todos os fontes de todos os módulos, além
+das definiç&otilde;es de interfaces associadas, arquivos, scripts
+utilizados na compilação e instalação do execut&aacute;vel.
+Como uma exceção excepcional, o código fonte distribuído
+poder&aacute; não incluir alguns componentes que não se encontrem
+em seu escopo, tais como compilador, kernel, etc... para o SO onde o trabalho
+seja executado.</TT><TT></TT>
+
+<P><TT>Caso a distribuição do execut&aacute;vel ou objeto
+seja feita através de acesso a um determinado ponto, então
+oferta equivalente de acesso deve ser feita aos códigos fonte, mesmo
+que terceiros não sejam obrigados a copiarem os fontes juntos com
+os objetos simultaneamente.</TT><TT></TT>
+
+<P><TT>4</TT><TT></TT>
+
+<P><TT>Não é permitida a cópia, modificação,
+sublicenciamento ou distribuição do Programa, exceto sob
+as condiç&otilde;es expressas nesta Licença. Qualquer tentativa
+de cópia, modificação, sublicenciamento ou distribuição
+do Programa é proibida, e os direitos descritos nesta Licença
+cessarão imediatamente. Terceiros que tenham recebido cópias
+ou direitos na forma desta Licença não terão seus
+direitos cessados desde que permaneçam dentro das cl&aacute;usulas
+desta Licença.</TT><TT></TT>
+
+<P><TT>5</TT><TT></TT>
+
+<P><TT>Não é necess&aacute;ria aceitação formal
+desta Licença, apesar de que não haver&aacute; documento
+ou contrato que garanta permissão de modificação ou
+distribuição do Programa ou seus trabalhos derivados. Essas
+aç&otilde;es são proibidas por lei, caso não se aceitem
+as condiç&otilde;es desta Licença. A modificação
+ou distribuição do Programa ou qualquer trabalho baseado
+neste implica na aceitação desta Licença e de todos
+os termos desta para cópia, distribuição ou modificação
+do Programa ou trabalhos baseados</TT>
+<BR><TT>neste.</TT><TT></TT>
+
+<P><TT>6</TT><TT></TT>
+
+<P><TT>Cada vez que o Programa seja distribuído (ou qualquer trabalho
+baseado neste), o recipiente automaticamente recebe uma licença
+do detentor original dos direitos de cópia, distribuição
+ou modificação do Programa objeto deste termos e condiç&otilde;es.
+Não podem ser impostas outras restriç&otilde;es nos recipientes.</TT><TT></TT>
+
+<P><TT>7</TT><TT></TT>
+
+<P><TT>No caso de decis&otilde;es judiciais ou alegaç&otilde;es
+de uso indevido de patentes ou direitos autorais, restriç&otilde;es
+sejam impostas que contradigam esta Licença, estes não isentam
+da sua aplicação. Caso não seja possível distribuir
+o Programa de forma a garantir simultaneamente as obrigaç&otilde;es
+desta Licença e outras que sejam necess&aacute;rias, então
+o Programa não poder&aacute; ser distribuído.</TT><TT></TT>
+
+<P><TT>Caso esta Seção seja considerada inv&aacute;lida por
+qualquer motivo particular ou geral, o seu resultado implicar&aacute; na
+invalidação geral desta licença na cópia, modificação,
+sublicenciamento ou distribuição do Programa ou trabalhos
+baseados neste.</TT><TT></TT>
+
+<P><TT>O propósito desta seção não é,
+de forma alguma, incitar quem quer que seja a infringir direitos reclamados
+em quest&otilde;es v&aacute;lidas e procedentes, e sim proteger as premissas
+do sistema de livre distribuição de software. Muitas pessoas
+têm feito contribuiç&otilde;es generosas ao sistema, na forma
+de programas, e é necess&aacute;rio garantir&nbsp; a consistência
+e credibilidade do sistema, cabendo a estes e não a terceiros decidirem&nbsp;
+a forma de distribuição dos softwares.</TT><TT></TT>
+
+<P><TT>Esta seção pretende tornar claro os motivos que geraram
+as demais cl&aacute;usulas destas Licença.</TT><TT></TT>
+
+<P><TT>8</TT><TT></TT>
+
+<P><TT>Caso a distribuição do Programa dentro dos termos
+desta Licença tenha restriç&otilde;es em algum País,
+quer por patentes ou direitos autorais, o detentor original dos direitos
+autorais do Programa sob esta Licença pode adicionar explicitamente
+limitaç&otilde;es geogr&aacute;ficas de distribuição,
+excluindo aqueles Países, fazendo com que a distribuição
+somente seja possível nos Países não excluídos.</TT><TT></TT>
+
+<P><TT>9</TT><TT></TT>
+
+<P><TT>A Fundação de Software de Livre Distribuição
+(FSF - Free Software Foundation) pode publicar vers&otilde;es revisadas
+ou novas vers&otilde;es desta Licença Pública Geral de tempos
+em tempos. Estas novas vers&otilde;es manterão os mesmos objetivos
+e o espírito da presente versão, podendo variar em detalhes
+referentes a novas situaç&otilde;es encontradas.</TT><TT></TT>
+
+<P><TT>A cada versão é dada um número distinto. Caso
+o Programa especifique um número de versão específico
+desta Licença a qual tenha em seu conteúdo a expressão
+- ou versão mais atualizada-, é possível optar pelas
+condiç&otilde;es daquela versão ou de qualquer versão
+mais atualizada publicada pela FSF.</TT><TT></TT>
+
+<P><TT>10</TT><TT></TT>
+
+<P><TT>Caso se deseje incorporar parte do Programa em outros programas
+de livre distribuição de softwares é necess&aacute;ria
+autorização formal do autor. Para softwares que a FSF detenha
+os direitos autorais, podem ser abertas exceç&otilde;es desde que
+mantido o espírito e objetivos originais desta Licença.</TT>
+<BR><TT></TT>&nbsp;<TT></TT>
+
+<P><TT>11</TT><TT></TT>
+
+<P><TT>AUS&Ecirc;NCIA DE GARANTIAS</TT><TT></TT>
+
+<P><TT>UMA VEZ QUE O PROGRAMA &Eacute; LICENCIADO SEM &Ocirc;NUS, N&Atilde;O
+H&Aacute; QUALQUER GARANTIA PARA O PROGRAMA. EXCETO QUANDO TERCEIROS EXPRESSEM-SE
+FORMALMENTE O PROGRAMA &Eacute; DISPONIBILIZADO EM SEU FORMATO ORIGINAL,
+SEM GARANTIAS DE QUALQUER NATUREZA, EXPRESSAS OU IMPL&Iacute;CITAS, INCLUINDO
+MAS N&Atilde;O LIMITADAS, A GARANTIAS COMERCIAIS&nbsp; E DO ATENDIMENTO
+DE DETERMINADO FIM. A QUALIDADE E A PERFORMANCE S&Atilde;O DE RISCO EXCLUSIVO
+DOS USU&Aacute;RIOS, CORRENDO POR SUAS CONTA OS CUSTOS NECESS&Aacute;RIOS
+A EVENTUAIS ALTERA&Ccedil;&Otilde;ES, CORRE&Ccedil;&Otilde;ES E REPAROS
+JULGADOS NECESS&Aacute;RIOS.</TT><TT></TT>
+
+<P><TT>EM NENHUMA OCASI&Atilde;O, A MENOS QUE REQUERIDO POR DECIS&Atilde;O
+JUDICIAL OU POR LIVRE VONTADE, O AUTOR OU TERCEIROS QUE TENHAM MODIFICADO
+O PROGRAMA, SER&Atilde;O RESPONS&Aacute;VEIS POR DANOS OU PREJU&Iacute;ZOS
+PROVENIENTES DO USO OU DA FALTA DE HABILIDADE NA SUA UTILIZA&Ccedil;&Atilde;O
+(INCLUINDO MAS N&Atilde;O LIMITADA A PERDA DE DADOS OU DADOS ERR&Ocirc;NEOS),
+MESMO QUE TENHA SIDO EMITIDO AVISO DE POSS&Iacute;VEIS ERROS OU DANOS.</TT><TT></TT>
+
+<P><TT>FIM DA LICEN&Ccedil;A</TT>
+<BR><TT></TT>&nbsp;<TT></TT>
+
+<P><TT>F.3.3 Apêndice</TT><TT></TT>
+
+<P><TT>Como aplicar estes termos a novos softwares?</TT><TT></TT>
+
+<P><TT>Caso se&nbsp; tenha desenvolvido um novo programa e se deseje a
+sua ampla distribuição para o público, a melhor forma
+de consegui-lo é torn&aacute;-lo um software de livre distribuição,
+o qual qualquer um possa distribuí-lo nas condiç&otilde;es
+desta Licença.</TT><TT></TT>
+
+<P><TT>Para tanto basta anexar este aviso ao programa. &Eacute; aconselh&aacute;vel
+indicar ainda no início de cada arquivo fonte a ausência de
+garantias e um apontamento para um arquivo contendo o texto geral desta
+Licença, como por exemplo:</TT>
+<UL>
+<UL><I><TT>&lt;nome do programa e função> Copyright (C) 199X
+&lt;Autor></TT></I>
+<BR><I><TT></TT></I>&nbsp;</UL>
+<TT>Este programa é um software de livre distribuição,
+que pode ser copiado e distribuído sob os termos da Licença
+Pública Geral&nbsp; GNU, conforme publicada pela Free Software Foundation,
+versão 2 da licença ou (a critério do autor) qualquer
+versão posterior.</TT><TT></TT>
+
+<P><TT>Este programa é distribuído na expectativa de ser
+útil aos seus usu&aacute;rios, porém&nbsp; N&Atilde;O TEM
+NENHUMA GARANTIA,&nbsp; EXPL&Iacute;CITAS OU IMPL&Iacute;CITAS , COMERCIAIS
+OU DE ATENDIMENTO A UMA DETERMINADA FINALIDADE. Consulte a Licença
+Pública Geral&nbsp; GNU para maiores detalhes.</TT><TT></TT>
+
+<P><TT>Deve haver uma cópia da Licença Pública Geral&nbsp;
+GNU&nbsp; junto com este software em inglês ou português. Caso
+não haja escreva para Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.</TT><TT></TT>
+
+<P><TT>[email protected]</TT>
+<BR><TT>Endereço</TT></UL>
+<TT></TT>
+
+<P><TT>Caso o programa seja interativo, apresente na sua saída um
+breve aviso quando de seu início como por exemplo:</TT>
+<BR><TT></TT>&nbsp;
+<BR><TT></TT>&nbsp;
+<UL>
+<UL><TT>Gnomovision versão 69, Copyright &copy;199a Yoyodine</TT>
+<BR><TT></TT>&nbsp;</UL>
+<TT>Softwares&nbsp; NÃO POSSUI&nbsp; NENHUMA&nbsp; GARANTIA;&nbsp;
+para detalhes digite <B>mostre garantia</B>. Este é um software
+de livre distribuição e você est&aacute; autorizado
+a distribui-lo dentro de certas condiç&otilde;es. Digite <B>mostre
+condição</B> para maiores detalhes.</TT></UL>
+<TT></TT>
+
+<P><TT>Os comandos hipotéticos <B>mostre garantia</B> e <B>mostre
+condição</B> apresentarão as partes apropriadas da
+Licença Pública Geral GNU. Evidentemente os comandos podem
+variar ou serem acionado por outras interfaces como clique de mouse, etc...</TT>
+<BR>&nbsp;
+</BODY>
+</HTML>
diff --git a/wmtictactoe/wmgeneral/list.c b/wmtictactoe/wmgeneral/list.c
new file mode 100644
index 0000000..f804b2c
--- /dev/null
+++ b/wmtictactoe/wmgeneral/list.c
@@ -0,0 +1,169 @@
+/* Generic single linked list to keep various information 
+   Copyright (C) 1993, 1994 Free Software Foundation, Inc.
+
+
+Author: Kresten Krab Thorup
+
+Many modifications by Alfredo K. Kojima
+ 
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING.  If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+/* As a special exception, if you link this library with files compiled with
+   GCC to produce an executable, this does not cause the resulting executable
+   to be covered by the GNU General Public License. This exception does not
+   however invalidate any other reasons why the executable file might be
+   covered by the GNU General Public License.  */
+
+#include "list.h"
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#include <stdlib.h>
+
+/* Return a cons cell produced from (head . tail) */
+
+INLINE LinkedList* 
+list_cons(void* head, LinkedList* tail)
+{
+  LinkedList* cell;
+
+  cell = (LinkedList*)malloc(sizeof(LinkedList));
+  cell->head = head;
+  cell->tail = tail;
+  return cell;
+}
+
+/* Return the length of a list, list_length(NULL) returns zero */
+
+INLINE int
+list_length(LinkedList* list)
+{
+  int i = 0;
+  while(list)
+    {
+      i += 1;
+      list = list->tail;
+    }
+  return i;
+}
+
+/* Return the Nth element of LIST, where N count from zero.  If N 
+   larger than the list length, NULL is returned  */
+
+INLINE void*
+list_nth(int index, LinkedList* list)
+{
+  while(index-- != 0)
+    {
+      if(list->tail)
+	list = list->tail;
+      else
+	return 0;
+    }
+  return list->head;
+}
+
+/* Remove the element at the head by replacing it by its successor */
+
+INLINE void
+list_remove_head(LinkedList** list)
+{
+  if (!*list) return;  
+  if ((*list)->tail)
+    {
+      LinkedList* tail = (*list)->tail; /* fetch next */
+      *(*list) = *tail;		/* copy next to list head */
+      free(tail);			/* free next */
+    }
+  else				/* only one element in list */
+    {
+      free(*list);
+      (*list) = 0;
+    }
+}
+
+
+/* Remove the element with `car' set to ELEMENT */
+/*
+INLINE void
+list_remove_elem(LinkedList** list, void* elem)
+{
+  while (*list)
+    {
+      if ((*list)->head == elem)
+        list_remove_head(list);
+      *list = (*list ? (*list)->tail : NULL);
+    }
+}*/
+
+INLINE LinkedList *
+list_remove_elem(LinkedList* list, void* elem)
+{
+    LinkedList *tmp;
+    
+    if (list) {
+	if (list->head == elem) {
+	    tmp = list->tail;
+	    free(list);
+	    return tmp;
+	}
+	list->tail = list_remove_elem(list->tail, elem);
+	return list;
+    }
+    return NULL;
+}
+
+
+/* Return element that has ELEM as car */
+
+INLINE LinkedList*
+list_find(LinkedList* list, void* elem)
+{
+  while(list)
+    {
+    if (list->head == elem)
+      return list;
+    list = list->tail;
+    }
+  return NULL;
+}
+
+/* Free list (backwards recursive) */
+
+INLINE void
+list_free(LinkedList* list)
+{
+  if(list)
+    {
+      list_free(list->tail);
+      free(list);
+    }
+}
+
+/* Map FUNCTION over all elements in LIST */
+
+INLINE void
+list_mapcar(LinkedList* list, void(*function)(void*))
+{
+  while(list)
+    {
+      (*function)(list->head);
+      list = list->tail;
+    }
+}
diff --git a/wmtictactoe/wmgeneral/list.h b/wmtictactoe/wmgeneral/list.h
new file mode 100644
index 0000000..af0f22c
--- /dev/null
+++ b/wmtictactoe/wmgeneral/list.h
@@ -0,0 +1,59 @@
+/* Generic single linked list to keep various information 
+   Copyright (C) 1993, 1994 Free Software Foundation, Inc.
+
+Author: Kresten Krab Thorup
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING.  If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+/* As a special exception, if you link this library with files compiled with
+   GCC to produce an executable, this does not cause the resulting executable
+   to be covered by the GNU General Public License. This exception does not
+   however invalidate any other reasons why the executable file might be
+   covered by the GNU General Public License.  */
+
+#ifndef __LIST_H_
+#define __LIST_H_
+
+#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
+# define INLINE inline
+#else
+# define INLINE
+#endif
+
+typedef struct LinkedList {
+  void *head;
+  struct LinkedList *tail;
+} LinkedList;
+
+INLINE LinkedList* list_cons(void* head, LinkedList* tail);
+
+INLINE int list_length(LinkedList* list);
+
+INLINE void* list_nth(int index, LinkedList* list);
+
+INLINE void list_remove_head(LinkedList** list);
+
+INLINE LinkedList *list_remove_elem(LinkedList* list, void* elem);
+
+INLINE void list_mapcar(LinkedList* list, void(*function)(void*));
+
+INLINE LinkedList*list_find(LinkedList* list, void* elem);
+
+INLINE void list_free(LinkedList* list);
+
+#endif
diff --git a/wmtictactoe/wmgeneral/misc.c b/wmtictactoe/wmgeneral/misc.c
new file mode 100644
index 0000000..34281e2
--- /dev/null
+++ b/wmtictactoe/wmgeneral/misc.c
@@ -0,0 +1,164 @@
+/* dock.c- built-in Dock module for WindowMaker
+ * 
+ *  WindowMaker window manager
+ * 
+ *  Copyright (c) 1997 Alfredo K. Kojima
+ * 
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include "list.h"
+#include "misc.h"
+
+/*
+ *----------------------------------------------------------------------
+ * parse_command--
+ * 	Divides a command line into a argv/argc pair.
+ *---------------------------------------------------------------------- 
+ */
+#define PRC_ALPHA	0
+#define PRC_BLANK	1
+#define PRC_ESCAPE	2
+#define PRC_DQUOTE	3
+#define PRC_EOS		4
+#define PRC_SQUOTE	5
+
+typedef struct {
+    short nstate;
+    short output;
+} DFA;
+
+
+static DFA mtable[9][6] = {
+    {{3,1},{0,0},{4,0},{1,0},{8,0},{6,0}},
+    {{1,1},{1,1},{2,0},{3,0},{5,0},{1,1}},
+    {{1,1},{1,1},{1,1},{1,1},{5,0},{1,1}},
+    {{3,1},{5,0},{4,0},{1,0},{5,0},{6,0}},
+    {{3,1},{3,1},{3,1},{3,1},{5,0},{3,1}},
+    {{-1,-1},{0,0},{0,0},{0,0},{0,0},{0,0}}, /* final state */
+    {{6,1},{6,1},{7,0},{6,1},{5,0},{3,0}},
+    {{6,1},{6,1},{6,1},{6,1},{5,0},{6,1}},
+    {{-1,-1},{0,0},{0,0},{0,0},{0,0},{0,0}}, /* final state */
+};
+
+char*
+next_token(char *word, char **next)
+{
+    char *ptr;
+    char *ret, *t;
+    int state, ctype;
+
+    t = ret = malloc(strlen(word)+1);
+    ptr = word;
+    
+    state = 0;
+    *t = 0;
+    while (1) {
+	if (*ptr==0) 
+	    ctype = PRC_EOS;
+	else if (*ptr=='\\')
+	    ctype = PRC_ESCAPE;
+	else if (*ptr=='"')
+	    ctype = PRC_DQUOTE;
+	else if (*ptr=='\'')
+	    ctype = PRC_SQUOTE;
+	else if (*ptr==' ' || *ptr=='\t')
+	    ctype = PRC_BLANK;
+	else
+	    ctype = PRC_ALPHA;
+
+	if (mtable[state][ctype].output) {
+	    *t = *ptr; t++;
+	    *t = 0;
+	}
+	state = mtable[state][ctype].nstate;
+	ptr++;
+	if (mtable[state][0].output<0) {
+	    break;
+	}
+    }
+
+    if (*ret==0)
+	t = NULL;
+    else
+	t = strdup(ret);
+
+    free(ret);
+    
+    if (ctype==PRC_EOS)
+	*next = NULL;
+    else
+	*next = ptr;
+    
+    return t;
+}
+
+
+extern void
+parse_command(char *command, char ***argv, int *argc)
+{
+    LinkedList *list = NULL;
+    char *token, *line;
+    int count, i;
+
+    line = command;
+    do {
+	token = next_token(line, &line);
+	if (token) {	    
+	    list = list_cons(token, list);
+	}
+    } while (token!=NULL && line!=NULL);
+
+    count = list_length(list);
+    *argv = malloc(sizeof(char*)*count);
+    i = count;
+    while (list!=NULL) {
+	(*argv)[--i] = list->head;
+	list_remove_head(&list);
+    }
+    *argc = count;
+}
+
+extern pid_t
+execCommand(char *command)
+{
+    pid_t pid;
+    char **argv;
+    int argc;
+
+    parse_command(command, &argv, &argc);
+    
+    if (argv==NULL) {
+        return 0;
+    }
+    
+    if ((pid=fork())==0) {
+        char **args;
+        int i;
+        
+        args = malloc(sizeof(char*)*(argc+1));
+        if (!args)
+          exit(10);
+        for (i=0; i<argc; i++) {
+            args[i] = argv[i];
+        }
+        args[argc] = NULL;
+        execvp(argv[0], args);
+        exit(10);
+    }
+    return pid;
+}
diff --git a/wmtictactoe/wmgeneral/misc.h b/wmtictactoe/wmgeneral/misc.h
new file mode 100644
index 0000000..602e1b7
--- /dev/null
+++ b/wmtictactoe/wmgeneral/misc.h
@@ -0,0 +1,9 @@
+#ifndef __MISC_H
+#define __MISC_H
+
+#include <unistd.h>
+
+extern void parse_command(char *, char ***, int *);
+
+extern pid_t execCommand(char *);
+#endif /* __MISC_H */
diff --git a/wmtictactoe/wmgeneral/wmgeneral.c b/wmtictactoe/wmgeneral/wmgeneral.c
new file mode 100644
index 0000000..a558a1f
--- /dev/null
+++ b/wmtictactoe/wmgeneral/wmgeneral.c
@@ -0,0 +1,479 @@
+/*
+	Best viewed with vim5, using ts=4
+
+	wmgeneral was taken from wmppp.
+
+	It has a lot of routines which most of the wm* programs use.
+
+	------------------------------------------------------------
+
+	Author: Martijn Pieterse ([email protected])
+
+	---
+	CHANGES:
+    ---
+    14/09/1998 (Dave Clark, [email protected])
+        * Updated createXBMfromXPM routine
+        * Now supports >256 colors
+	11/09/1998 (Martijn Pieterse, [email protected])
+		* Removed a bug from parse_rcfile. You could
+		  not use "start" in a command if a label was 
+		  also start.
+		* Changed the needed geometry string.
+		  We don't use window size, and don't support
+		  negative positions.
+	03/09/1998 (Martijn Pieterse, [email protected])
+		* Added parse_rcfile2
+	02/09/1998 (Martijn Pieterse, [email protected])
+		* Added -geometry support (untested)
+	28/08/1998 (Martijn Pieterse, [email protected])
+		* Added createXBMfromXPM routine
+		* Saves a lot of work with changing xpm's.
+	02/05/1998 (Martijn Pieterse, [email protected])
+		* changed the read_rc_file to parse_rcfile, as suggested by Marcelo E. Magallon
+		* debugged the parse_rc file.
+	30/04/1998 (Martijn Pieterse, [email protected])
+		* Ripped similar code from all the wm* programs,
+		  and put them in a single file.
+
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <ctype.h>
+#include <stdarg.h>
+
+#include <X11/Xlib.h>
+#include <X11/xpm.h>
+#include <X11/extensions/shape.h>
+
+#include "wmgeneral.h"
+
+  /*****************/
+ /* X11 Variables */
+/*****************/
+
+int			screen;
+int			x_fd;
+int			d_depth;
+XSizeHints	mysizehints;
+XWMHints	mywmhints;
+Pixel		back_pix, fore_pix;
+char		*Geometry = "";
+GC			NormalGC;
+XpmIcon		wmgen;
+Pixmap		pixmask;
+
+  /*****************/
+ /* Mouse Regions */
+/*****************/
+
+typedef struct {
+	int		enable;
+	int		top;
+	int		bottom;
+	int		left;
+	int		right;
+} MOUSE_REGION;
+
+MOUSE_REGION	mouse_region[MAX_MOUSE_REGION];
+
+  /***********************/
+ /* Function Prototypes */
+/***********************/
+
+static void GetXPM(XpmIcon *, char **);
+static Pixel GetColor(char *);
+void RedrawWindow(void);
+void AddMouseRegion(int, int, int, int, int);
+int CheckMouseRegion(int, int);
+
+/*******************************************************************************\
+|* parse_rcfile																   *|
+\*******************************************************************************/
+
+void parse_rcfile(const char *filename, rckeys *keys) {
+
+	char	*p,*q;
+	char	temp[128];
+	char	*tokens = " :\t\n";
+	FILE	*fp;
+	int		i,key;
+
+	fp = fopen(filename, "r");
+	if (fp) {
+		while (fgets(temp, 128, fp)) {
+			key = 0;
+			q = strdup(temp);
+			q = strtok(q, tokens);
+			while (key >= 0 && keys[key].label) {
+				if ((!strcmp(q, keys[key].label))) {
+					p = strstr(temp, keys[key].label);
+					p += strlen(keys[key].label);
+					p += strspn(p, tokens);
+					if ((i = strcspn(p, "#\n"))) p[i] = 0;
+					free(*keys[key].var);
+					*keys[key].var = strdup(p);
+					key = -1;
+				} else key++;
+			}
+			free(q);
+		}
+		fclose(fp);
+	}
+}
+
+/*******************************************************************************\
+|* parse_rcfile2															   *|
+\*******************************************************************************/
+
+void parse_rcfile2(const char *filename, rckeys2 *keys) {
+
+	char	*p;
+	char	temp[128];
+	char	*tokens = " :\t\n";
+	FILE	*fp;
+	int		i,key;
+	char	*family = NULL;
+
+	fp = fopen(filename, "r");
+	if (fp) {
+		while (fgets(temp, 128, fp)) {
+			key = 0;
+			while (key >= 0 && keys[key].label) {
+				if ((p = strstr(temp, keys[key].label))) {
+					p += strlen(keys[key].label);
+					p += strspn(p, tokens);
+					if ((i = strcspn(p, "#\n"))) p[i] = 0;
+					free(*keys[key].var);
+					*keys[key].var = strdup(p);
+					key = -1;
+				} else key++;
+			}
+		}
+		fclose(fp);
+	}
+	free(family);
+}
+
+
+/*******************************************************************************\
+|* GetXPM																	   *|
+\*******************************************************************************/
+
+static void GetXPM(XpmIcon *wmgen, char *pixmap_bytes[]) {
+
+	XWindowAttributes	attributes;
+	int					err;
+
+	/* For the colormap */
+	XGetWindowAttributes(display, Root, &attributes);
+
+	wmgen->attributes.valuemask |= (XpmReturnPixels | XpmReturnExtensions);
+
+	err = XpmCreatePixmapFromData(display, Root, pixmap_bytes, &(wmgen->pixmap),
+					&(wmgen->mask), &(wmgen->attributes));
+	
+	if (err != XpmSuccess) {
+		fprintf(stderr, "Not enough free colorcells.\n");
+		exit(1);
+	}
+}
+
+/*******************************************************************************\
+|* GetColor																	   *|
+\*******************************************************************************/
+
+static Pixel GetColor(char *name) {
+
+	XColor				color;
+	XWindowAttributes	attributes;
+
+	XGetWindowAttributes(display, Root, &attributes);
+
+	color.pixel = 0;
+	if (!XParseColor(display, attributes.colormap, name, &color)) {
+		fprintf(stderr, "wm.app: can't parse %s.\n", name);
+	} else if (!XAllocColor(display, attributes.colormap, &color)) {
+		fprintf(stderr, "wm.app: can't allocate %s.\n", name);
+	}
+	return color.pixel;
+}
+
+/*******************************************************************************\
+|* flush_expose																   *|
+\*******************************************************************************/
+
+static int flush_expose(Window w) {
+
+	XEvent 		dummy;
+	int			i=0;
+
+	while (XCheckTypedWindowEvent(display, w, Expose, &dummy))
+		i++;
+
+	return i;
+}
+
+/*******************************************************************************\
+|* RedrawWindow																   *|
+\*******************************************************************************/
+
+void RedrawWindow(void) {
+	
+	flush_expose(iconwin);
+	XCopyArea(display, wmgen.pixmap, iconwin, NormalGC, 
+				0,0, wmgen.attributes.width, wmgen.attributes.height, 0,0);
+	flush_expose(win);
+	XCopyArea(display, wmgen.pixmap, win, NormalGC,
+				0,0, wmgen.attributes.width, wmgen.attributes.height, 0,0);
+}
+
+/*******************************************************************************\
+|* RedrawWindowXY															   *|
+\*******************************************************************************/
+
+void RedrawWindowXY(int x, int y) {
+	
+	flush_expose(iconwin);
+	XCopyArea(display, wmgen.pixmap, iconwin, NormalGC, 
+				x,y, wmgen.attributes.width, wmgen.attributes.height, 0,0);
+	flush_expose(win);
+	XCopyArea(display, wmgen.pixmap, win, NormalGC,
+				x,y, wmgen.attributes.width, wmgen.attributes.height, 0,0);
+}
+
+/*******************************************************************************\
+|* AddMouseRegion															   *|
+\*******************************************************************************/
+
+void AddMouseRegion(int index, int left, int top, int right, int bottom) {
+
+	if (index < MAX_MOUSE_REGION) {
+		mouse_region[index].enable = 1;
+		mouse_region[index].top = top;
+		mouse_region[index].left = left;
+		mouse_region[index].bottom = bottom;
+		mouse_region[index].right = right;
+	}
+}
+
+/*******************************************************************************\
+|* CheckMouseRegion															   *|
+\*******************************************************************************/
+
+int CheckMouseRegion(int x, int y) {
+
+	int		i;
+	int		found;
+
+	found = 0;
+
+	for (i=0; i<MAX_MOUSE_REGION && !found; i++) {
+		if (mouse_region[i].enable &&
+			x <= mouse_region[i].right &&
+			x >= mouse_region[i].left &&
+			y <= mouse_region[i].bottom &&
+			y >= mouse_region[i].top)
+			found = 1;
+	}
+	if (!found) return -1;
+	return (i-1);
+}
+
+/*******************************************************************************\
+|* createXBMfromXPM															   *|
+\*******************************************************************************/
+void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
+
+	int		i,j,k;
+	int		width, height, numcol, depth;
+    int 	zero=0;
+	unsigned char	bwrite;
+    int		bcount;
+    int     curpixel;
+	
+	sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth);
+
+
+    for (k=0; k!=depth; k++)
+    {
+        zero <<=8;
+        zero |= xpm[1][k];
+    }
+        
+	for (i=numcol+1; i < numcol+sy+1; i++) {
+		bcount = 0;
+		bwrite = 0;
+		for (j=0; j<sx*depth; j+=depth) {
+            bwrite >>= 1;
+
+            curpixel=0;
+            for (k=0; k!=depth; k++)
+            {
+                curpixel <<=8;
+                curpixel |= xpm[i][j+k];
+            }
+                
+            if ( curpixel != zero ) {
+				bwrite += 128;
+			}
+			bcount++;
+			if (bcount == 8) {
+				*xbm = bwrite;
+				xbm++;
+				bcount = 0;
+				bwrite = 0;
+			}
+		}
+	}
+}
+
+/*******************************************************************************\
+|* copyXPMArea																   *|
+\*******************************************************************************/
+
+void copyXPMArea(int x, int y, int sx, int sy, int dx, int dy) {
+
+	XCopyArea(display, wmgen.pixmap, wmgen.pixmap, NormalGC, x, y, sx, sy, dx, dy);
+
+}
+
+/*******************************************************************************\
+|* copyXBMArea																   *|
+\*******************************************************************************/
+
+void copyXBMArea(int x, int y, int sx, int sy, int dx, int dy) {
+
+	XCopyArea(display, wmgen.mask, wmgen.pixmap, NormalGC, x, y, sx, sy, dx, dy);
+}
+
+
+/*******************************************************************************\
+|* setMaskXY																   *|
+\*******************************************************************************/
+
+void setMaskXY(int x, int y) {
+
+	 XShapeCombineMask(display, win, ShapeBounding, x, y, pixmask, ShapeSet);
+	 XShapeCombineMask(display, iconwin, ShapeBounding, x, y, pixmask, ShapeSet);
+}
+
+/*******************************************************************************\
+|* openXwindow																   *|
+\*******************************************************************************/
+void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bits, int pixmask_width, int pixmask_height) {
+
+	unsigned int	borderwidth = 1;
+	XClassHint		classHint;
+	char			*display_name = NULL;
+	char			*wname = argv[0];
+	XTextProperty	name;
+
+	XGCValues		gcv;
+	unsigned long	gcm;
+
+	char			*geometry = NULL;
+
+	int				dummy=0;
+	int				i, wx, wy;
+
+	for (i=1; argv[i]; i++) {
+		if (!strcmp(argv[i], "-display")) {
+			display_name = argv[i+1];
+			i++;
+		}
+		if (!strcmp(argv[i], "-geometry")) {
+			geometry = argv[i+1];
+			i++;
+		}
+	}
+
+	if (!(display = XOpenDisplay(display_name))) {
+		fprintf(stderr, "%s: can't open display %s\n", 
+						wname, XDisplayName(display_name));
+		exit(1);
+	}
+	screen  = DefaultScreen(display);
+	Root    = RootWindow(display, screen);
+	d_depth = DefaultDepth(display, screen);
+	x_fd    = XConnectionNumber(display);
+
+	/* Convert XPM to XImage */
+	GetXPM(&wmgen, pixmap_bytes);
+
+	/* Create a window to hold the stuff */
+	mysizehints.flags = USSize | USPosition;
+	mysizehints.x = 0;
+	mysizehints.y = 0;
+
+	back_pix = GetColor("white");
+	fore_pix = GetColor("black");
+
+	XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints,
+				&mysizehints.x, &mysizehints.y,&mysizehints.width,&mysizehints.height, &dummy);
+
+	mysizehints.width = 64;
+	mysizehints.height = 64;
+		
+	win = XCreateSimpleWindow(display, Root, mysizehints.x, mysizehints.y,
+				mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix);
+	
+	iconwin = XCreateSimpleWindow(display, win, mysizehints.x, mysizehints.y,
+				mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix);
+
+	/* Activate hints */
+	XSetWMNormalHints(display, win, &mysizehints);
+	classHint.res_name = wname;
+	classHint.res_class = wname;
+	XSetClassHint(display, win, &classHint);
+
+	XSelectInput(display, win, ButtonPressMask | ExposureMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask);
+	XSelectInput(display, iconwin, ButtonPressMask | ExposureMask | ButtonReleaseMask | PointerMotionMask  | StructureNotifyMask);
+
+	if (XStringListToTextProperty(&wname, 1, &name) == 0) {
+		fprintf(stderr, "%s: can't allocate window name\n", wname);
+		exit(1);
+	}
+
+	XSetWMName(display, win, &name);
+
+	/* Create GC for drawing */
+	
+	gcm = GCForeground | GCBackground | GCGraphicsExposures;
+	gcv.foreground = fore_pix;
+	gcv.background = back_pix;
+	gcv.graphics_exposures = 0;
+	NormalGC = XCreateGC(display, Root, gcm, &gcv);
+
+	/* ONLYSHAPE ON */
+
+	pixmask = XCreateBitmapFromData(display, win, pixmask_bits, pixmask_width, pixmask_height);
+
+	XShapeCombineMask(display, win, ShapeBounding, 0, 0, pixmask, ShapeSet);
+	XShapeCombineMask(display, iconwin, ShapeBounding, 0, 0, pixmask, ShapeSet);
+
+	/* ONLYSHAPE OFF */
+
+	mywmhints.initial_state = WithdrawnState;
+	mywmhints.icon_window = iconwin;
+	mywmhints.icon_x = mysizehints.x;
+	mywmhints.icon_y = mysizehints.y;
+	mywmhints.window_group = win;
+	mywmhints.flags = StateHint | IconWindowHint | IconPositionHint | WindowGroupHint;
+
+	XSetWMHints(display, win, &mywmhints);
+
+	XSetCommand(display, win, argv, argc);
+	XMapWindow(display, win);
+
+	if (geometry) {
+		if (sscanf(geometry, "+%d+%d", &wx, &wy) != 2) {
+			fprintf(stderr, "Bad geometry string.\n");
+			exit(1);
+		}
+		XMoveWindow(display, win, wx, wy);
+	}
+}
diff --git a/wmtictactoe/wmgeneral/wmgeneral.c~ b/wmtictactoe/wmgeneral/wmgeneral.c~
new file mode 100644
index 0000000..2dac8b4
--- /dev/null
+++ b/wmtictactoe/wmgeneral/wmgeneral.c~
@@ -0,0 +1,479 @@
+/*
+	Best viewed with vim5, using ts=4
+
+	wmgeneral was taken from wmppp.
+
+	It has a lot of routines which most of the wm* programs use.
+
+	------------------------------------------------------------
+
+	Author: Martijn Pieterse ([email protected])
+
+	---
+	CHANGES:
+    ---
+    14/09/1998 (Dave Clark, [email protected])
+        * Updated createXBMfromXPM routine
+        * Now supports >256 colors
+	11/09/1998 (Martijn Pieterse, [email protected])
+		* Removed a bug from parse_rcfile. You could
+		  not use "start" in a command if a label was 
+		  also start.
+		* Changed the needed geometry string.
+		  We don't use window size, and don't support
+		  negative positions.
+	03/09/1998 (Martijn Pieterse, [email protected])
+		* Added parse_rcfile2
+	02/09/1998 (Martijn Pieterse, [email protected])
+		* Added -geometry support (untested)
+	28/08/1998 (Martijn Pieterse, [email protected])
+		* Added createXBMfromXPM routine
+		* Saves a lot of work with changing xpm's.
+	02/05/1998 (Martijn Pieterse, [email protected])
+		* changed the read_rc_file to parse_rcfile, as suggested by Marcelo E. Magallon
+		* debugged the parse_rc file.
+	30/04/1998 (Martijn Pieterse, [email protected])
+		* Ripped similar code from all the wm* programs,
+		  and put them in a single file.
+
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <ctype.h>
+#include <stdarg.h>
+
+#include <X11/Xlib.h>
+#include <X11/xpm.h>
+#include <X11/extensions/shape.h>
+
+#include "wmgeneral.h"
+
+  /*****************/
+ /* X11 Variables */
+/*****************/
+
+int			screen;
+int			x_fd;
+int			d_depth;
+XSizeHints	mysizehints;
+XWMHints	mywmhints;
+Pixel		back_pix, fore_pix;
+char		*Geometry = "";
+GC			NormalGC;
+XpmIcon		wmgen;
+Pixmap		pixmask;
+
+  /*****************/
+ /* Mouse Regions */
+/*****************/
+
+typedef struct {
+	int		enable;
+	int		top;
+	int		bottom;
+	int		left;
+	int		right;
+} MOUSE_REGION;
+
+MOUSE_REGION	mouse_region[MAX_MOUSE_REGION];
+
+  /***********************/
+ /* Function Prototypes */
+/***********************/
+
+static void GetXPM(XpmIcon *, char **);
+static Pixel GetColor(char *);
+void RedrawWindow(void);
+void AddMouseRegion(int, int, int, int, int);
+int CheckMouseRegion(int, int);
+
+/*******************************************************************************\
+|* parse_rcfile																   *|
+\*******************************************************************************/
+
+void parse_rcfile(const char *filename, rckeys *keys) {
+
+	char	*p,*q;
+	char	temp[128];
+	char	*tokens = " :\t\n";
+	FILE	*fp;
+	int		i,key;
+
+	fp = fopen(filename, "r");
+	if (fp) {
+		while (fgets(temp, 128, fp)) {
+			key = 0;
+			q = strdup(temp);
+			q = strtok(q, tokens);
+			while (key >= 0 && keys[key].label) {
+				if ((!strcmp(q, keys[key].label))) {
+					p = strstr(temp, keys[key].label);
+					p += strlen(keys[key].label);
+					p += strspn(p, tokens);
+					if ((i = strcspn(p, "#\n"))) p[i] = 0;
+					free(*keys[key].var);
+					*keys[key].var = strdup(p);
+					key = -1;
+				} else key++;
+			}
+			free(q);
+		}
+		fclose(fp);
+	}
+}
+
+/*******************************************************************************\
+|* parse_rcfile2															   *|
+\*******************************************************************************/
+
+void parse_rcfile2(const char *filename, rckeys2 *keys) {
+
+	char	*p;
+	char	temp[128];
+	char	*tokens = " :\t\n";
+	FILE	*fp;
+	int		i,key;
+	char	*family = NULL;
+
+	fp = fopen(filename, "r");
+	if (fp) {
+		while (fgets(temp, 128, fp)) {
+			key = 0;
+			while (key >= 0 && keys[key].label) {
+				if ((p = strstr(temp, keys[key].label))) {
+					p += strlen(keys[key].label);
+					p += strspn(p, tokens);
+					if ((i = strcspn(p, "#\n"))) p[i] = 0;
+					free(*keys[key].var);
+					*keys[key].var = strdup(p);
+					key = -1;
+				} else key++;
+			}
+		}
+		fclose(fp);
+	}
+	free(family);
+}
+
+
+/*******************************************************************************\
+|* GetXPM																	   *|
+\*******************************************************************************/
+
+static void GetXPM(XpmIcon *wmgen, char *pixmap_bytes[]) {
+
+	XWindowAttributes	attributes;
+	int					err;
+
+	/* For the colormap */
+	XGetWindowAttributes(display, Root, &attributes);
+
+	wmgen->attributes.valuemask |= (XpmReturnPixels | XpmReturnExtensions);
+
+	err = XpmCreatePixmapFromData(display, Root, pixmap_bytes, &(wmgen->pixmap),
+					&(wmgen->mask), &(wmgen->attributes));
+	
+	if (err != XpmSuccess) {
+		fprintf(stderr, "Not enough free colorcells.\n");
+		exit(1);
+	}
+}
+
+/*******************************************************************************\
+|* GetColor																	   *|
+\*******************************************************************************/
+
+static Pixel GetColor(char *name) {
+
+	XColor				color;
+	XWindowAttributes	attributes;
+
+	XGetWindowAttributes(display, Root, &attributes);
+
+	color.pixel = 0;
+	if (!XParseColor(display, attributes.colormap, name, &color)) {
+		fprintf(stderr, "wm.app: can't parse %s.\n", name);
+	} else if (!XAllocColor(display, attributes.colormap, &color)) {
+		fprintf(stderr, "wm.app: can't allocate %s.\n", name);
+	}
+	return color.pixel;
+}
+
+/*******************************************************************************\
+|* flush_expose																   *|
+\*******************************************************************************/
+
+static int flush_expose(Window w) {
+
+	XEvent 		dummy;
+	int			i=0;
+
+	while (XCheckTypedWindowEvent(display, w, Expose, &dummy))
+		i++;
+
+	return i;
+}
+
+/*******************************************************************************\
+|* RedrawWindow																   *|
+\*******************************************************************************/
+
+void RedrawWindow(void) {
+	
+	flush_expose(iconwin);
+	XCopyArea(display, wmgen.pixmap, iconwin, NormalGC, 
+				0,0, wmgen.attributes.width, wmgen.attributes.height, 0,0);
+	flush_expose(win);
+	XCopyArea(display, wmgen.pixmap, win, NormalGC,
+				0,0, wmgen.attributes.width, wmgen.attributes.height, 0,0);
+}
+
+/*******************************************************************************\
+|* RedrawWindowXY															   *|
+\*******************************************************************************/
+
+void RedrawWindowXY(int x, int y) {
+	
+	flush_expose(iconwin);
+	XCopyArea(display, wmgen.pixmap, iconwin, NormalGC, 
+				x,y, wmgen.attributes.width, wmgen.attributes.height, 0,0);
+	flush_expose(win);
+	XCopyArea(display, wmgen.pixmap, win, NormalGC,
+				x,y, wmgen.attributes.width, wmgen.attributes.height, 0,0);
+}
+
+/*******************************************************************************\
+|* AddMouseRegion															   *|
+\*******************************************************************************/
+
+void AddMouseRegion(int index, int left, int top, int right, int bottom) {
+
+	if (index < MAX_MOUSE_REGION) {
+		mouse_region[index].enable = 1;
+		mouse_region[index].top = top;
+		mouse_region[index].left = left;
+		mouse_region[index].bottom = bottom;
+		mouse_region[index].right = right;
+	}
+}
+
+/*******************************************************************************\
+|* CheckMouseRegion															   *|
+\*******************************************************************************/
+
+int CheckMouseRegion(int x, int y) {
+
+	int		i;
+	int		found;
+
+	found = 0;
+
+	for (i=0; i<MAX_MOUSE_REGION && !found; i++) {
+		if (mouse_region[i].enable &&
+			x <= mouse_region[i].right &&
+			x >= mouse_region[i].left &&
+			y <= mouse_region[i].bottom &&
+			y >= mouse_region[i].top)
+			found = 1;
+	}
+	if (!found) return -1;
+	return (i-1);
+}
+
+/*******************************************************************************\
+|* createXBMfromXPM															   *|
+\*******************************************************************************/
+void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
+
+	int		i,j,k;
+	int		width, height, numcol, depth;
+    int 	zero=0;
+	unsigned char	bwrite;
+    int		bcount;
+    int     curpixel;
+	
+	sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth);
+
+
+    for (k=0; k!=depth; k++)
+    {
+        zero <<=8;
+        zero |= xpm[1][k];
+    }
+        
+	for (i=numcol+1; i < numcol+sy+1; i++) {
+		bcount = 0;
+		bwrite = 0;
+		for (j=0; j<sx*depth; j+=depth) {
+            bwrite >>= 1;
+
+            curpixel=0;
+            for (k=0; k!=depth; k++)
+            {
+                curpixel <<=8;
+                curpixel |= xpm[i][j+k];
+            }
+                
+            if ( curpixel != zero ) {
+				bwrite += 128;
+			}
+			bcount++;
+			if (bcount == 8) {
+				*xbm = bwrite;
+				xbm++;
+				bcount = 0;
+				bwrite = 0;
+			}
+		}
+	}
+}
+
+/*******************************************************************************\
+|* copyXPMArea																   *|
+\*******************************************************************************/
+
+void copyXPMArea(int x, int y, int sx, int sy, int dx, int dy) {
+
+	XCopyArea(display, wmgen.pixmap, wmgen.pixmap, NormalGC, x, y, sx, sy, dx, dy);
+
+}
+
+/*******************************************************************************\
+|* copyXBMArea																   *|
+\*******************************************************************************/
+
+void copyXBMArea(int x, int y, int sx, int sy, int dx, int dy) {
+
+	XCopyArea(display, wmgen.mask, wmgen.pixmap, NormalGC, x, y, sx, sy, dx, dy);
+}
+
+
+/*******************************************************************************\
+|* setMaskXY																   *|
+\*******************************************************************************/
+
+void setMaskXY(int x, int y) {
+
+	 XShapeCombineMask(display, win, ShapeBounding, x, y, pixmask, ShapeSet);
+	 XShapeCombineMask(display, iconwin, ShapeBounding, x, y, pixmask, ShapeSet);
+}
+
+/*******************************************************************************\
+|* openXwindow																   *|
+\*******************************************************************************/
+void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bits, int pixmask_width, int pixmask_height) {
+
+	unsigned int	borderwidth = 1;
+	XClassHint		classHint;
+	char			*display_name = NULL;
+	char			*wname = argv[0];
+	XTextProperty	name;
+
+	XGCValues		gcv;
+	unsigned long	gcm;
+
+	char			*geometry = NULL;
+
+	int				dummy=0;
+	int				i, wx, wy;
+
+	for (i=1; argv[i]; i++) {
+		if (!strcmp(argv[i], "-display")) {
+			display_name = argv[i+1];
+			i++;
+		}
+		if (!strcmp(argv[i], "-geometry")) {
+			geometry = argv[i+1];
+			i++;
+		}
+	}
+
+	if (!(display = XOpenDisplay(display_name))) {
+		fprintf(stderr, "%s: can't open display %s\n", 
+						wname, XDisplayName(display_name));
+		exit(1);
+	}
+	screen  = DefaultScreen(display);
+	Root    = RootWindow(display, screen);
+	d_depth = DefaultDepth(display, screen);
+	x_fd    = XConnectionNumber(display);
+
+	/* Convert XPM to XImage */
+	GetXPM(&wmgen, pixmap_bytes);
+
+	/* Create a window to hold the stuff */
+	mysizehints.flags = USSize | USPosition;
+	mysizehints.x = 0;
+	mysizehints.y = 0;
+
+	back_pix = GetColor("white");
+	fore_pix = GetColor("black");
+
+	XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints,
+				&mysizehints.x, &mysizehints.y,&mysizehints.width,&mysizehints.height, &dummy);
+
+	mysizehints.width = 64;
+	mysizehints.height = 64;
+		
+	win = XCreateSimpleWindow(display, Root, mysizehints.x, mysizehints.y,
+				mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix);
+	
+	iconwin = XCreateSimpleWindow(display, win, mysizehints.x, mysizehints.y,
+				mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix);
+
+	/* Activate hints */
+	XSetWMNormalHints(display, win, &mysizehints);
+	classHint.res_name = wname;
+	classHint.res_class = wname;
+	XSetClassHint(display, win, &classHint);
+
+	XSelectInput(display, win, ButtonPressMask | ExposureMask /*| ButtonReleaseMask | PointerMotionMask*/ | StructureNotifyMask);
+	XSelectInput(display, iconwin, ButtonPressMask | ExposureMask /*| ButtonReleaseMask | PointerMotionMask */ | StructureNotifyMask);
+
+	if (XStringListToTextProperty(&wname, 1, &name) == 0) {
+		fprintf(stderr, "%s: can't allocate window name\n", wname);
+		exit(1);
+	}
+
+	XSetWMName(display, win, &name);
+
+	/* Create GC for drawing */
+	
+	gcm = GCForeground | GCBackground | GCGraphicsExposures;
+	gcv.foreground = fore_pix;
+	gcv.background = back_pix;
+	gcv.graphics_exposures = 0;
+	NormalGC = XCreateGC(display, Root, gcm, &gcv);
+
+	/* ONLYSHAPE ON */
+
+	pixmask = XCreateBitmapFromData(display, win, pixmask_bits, pixmask_width, pixmask_height);
+
+	XShapeCombineMask(display, win, ShapeBounding, 0, 0, pixmask, ShapeSet);
+	XShapeCombineMask(display, iconwin, ShapeBounding, 0, 0, pixmask, ShapeSet);
+
+	/* ONLYSHAPE OFF */
+
+	mywmhints.initial_state = WithdrawnState;
+	mywmhints.icon_window = iconwin;
+	mywmhints.icon_x = mysizehints.x;
+	mywmhints.icon_y = mysizehints.y;
+	mywmhints.window_group = win;
+	mywmhints.flags = StateHint | IconWindowHint | IconPositionHint | WindowGroupHint;
+
+	XSetWMHints(display, win, &mywmhints);
+
+	XSetCommand(display, win, argv, argc);
+	XMapWindow(display, win);
+
+	if (geometry) {
+		if (sscanf(geometry, "+%d+%d", &wx, &wy) != 2) {
+			fprintf(stderr, "Bad geometry string.\n");
+			exit(1);
+		}
+		XMoveWindow(display, win, wx, wy);
+	}
+}
diff --git a/wmtictactoe/wmgeneral/wmgeneral.h b/wmtictactoe/wmgeneral/wmgeneral.h
new file mode 100644
index 0000000..37e5411
--- /dev/null
+++ b/wmtictactoe/wmgeneral/wmgeneral.h
@@ -0,0 +1,61 @@
+#ifndef WMGENERAL_H_INCLUDED
+#define WMGENERAL_H_INCLUDED
+
+  /***********/
+ /* Defines */
+/***********/
+
+#define MAX_MOUSE_REGION (16)
+
+  /************/
+ /* Typedefs */
+/************/
+
+typedef struct _rckeys rckeys;
+
+struct _rckeys {
+	const char	*label;
+	char		**var;
+};
+
+typedef struct _rckeys2 rckeys2;
+
+struct _rckeys2 {
+	const char	*family;
+	const char	*label;
+	char		**var;
+};
+
+typedef struct {
+	Pixmap			pixmap;
+	Pixmap			mask;
+	XpmAttributes	attributes;
+} XpmIcon;
+
+  /*******************/
+ /* Global variable */
+/*******************/
+
+Display		*display;
+Window          Root, iconwin, win;
+
+
+  /***********************/
+ /* Function Prototypes */
+/***********************/
+
+void AddMouseRegion(int index, int left, int top, int right, int bottom);
+int CheckMouseRegion(int x, int y);
+
+void openXwindow(int argc, char *argv[], char **, char *, int, int);
+void RedrawWindow(void);
+void RedrawWindowXY(int x, int y);
+
+void createXBMfromXPM(char *, char **, int, int);
+void copyXPMArea(int, int, int, int, int, int);
+void copyXBMArea(int, int, int, int, int, int);
+void setMaskXY(int, int);
+
+void parse_rcfile(const char *, rckeys *);
+
+#endif
diff --git a/wmtictactoe/wmtictactoe/Makefile b/wmtictactoe/wmtictactoe/Makefile
new file mode 100755
index 0000000..d5f16ae
--- /dev/null
+++ b/wmtictactoe/wmtictactoe/Makefile
@@ -0,0 +1,21 @@
+LIBDIR = -L/usr/X11R6/lib
+LIBS   = -lXpm -lXext -lX11
+OBJS =  wmtictactoe.o ../wmgeneral/wmgeneral.o
+
+.c.o:
+	cc -c -g -O2 -Wall $< -o $*.o
+
+all: wmtictactoe
+
+wmtictactoe: $(OBJS)
+	cc -o wmtictactoe $^ $(LIBDIR) $(LIBS)
+
+clean:
+	for i in $(OBJS) ; do \
+		rm -rf $$i;\
+	done
+	rm -rf wmtictactoe core *~
+
+install:
+	/usr/bin/install -c -o 0 -g 0 -s -m 755 wmtictactoe /usr/local/bin/wmtictactoe
+
diff --git a/wmtictactoe/wmtictactoe/wmtictactoe-master.xpm b/wmtictactoe/wmtictactoe/wmtictactoe-master.xpm
new file mode 100644
index 0000000..f6022f0
--- /dev/null
+++ b/wmtictactoe/wmtictactoe/wmtictactoe-master.xpm
@@ -0,0 +1,220 @@
+/* XPM */
+static char * wmtictactoe_master_xpm[] = {
+"128 120 97 2",
+"  	c None",
+". 	c #000000",
+"+ 	c #FFFFFF",
+"@ 	c #C73000",
+"# 	c #C7C7C7",
+"$ 	c #FFFF00",
+"% 	c #827F00",
+"& 	c #817F02",
+"* 	c #817E01",
+"= 	c #666666",
+"- 	c #04628E",
+"; 	c #7AD2F4",
+"> 	c #0B7DAA",
+", 	c #00007F",
+"' 	c #808080",
+") 	c #686868",
+"! 	c #565657",
+"~ 	c #404041",
+"{ 	c #2D2D2E",
+"] 	c #333333",
+"^ 	c #999999",
+"/ 	c #9F9F9F",
+"( 	c #91918F",
+"_ 	c #717171",
+": 	c #545454",
+"< 	c #3D3D3D",
+"[ 	c #272726",
+"} 	c #101010",
+"| 	c #080808",
+"1 	c #5C5C5C",
+"2 	c #5C5C56",
+"3 	c #191912",
+"4 	c #060606",
+"5 	c #A3A3A3",
+"6 	c #8D8D8C",
+"7 	c #6D6D6D",
+"8 	c #575757",
+"9 	c #414141",
+"0 	c #2B2B2B",
+"a 	c #151514",
+"b 	c #020202",
+"c 	c #161616",
+"d 	c #EDEDED",
+"e 	c #DBDBDB",
+"f 	c #858585",
+"g 	c #080807",
+"h 	c #8A8A8A",
+"i 	c #747474",
+"j 	c #5B5B5B",
+"k 	c #444444",
+"l 	c #292929",
+"m 	c #151515",
+"n 	c #040404",
+"o 	c #D8D8D8",
+"p 	c #BCBCBC",
+"q 	c #9A9A9A",
+"r 	c #373736",
+"s 	c #777777",
+"t 	c #616161",
+"u 	c #494949",
+"v 	c #474747",
+"w 	c #AFAFAF",
+"x 	c #ADADAC",
+"y 	c #A8A8A8",
+"z 	c #A0A0A0",
+"A 	c #7F7F7F",
+"B 	c #30302F",
+"C 	c #7E7E7E",
+"D 	c #4E4E4E",
+"E 	c #363636",
+"F 	c #1C1C1C",
+"G 	c #636363",
+"H 	c #F8F8F8",
+"I 	c #DCDBDB",
+"J 	c #C5C5C5",
+"K 	c #B0B0B0",
+"L 	c #828282",
+"M 	c #505050",
+"N 	c #090908",
+"O 	c #131313",
+"P 	c #3F3F3F",
+"Q 	c #393939",
+"R 	c #424242",
+"S 	c #E7E7E7",
+"T 	c #C0C0BF",
+"U 	c #A9A9A9",
+"V 	c #929292",
+"W 	c #727272",
+"X 	c #434343",
+"Y 	c #383838",
+"Z 	c #1F1F1F",
+"` 	c #6B6B6B",
+" .	c #6C6C6C",
+"..	c #616160",
+"+.	c #515151",
+"@.	c #303030",
+"#.	c #0F0F0F",
+"                                                                                                                                .                                                                                                                               ",
+"                                                                                                                                .                                                                                                                               ",
+"                                                                                                                                .                                                                                                                               ",
+"                                                                                                                                .                                                                                                                               ",
+"        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .         .       . . + + + + + + + + + . .   . . . . . . . . . . . . .   @ @ @ @ @ . . . . . . @ @   @ @ @ @ @ . . . . . . + @           ",
+"        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #         .       . + $ $ $ $ $ $ $ $ $ % .   . . . . . . . . . . . . .   . @ @ @ @ @ . . . . @ @ .   . @ @ @ @ @ . . . . + @ .           ",
+"        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #         .       + $ $ $ . . $ . . $ $ $ %   . . . . . . . . . . . . .   . . @ @ @ @ @ . . @ @ . .   . . @ @ @ @ @ . . + @ . .           ",
+"        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #         .       + $ $ $ $ . $ . $ $ $ $ &   . . . . . . . . . . . . .   . . . @ @ @ . . @ @ . . .   . . . @ @ @ . . @ @ . . .           ",
+"        . . . . . . . . . . . . . . . . . + . . . . . . . . . . . . . . . . . . + . . . . . . . . . . . . . . . . . . #         .       + $ . $ $ $ $ $ $ $ . $ *   . . . . . . . . . . . . .   . . . @ @ . . @ @ @ . . .   . . . + @ . . @ @ @ . . .           ",
+"        . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . #         .       + $ $ . . . . . . . $ $ *   . . . . . . . . . . . . .   . . @ @ . . @ @ @ @ @ . .   . . + @ . . @ @ @ @ @ . .           ",
+"        . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . #         .       . + $ $ $ $ $ $ $ $ $ % .   . . . . . . . . . . . . .   . @ @ . . . . @ @ @ @ @ .   . + @ . . . . @ @ @ @ @ .           ",
+"        . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . #         .       . . % % % % % % % % % . .   . . . . . . . . . . . . .   @ @ . . . . . . @ @ @ @ @   + @ . . . . . . @ @ @ @ @           ",
+"        . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . #         .                                                                                                                               ",
+"        . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . #         .       . - - - - ; ; ; ; - - - > > > > - - - ; ; ; ; - - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - - #         ",
+"        . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . #         .       . - - - ; - - - - ; - ; - - - - > - ; - - - - ; - ; - - - - ; - > - - - - > - > - - - - > - > - - - - > - - - #         ",
+"        . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . #         .       . - - - ; - - - - ; - ; - - - - > - ; - - - - ; - ; - - - - ; - > - - - - > - > - - - - > - > - - - - > - - - #         ",
+"        . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . #         .       . - - - ; - - - - ; - ; - - - - > - ; - - - - ; - ; - - - - ; - > - - - - > - > - - - - > - > - - - - > - - - #         ",
+"        . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . #         .       . - - - - ; ; ; ; - - - > > > > - - - ; ; ; ; - - - ; ; ; ; - - - > > > > - - - > > > > - - - > > > > - - - - #         ",
+"        . . + + + + + + + + + + + + + + + + = + + + + + + + + + + + + + + + + + + = + + + + + + + + + + + + + + . . . #         .       . - - - ; - - - - > - ; - - - - > - ; - - - - ; - > - - - - ; - > - - - - > - > - - - - > - > - - - - > - - - #         ",
+"        . . . = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = . . #         .       . - - - ; - - - - > - ; - - - - > - ; - - - - ; - > - - - - ; - > - - - - > - > - - - - > - > - - - - > - - - #         ",
+"        . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . #         .       . - - - ; - - - - > - ; - - - - > - ; - - - - ; - > - - - - ; - > - - - - > - > - - - - > - > - - - - > - - - #         ",
+"        . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . #         .       . - - - - > > > > - - - ; ; ; ; - - - > > > > - - - ; ; ; ; - - - > > > > - - - > > > > - - - > > > > - - - - #         ",
+"        . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . #         .                                                                                                                               ",
+"        . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . #         .       . - - - - > > > > - - - ; ; ; ; - - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - - #         ",
+"        . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . #         .       . - - - ; - - - - ; - ; - - - - ; - ; - - - - ; - > - - - - > - ; - - - - ; - > - - - - ; - ; - - - - ; - - - #         ",
+"        . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . #         .       . - - - ; - - - - ; - ; - - - - ; - ; - - - - ; - > - - - - > - ; - - - - ; - > - - - - ; - ; ; ; - - ; - - - #         ",
+"        . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . #         .       . - - - ; - - - - ; - ; - - - - ; - ; - - - - ; - > - - - - > - ; - - - - ; - > - - - - ; - ; - - ; ; ; - - - #         ",
+"        . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . #         .       . - - - - ; ; ; ; - - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - - #         ",
+"        . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . #         .       . - - - > - - - - ; - ; - - - - ; - ; - - - - ; - > - - - - > - ; - - - - ; - > - - - - ; - ; - - - - ; - - - #         ",
+"        . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . #         .       . - - - > - - - - ; - ; - - - - ; - ; - - - - ; - > - - - - > - ; - ; ; - ; - > - - - - ; - ; - - - - ; - - - #         ",
+"        . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . #         .       . - - - > - - - - ; - ; - - - - ; - ; - - - - ; - > - - - - > - ; ; - - ; ; - > - - - - ; - ; - - - - ; - - - #         ",
+"        . . + + + + + + + + + + + + + + + + = + + + + + + + + + + + + + + + + + + = + + + + + + + + + + + + + + . . . #         .       . - - - - ; ; ; ; - - - ; ; ; ; - - - ; ; ; ; - - - > > > > - - ; > > > > ; - - > > > > - - - > > > > - - - - #         ",
+"        . . . = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = . . #         .                                                                                                                               ",
+"        . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . #         .       . - - - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - - #         ",
+"        . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . #         .       . - - - > - - - - ; - > - - - - > - ; - - - - ; - > - - - - ; - ; - - - - ; - > - - - - > - > - - - - > - - - #         ",
+"        . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . #         .       . - - - > - - - - ; - > - - - - > - ; - - - - ; - > - - - - ; - ; ; ; - - ; - > - - - - > - > - - - - > - - - #         ",
+"        . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . #         .       . - - - > - - - - ; - > - - - - > - ; - - - - ; - > - - - - ; - ; - - ; ; ; - > - - - - > - > - - - - > - - - #         ",
+"        . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . #         .       . - - - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - - #         ",
+"        . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . #         .       . - - - > - - - - ; - > - - - - > - ; - - - - ; - > - - - - ; - ; - - - - ; - > - - - - > - > - - - - > - - - #         ",
+"        . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . #         .       . - - - > - - - - ; - > - - - - > - ; - ; ; - ; - > - - - - ; - ; - - - - ; - > - - - - > - > - - - - > - - - #         ",
+"        . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . #         .       . - - - > - - - - ; - > - - - - > - ; ; - - ; ; - > - - - - ; - ; - - - - ; - > - - - - > - > - - - - > - - - #         ",
+"        . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . + = . . . . . . . . . . . . . . . . . #         .       . - - - - > > > > - - - > > > > - - ; > > > > ; - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - - #         ",
+"        . . . . . . . . . . . . . . . . . . = . . . . . . . . . . . . . . . . . . = . . . . . . . . . . . . . . . . . #         .                                                                                                                               ",
+"        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #         .       . - - - - ; ; > > - - - ; ; ; ; - - - > > > > - - - ; ; ; ; - - - ; ; ; ; - - - > > > > - - - > > > > - - - - #         ",
+"        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #         .       . - - - ; - - ; ; > - ; - - - - ; - ; - - - - ; - ; - - - - > - ; - - - - ; - > - - - - > - > - - - - > - - - #         ",
+"        . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #         .       . - - - ; - - - - ; - ; - - - - ; - ; - - - - ; - ; - - - - > - ; - - - - ; - > - - - - > - > - - - - > - - - #         ",
+"        . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #         .       . - - - ; - - - - ; - ; - - - - ; - ; - - - - ; - ; - - - - > - ; - - - - ; - > - - - - > - > - - - - > - - - #         ",
+"        . - - - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - - #         .       . - - - - > > > > - - - ; ; ; ; - - - > > > > - - - > > > > - - - ; ; ; ; - - - > > > > - - - > > > > - - - - #         ",
+"        . - - - > - - - - > - > - - - - > - > - - - - > - > - - - - > - > - - - - > - > - - - - > - > - - - - > - - - #         .       . - - - ; - - - - ; - ; - - - - > - ; - - - - ; - ; - - - - > - ; - - - - > - > - - - - > - > - - - - > - - - #         ",
+"        . - - - > - - - - > - > - - - - > - > - - - - > - > - - - - > - > - - - - > - > - - - - > - > - - - - > - - - #         .       . - - - ; - - - - ; - ; - - - - > - ; - - - - ; - ; - - - - > - ; - - - - > - > - - - - > - > - - - - > - - - #         ",
+"        . - - - > - - - - > - > - - - - > - > - - - - > - > - - - - > - > - - - - > - > - - - - > - > - - - - > - - - #         .       . - - - ; - - ; ; > - ; - - - - > - ; - - - - ; - ; - - - - > - ; - - - - > - > - - - - > - > - - - - > - - - #         ",
+"        . - - - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - - #         .       . - - - - ; ; > > - - - ; ; ; ; - - - ; ; ; ; - - - ; ; ; ; - - - ; ; ; ; - - - > > > > - - - > > > > - - - - #         ",
+"        . - - - > - - - - > - > - - - - > - > - - - - > - > - - - - > - > - - - - > - > - - - - > - > - - - - > - - - #         .                                                                                                                               ",
+"        . - - - > - - - - > - > - - - - > - > - - - - > - > - - - - > - > - - - - > - > - - - - > - > - - - - > - - - #         .       . - - - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - - #         ",
+"        . - - - > - - - - > - > - - - - > - > - - - - > - > - - - - > - > - - - - > - > - - - - > - > - - - - > - - - #         .       . - - - > - - - - > - > - - - - > - > - - - - > - > - - - - > - > - - - - > - > - - - - > - > - - - - > - - - #         ",
+"        . - - - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - - #         .       . - - - > - - - - > - > - - - - > - > - - - - > - > - - - - > - > - - - - > - > - - - - > - > - - - - > - - - #         ",
+"        . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #         .       . - - - > - - - - > - > - - - - > - > - - - - > - > - - - - > - > - - - - > - > - - - - > - > - - - - > - - - #         ",
+"        . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #         .       . - - - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - - #         ",
+"        . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #         .       . - - - > - - - - > - > - - - - > - > - - - - > - > - - - - > - > - - - - > - > - - - - > - > - - - - > - - - #         ",
+"        # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #         .       . - - - > - - - - > - > - - - - > - > - - - - > - > - - - - > - > - - - - > - > - - - - > - > - - - - > - - - #         ",
+"                                                                                                                                .       . - - - > - - - - > - > - - - - > - > - - - - > - > - - - - > - > - - - - > - > - - - - > - > - - - - > - - - #         ",
+"                                                                                                                                .       . - - - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - > > > > - - - - #         ",
+"                                                                                                                                .                                                                                                                               ",
+"                                                                                                                                .                                                                                                                               ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                                                                                                               ",
+"        . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #           . ; ; ; ; . . , , , , . . ; ; ; ; . . ; ; ; ; . . , , , , . . ; ; ; ; . . ; ; ; ; . . ; ; ; ; . . ; ; ; ; . . ; ; ; ; .       ",
+"        . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #           ; . . . . ; , . . . . ; , . . . . ; , . . . . ; ; . . . . ; ; . . . . , ; . . . . , , . . . . ; ; . . . . ; ; . . . . ;       ",
+"        . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #           ; . . . . ; , . . . . ; , . . . . ; , . . . . ; ; . . . . ; ; . . . . , ; . . . . , , . . . . ; ; . . . . ; ; . . . . ;       ",
+"        . - - - - > > > > - - - ; ; ; ; - - - ; ; ; ; - - - ; ; ; ; - - - ; ; ; ; - - - ; ; ; ; - - - > > > > - - - - #           ; . . . . ; , . . . . ; , . . . . ; , . . . . ; ; . . . . ; ; . . . . , ; . . . . , , . . . . ; ; . . . . ; ; . . . . ;       ",
+"        . - - - > - - - - > - ; - - - - > - ; - - - - > - ; - - - - ; - ; - - - - ; - ; - - - - ; - > - - - - > - - - #           . , , , , . . , , , , . . ; ; ; ; . . ; ; ; ; . . ; ; ; ; . . ; ; ; ; . . ; ; ; ; . . , , , , . . ; ; ; ; . . ; ; ; ; .       ",
+"        . - - - > - - - - > - ; - - - - > - ; - - - - > - ; - - - - ; - ; - - - - ; - ; - - - - ; - > - - - - > - - - #           ; . . . . ; , . . . . ; ; . . . . , , . . . . ; , . . . . ; , . . . . ; ; . . . . ; , . . . . ; ; . . . . ; , . . . . ;       ",
+"        . - - - > - - - - > - ; - - - - > - ; - - - - > - ; - - - - ; - ; - - - - ; - ; - - - - ; - > - - - - > - - - #           ; . . . . ; , . . . . ; ; . . . . , , . . . . ; , . . . . ; , . . . . ; ; . . . . ; , . . . . ; ; . . . . ; , . . . . ;       ",
+"        . - - - - > > > > - - - ; ; ; ; - - - > > > > - - - > > > > - - - ; ; ; ; - - - ; ; ; ; - - - > > > > - - - - #           ; . . . . ; , . . . . ; ; . . . . , , . . . . ; , . . . . ; , . . . . ; ; . . . . ; , . . . . ; ; . . . . ; , . . . . ;       ",
+"        . - - - > - - - - > - > - - - - ; - ; - - - - > - ; - - - - ; - ; - ; - - > - ; - - - - > - > - - - - > - - - #           . ; ; ; ; . . , , , , . . ; ; ; ; . . ; ; ; ; . . , , , , . . ; ; ; ; . . ; ; ; ; . . , , , , . . ; ; ; ; . . ; ; ; ; .       ",
+"        . - - - > - - - - > - > - - - - ; - ; - - - - > - ; - - - - ; - ; - - ; - > - ; - - - - > - > - - - - > - - - #                                                                           . . . ' ) ! ~ { ] ^ . . .                                     ",
+"        . - - - > - - - - > - > - - - - ; - ; - - - - > - ; - - - - ; - ; - - - ; > - ; - - - - > - > - - - - > - - - #                                                                           . / ( _ : < [ } | 1 2 3 4                                     ",
+"        . - - - - > > > > - - - ; ; ; ; - - - ; ; ; ; - - - ; ; ; ; - - - > > > > - - - ; ; ; ; - - - > > > > - - - - #                                                                           5 6 7 8 9 0 a b c d e f g                                     ",
+"        . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #                                                                           h i j k l m n . m o p q r                                     ",
+"        . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #                                                                           s t u 0 v w x y w # z A B                                     ",
+"        . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #                                                                           C D E F G H I J K q L M N                                     ",
+"        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #                                                                           O P Q R h S T U V W X | .                                     ",
+"        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #                                                                           Y Z c P `  ...+.@.#.. . .                                     ",
+"        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #                                                                                                                                         ",
+"        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #                 . - - - - - - - - - - - - - - - - - - - - - - - - - > > > > - - - > > > > - - - > > > > - - - ; ; ; ; - - - - #         ",
+"        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #                 . - - - - - - - - + + + + + + + + + - - - - - - - ; - - - - ; - > - - - - ; - ; - - - - ; - ; - - - - > - - - #         ",
+"        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #                 . - - - - - - - + $ $ $ $ $ $ $ $ $ % - - - - - - ; - - - - ; - > - - - - ; - ; ; ; - - ; - ; - - - - > - - - #         ",
+"        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #                 . - - - - - - + $ $ $ . . $ . . $ $ $ % - - - - - ; - - - - ; - > - - - - ; - ; - - ; ; ; - ; - - - - > - - - #         ",
+"        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #                 . - - - - - - + $ $ $ $ . $ . $ $ $ $ & - - - - - - > > > > - - - > > > > - - - > > > > - - - ; ; ; ; - - - - #         ",
+"        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #                 . - - - - - - + $ . $ $ $ $ $ $ $ . $ * - - - - - ; - - - - ; - > - - - - ; - ; - - - - ; - > - - - - ; - - - #         ",
+"        . . . . . . + + + + + + + + + . . . . . . . . . . . . . . . . . . . . . . . . @ @ @ @ @ . . . . . . @ @ . . . #                 . - - - - - - + $ $ . . . . . . . $ $ * - - - - - ; - ; ; - ; - > - - - - ; - ; - - - - ; - > - - - - ; - - - #         ",
+"        . . . . . + $ $ $ $ $ $ $ $ $ % . . . . . . . . . . . . . . . . . . . . . . . . @ @ @ @ @ . . . . @ @ . . . . #                 . - - - - - - - + $ $ $ $ $ $ $ $ $ % - - - - - - ; ; - - ; ; - > - - - - ; - ; - - - - ; - > - - - - ; - - - #         ",
+"        . . . . + $ $ $ . . $ . . $ $ $ % . . . . . . . . . . . . . . . . . . . . . . . . @ @ @ @ @ . . @ @ . . . . . #                 . - - - - - - - - % % % % % % % % % - - - - - - - ; > > > > ; - - > > > > - - - > > > > - - - ; ; ; ; - - - - #         ",
+"        . . . . + $ $ $ $ . $ . $ $ $ $ % . . . . . . ; . . . ; . . ; ; ; . . . . . . . . . @ @ @ . . @ @ . . . . . . #                                                                                                                                         ",
+"        . . . . + $ . $ $ $ $ $ $ $ . $ % . . . . . . ; . . . ; . ; . . . . . . . . . . . . @ @ . . @ @ @ . . . . . . #                 . - - - - - - - - - - - - - - - - - - - - - - - - - > > > > - - - > > > > - - - > > > > - - - ; ; ; ; - - - - #         ",
+"        . . . . + $ $ . . . . . . . $ $ % . . . . . . ; . . . ; . ; ; ; ; ; . . . . . . . @ @ . . @ @ @ @ @ . . . . . #                 . - - - - - - - - - ' ) ! ~ { ] ^ . . . - - - - - ; - - - - ; - > - - - - ; - ; - - - - ; - ; - - - - > - - - #         ",
+"        . . . . . + $ $ $ $ $ $ $ $ $ % . . . . . . . . ; . ; . . . . . . ; . . . . . . @ @ . . . . @ @ @ @ @ . . . . #                 . - - - - - - - / ( _ : < [ } | 1 2 3 4 - - - - - ; - - - - ; - > - - - - ; - ; ; ; - - ; - ; - - - - > - - - #         ",
+"        . . . . . . % % % % % % % % % . . . . . . . . . . ; . . . . ; ; ; . . . . . . @ @ . . . . . . @ @ @ @ @ . . . #                 . - - - - - - 5 6 7 8 9 0 a b c d e f g - - - - - ; - - - - ; - > - - - - ; - ; - - ; ; ; - ; - - - - > - - - #         ",
+"        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #                 . - - - - - - h i j k l m n . m o p q r - - - - - - > > > > - - - > > > > - - - > > > > - - - ; ; ; ; - - - - #         ",
+"        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #                 . - - - - - - s t u 0 v w x y w # z A B - - - - - ; - - - - ; - > - - - - ; - ; - - - - ; - > - - - - ; - - - #         ",
+"        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #                 . - - - - - - C D E F G H I J K q L M N - - - - - ; - ; ; - ; - > - - - - ; - ; - - - - ; - > - - - - ; - - - #         ",
+"        . . . . . , , , , . . . , , , , . . . . . . . , , , , . . . , , , , . . . . . . , , , , . . . , , , , . . . . #                 . - - - - - - O P Q R h S T U V W X | . - - - - - ; ; - - ; ; - > - - - - ; - ; - - - - ; - > - - - - ; - - - #         ",
+"        . . . . , . . . . , . , . . . . , . . . . . , . . . . , . , . . . . , . . . . , . . . . , . , . . . . , . . . #                 . - - - - - - Y Z c P `  ...+.@.#.. . . - - - - - ; > > > > ; - - > > > > - - - > > > > - - - ; ; ; ; - - - - #         ",
+"        . . . . , . . . . , . , . . . . , . . . . . , . . . . , . , . . . . , . . . . , . . . . , . , . . . . , . . . #                                                                                                                                         ",
+"        . . . . , . . . . , . , . . . . , . . . . . , . . . . , . , . . . . , . . . . , . . . . , . , . . . . , . . . #                 . - - - - - - - - - - - - - - - - - - ; ; ; ; - - - > > > > - - - ; ; ; ; - - - > > > > - - - ; ; ; ; - - - - #         ",
+"        . . . . . , , , , . . . , , , , . . . . . . . , , , , . . . , , , , . . . . . . , , , , . . . , , , , . . . . #                 . - - - - - + + + + + + + + + - - - ; - - - - ; - ; - - - - > - ; - - - - ; - ; - - - - ; - ; - - - - > - - - #         ",
+"        . . . . , . . . . , . , . . . . , . . . . . , . . . . , . , . . . . , . . . . , . . . . , . , . . . . , . . . #                 . - - - - + $ $ $ $ $ $ $ $ $ % - - ; - - - - ; - ; - - - - > - ; - - - - ; - ; - - - - ; - ; - - - - > - - - #         ",
+"        . . . . , . . . . , . , . . . . , . . . . . , . . . . , . , . . . . , . . . . , . . . . , . , . . . . , . . . #                 . - - - + $ $ $ . . $ . . $ $ $ % - ; - - - - ; - ; - - - - > - ; - - - - ; - ; - - - - ; - ; - - - - > - - - #         ",
+"        . . . . , . . . . , . , . . . . , . . . . . , . . . . , . , . . . . , . . . . , . . . . , . , . . . . , . . . #                 . - - - + $ $ $ $ . $ . $ $ $ $ & - - ; ; ; ; - - - > > > > - - - ; ; ; ; - - - ; ; ; ; - - - ; ; ; ; - - - - #         ",
+"        . . . . . , , , , . . . , , , , . . . . . . . , , , , . . . , , , , . . . . . . , , , , . . . , , , , . . . . #                 . - - - + $ . $ $ $ $ $ $ $ . $ * - ; - - - - > - ; - - - - > - ; - - - - ; - > - - - - ; - > - - - - ; - - - #         ",
+"        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #                 . - - - + $ $ . . . . . . . $ $ * - ; - - - - > - ; - - - - > - ; - - - - ; - > - - - - ; - > - - - - ; - - - #         ",
+"        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #                 . - - - - + $ $ $ $ $ $ $ $ $ % - - ; - - - - > - ; - - - - > - ; - - - - ; - > - - - - ; - > - - - - ; - - - #         ",
+"        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #                 . - - - - - % % % % % % % % % - - - - > > > > - - - ; ; ; ; - - - > > > > - - - ; ; ; ; - - - ; ; ; ; - - - - #         ",
+"        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #                                                                                                                                         ",
+"        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #                                                                                                                                         ",
+"        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #                                                                                                                                         ",
+"        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #                                                                                                                                         ",
+"        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #                                                                                                                                         ",
+"        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #                                                                                                                                         ",
+"        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #                                                                                                                                         ",
+"        # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #                                                                                                                                         "};
diff --git a/wmtictactoe/wmtictactoe/wmtictactoe.c b/wmtictactoe/wmtictactoe/wmtictactoe.c
new file mode 100644
index 0000000..f43d7cd
--- /dev/null
+++ b/wmtictactoe/wmtictactoe/wmtictactoe.c
@@ -0,0 +1,1117 @@
+/*
+   wmtictactoe - the ultimate tictactoe for WindowMaker 
+   =-=-=-=-=-=   ====================================== 
+                  Copyright (C) 1999 André R. Camargo
+
+   Este programa é um software de livre distribuição, que pode ser copiado e 
+   distribuído sob os termos da Licença Pública Geral GNU, conforme publicada 
+   pela Free Software Foundation, versão 2 da licença ou (a critério do autor)
+   qualquer versão posterior. 
+
+   Este programa é distribuído na expectativa de ser útil aos seus usuários, 
+   porém  NÃO TEM NENHUMA GARANTIA, EXPLÍCITAS OU IMPLÍCITAS, COMERCIAIS OU DE
+   ATENDIMENTO A UMA DETERMINADA FINALIDADE. Consulte a Licença Pública Geral
+   GNU para maiores detalhes. 
+
+   Deve haver uma cópia da Licença Pública Geral GNU junto com este software 
+   em inglês ou português. Caso não haja escreva para 
+   Free Software Foundation, Inc.
+   675 Mass Ave,
+   Cambridge, MA 02139, USA. 
+
+   [email protected]
+   André Ribeiro Camargo
+   Rua Silveira Martins, 592/102
+   Centro
+   Canguçu-RS-Brasil
+   CEP 96.600-000
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <time.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <X11/Xlib.h>
+#include <X11/xpm.h>
+#include <X11/extensions/shape.h>
+
+#include "../wmgeneral/wmgeneral.h"
+#include "wmtictactoe-master.xpm"
+
+// ---------------------------------------------------------------
+// definicoes :)
+
+#define WMTICTACTOE_VERSION "1.1"
+
+#define TRUE            1
+#define FALSE           0
+
+#define USLEEP          20000
+#define BLINK           200000
+
+#define LEGENDA_VAZIO   0
+#define LEGENDA_USUARIO 1
+#define LEGENDA_X       2
+
+#define JOGO_OFENSIVO   0
+#define JOGO_DEFENSIVO  1
+
+// ---------------------------------------------------------------
+// Variáveis Globais
+
+char   *ProgName;
+
+typedef struct {
+	int     left;
+	int     top;
+	int     right;
+	int     bottom;
+} regioes;
+
+regioes quadrantes[MAX_MOUSE_REGION] =
+{
+	{5, 8, 20, 18},
+	{24, 8, 40, 18},
+	{43, 8, 57, 18},
+	{5, 20, 20, 30},
+	{24, 20, 40, 30},
+	{43, 20, 57, 30},
+	{5, 33, 20, 44},
+	{24, 33, 40, 44},
+	{43, 33, 57, 44}};
+
+int     tabuleiro[9] =
+{LEGENDA_VAZIO, LEGENDA_VAZIO, LEGENDA_VAZIO,
+ LEGENDA_VAZIO, LEGENDA_VAZIO, LEGENDA_VAZIO,
+ LEGENDA_VAZIO, LEGENDA_VAZIO, LEGENDA_VAZIO};
+
+int     sequencias[8][3] =
+{
+	{0, 1, 2},
+	{3, 4, 5},
+	{6, 7, 8},
+	{0, 3, 6},
+	{1, 4, 7},
+	{2, 5, 8},
+	{0, 4, 8},
+	{2, 4, 6}};
+
+int     livre[9] =
+{0, 1, 2, 3, 4, 5, 6, 7, 8};
+int     livre_max;
+int     game_mode;
+int     mute_mode;
+int     score_user_offensive = 0;
+int     score_X_offensive = 0;
+int     score_deuce_offensive = 0;
+int     score_user_defensive = 0;
+int     score_X_defensive = 0;
+int     score_deuce_defensive = 0;
+int     score_opponent = 0;
+// modo padrao eh jogar contra o micro
+// por isso deadmatch leva um FALSE
+int	isDeadmatch = FALSE;
+int	adversario =  TRUE;
+
+// mascara
+char    wmtictactoe_mask_bits[64 * 64];
+int     wmtictactoe_mask_width = 64;
+int     wmtictactoe_mask_height = 64;
+
+// ----------------------------------------------------------
+// declaracao das funcoes do sistema
+
+void    main (int argc, char *argv[]);
+void    usage (void);
+void    printversion (void);
+void    readfile (void);
+void    writefile (void);
+
+void    desenhaJogador (int);
+void    desenhaX (int);
+void    desenhaAdversario (int);
+void    desenhaLimpa (int);
+void    desenhaAvisoJoga (void);
+void    desenhaAvisoLimpa (void);
+void    desenhaAvisoVoceVenceu (void);
+void    desenhaAvisoEuVenci (void);
+void    desenhaAvisoEmpate (void);
+
+int     mostra_score (void);
+void    escreve_placar (void);
+void    reseta_score (void);
+void    piscaVencedor (void);
+void    troca_game_mode (void);
+
+void    reseta_tabuleiro (void);
+void    livre_desempilha (int);
+
+void    principal (int, char **);
+int     escolheJogador (void);
+
+void    joga (int);
+void    jogaHumano (int);
+
+void    jogaX (void);
+int     tapa_buraco (void);
+int     analisa_jogo (void);
+int     chuta_jogada (void);
+
+int     validaJogada (int);
+void    game_over (void);
+
+// -------------------------------------------------------------------------------------------
+//    funcao: main()
+// descricao: funcao principal da linguagem
+//        in: argc - numero de argumentos passados por linha d comando
+//            argv - vetor com os argumentos
+//       out: nada
+void main (int argc, char *argv[])
+{
+	int     i;
+     
+	ProgName = argv[0];
+	if (strlen (ProgName) >= 11)
+		ProgName += (strlen (ProgName) - 11);
+
+	game_mode = JOGO_DEFENSIVO;
+	mute_mode = FALSE;
+	
+	for (i = 1; i < argc; i++) {
+		char   *arg = argv[i];
+
+		if (*arg == '-') {
+			switch (arg[1]) {
+				case 'o':
+					game_mode = JOGO_OFENSIVO;
+					break;
+				case 'd':
+					printf("%s", arg+1);
+					if (strcmp (arg + 1, "deadmatch") == 0) {
+				  		isDeadmatch = TRUE;
+						break;
+					}
+		  			if (strcmp (arg + 1, "display") == 0) 
+				  		break;
+					usage ();
+					exit (1);
+				case 'v':
+					printversion ();
+					exit (0);
+			        case 'q':
+				        mute_mode = TRUE;
+					break;
+				default:
+					usage ();
+					exit (0);
+			}
+		}
+	}
+
+	if (mute_mode) {
+	        fprintf (stderr, "\nwmTicTacToe %s - Copyright © 1999 André Ribeiro Camargo\n\n", WMTICTACTOE_VERSION);
+		fprintf (stderr, "Este software NÃO POSSUI NENHUMA GARANTIA; Este é um ");
+		fprintf (stderr, "software de livre \ndistribuição e você está autorizado a distribui-lo dentro de certas\n");
+		fprintf (stderr, "condições. Verifique a documentação do sistema para maiores detalhes.\n");
+		fprintf (stderr, "\n\n\"Thank you for shopping at Pop Mart\"-U2\n");
+
+		fprintf (stderr, "\nPlaying on %s mode... %s", isDeadmatch ? "deadmatch" : (game_mode == JOGO_DEFENSIVO) ? "DEFENSIVE" : "OFFENSIVE", isDeadmatch ? ":) <-> (:" : (game_mode == JOGO_DEFENSIVO) ? ":(" : ":)");
+	}
+	
+	principal (argc, argv);
+}
+
+// -------------------------------------------------------------------------------------------
+//    funcao: desenhaAdversario(int quadrante)
+// descricao: desenha a jogada feita pelo adversario no tabuleiro
+//        in: quadrante - quadrante do tabuleiro
+//       out: nada
+void
+desenhaAdversario (int quadrante)
+{
+	tabuleiro[quadrante] = LEGENDA_X;
+	copyXPMArea(97, 74, 13, 8, quadrantes[quadrante].left + 1, quadrantes[quadrante].top + 1);
+}
+
+// -------------------------------------------------------------------------------------------
+//    funcao: desenhaJogador(int quadrante)
+// descricao: desenha o jogador no tabuleiro
+//        in: quadrante - quadrante do tabuleiro
+//       out: nada
+void
+desenhaJogador (int quadrante)
+{
+	tabuleiro[quadrante] = LEGENDA_USUARIO;
+	copyXPMArea (68, 4, 13, 8, quadrantes[quadrante].left + 1, quadrantes[quadrante].top + 1);
+}
+
+// --------------------------------------------------------------------------------------------
+//    funcao: desenhaX(int quadrante)
+// descricao: desenha o X no tabuleiro
+//        in: quadrante - quadrante do tabuleiro
+//       out: nada
+void
+desenhaX (int quadrante)
+{
+	if (isDeadmatch)
+	  desenhaAdversario(quadrante);
+	else
+	        if (game_mode == JOGO_DEFENSIVO)
+  		        copyXPMArea (96, 4, 13, 8, quadrantes[quadrante].left + 1, quadrantes[quadrante].top + 1);
+		else
+		        copyXPMArea (110, 4, 13, 8, quadrantes[quadrante].left + 1, quadrantes[quadrante].top + 1);
+}
+
+// --------------------------------------------------------------------------------------------
+//    funcao: desenhaLimpa(int quadrante)
+// descricao: apaga o jogador que estiver no quadrante especificando
+//        in: quadrante - quadrante do tabuleiro
+//       out: nada
+void
+desenhaLimpa (int quadrante)
+{
+	copyXPMArea (82, 4, 13, 8, quadrantes[quadrante].left + 1, quadrantes[quadrante].top + 1);
+}
+
+// ---------------------------------------------------------------------------------------------
+//    funcao: desenhaAvisoJoga
+// descricao: desenha "play" na tela
+//        in: nada
+//       out: nada
+void
+desenhaAvisoJoga (void)
+{
+	if (isDeadmatch && adversario) {
+		copyXPMArea(68, 103, 60, 9, 4, 47);
+		copyXPMArea(71, 93, 16, 8, 5, 47);
+		return;
+	}
+	if (isDeadmatch && !adversario) {
+		copyXPMArea(68, 103, 60, 9, 4, 47);
+		return;
+
+	}
+	copyXPMArea (68, 13, 60, 9, 4, 47);
+}
+
+// ----------------------------------------------------------------------------------------------
+//    funcao: desenhaAvisoVoceVenceu
+// descricao: desenha "you win" na tela
+//        in: nada
+//       out: nada
+void
+desenhaAvisoVoceVenceu (void)
+{
+	if (isDeadmatch)
+		copyXPMArea (68, 83, 60, 9, 4, 47);
+	else
+		copyXPMArea (68, 23, 60, 9, 4, 47);
+}
+
+// -----------------------------------------------------------------------------------------------
+//    funcao: desenhaAvisoEuVenci
+// descricao: desenha "I win" na tela
+//        in: nada
+//       out: nada
+void
+desenhaAvisoEuVenci (void)
+{
+	if (isDeadmatch)
+		copyXPMArea (68, 93, 60, 9, 4, 47);
+	else
+		copyXPMArea (68, 33, 60, 9, 4, 47);
+}
+
+// -----------------------------------------------------------------------------------------------
+//    funcao: desenhaAvisoEmpate
+// descricao: desenha "deuce" na tela
+//        in: nada
+//       out: nada
+void
+desenhaAvisoEmpate (void)
+{
+	copyXPMArea (68, 43, 60, 9, 4, 47);
+}
+
+// -----------------------------------------------------------------------------------------------
+//    funcao: desenhaAvisoLimpa
+// descricao: "apaga" os displays da tela
+//        in: nada
+//       out: nada
+void
+desenhaAvisoLimpa (void)
+{
+	copyXPMArea (68, 53, 60, 9, 4, 47);
+}
+
+// ------------------------------------------------------------------------------------------------
+//    funcao: validaJogada
+// descricao: Verifica se o quadrante jah nao estah ocupado
+//        in: quadrante
+//       out: 0 - quadrante ocupado
+//            1 - quadrante disponivel, jogada valida!
+int
+validaJogada (int quadrante)
+{
+	return ((quadrante > -1) ? tabuleiro[quadrante] == 0 : 0);
+}
+
+// ------------------------------------------------------------------------------------------------
+//    funcao: reseta_tabuleiro
+// descricao: reseta o jogo
+//        in: nada
+//       out: nada
+void
+reseta_tabuleiro (void)
+{
+	int     i;
+
+	for (i = 0; i < 9; i++) {
+		tabuleiro[i] = LEGENDA_VAZIO;
+		desenhaLimpa (i);
+		livre[i] = i;
+	}
+	livre_max = i;
+
+	desenhaAvisoJoga ();
+}
+
+// ------------------------------------------------------------------------------------------------
+//    funcao: escolheJogador
+// descricao: escolhe qual dos jogadores iniciarah a partida
+//        in: nada
+//       out: 0 - comeca pelo X
+//            1 - comeca pelo Usuario
+int
+escolheJogador (void)
+{
+	srand ((int) time (NULL));
+	adversario = ((int) ((float) random () / (float) RAND_MAX * 2));
+	return adversario;
+}
+
+// ------------------------------------------------------------------------------------------------
+//    funcao: verificaSequencia
+// descricao: verifica se foi fechada alguma sequencia
+//        in: nada
+//       out: -2 - todos os quadrantes preenchido e nenhuma sequencia fechada, ou seja, empate!
+//            -1 - nao foi encontrado sequencia fechada
+//            > -1 - numero da sequencia fechada
+int
+verificaSequencia ()
+{
+	/*
+	   matriz d jogadas contem o numero da posicao
+
+ 	    0 | 1 | 2
+	   ---+---+---
+	    3 | 4 | 5
+	   ---+---+---
+	    6 | 7 | 8
+	 */
+
+	int     sucesso = 0;
+	int     padrao;
+	int     i;
+
+	for (i = 0; i < 8; i++) {
+		padrao = tabuleiro[sequencias[i][0]];
+		if (padrao == LEGENDA_VAZIO)
+			continue;
+		sucesso = ((tabuleiro[sequencias[i][1]] == padrao) &&
+			   (tabuleiro[sequencias[i][2]] == padrao));
+		if (sucesso)
+			break;
+	}
+
+	// verifica se ha algum quadrante para se jogar
+	if (!sucesso && !livre_max)
+		return (-2);
+
+	return ((sucesso) ? i : -1);
+}
+
+// ------------------------------------------------------------------------------------
+//    funcao: game_over
+// descricao: caso o jogo tenha acabado, pisca vencedor
+//        in: nada
+//       out: nada
+void
+game_over ()
+{
+	if (verificaSequencia () != -1)
+		piscaVencedor ();
+}
+
+// -------------------------------------------------------------------------------------
+//    funcao: piscaVencedor
+// descricao: pisca as jogadas da sequencia especifica vencedora 
+//        in: nada
+//       out: nada
+void
+piscaVencedor ()
+{
+	int     mostra = 0;
+	int     i;
+	int     seq = verificaSequencia ();
+	int     jogador = tabuleiro[sequencias[seq][0]];
+	XEvent  Event;
+
+	// incrementa o score do vencedor
+	if (seq == -2) {
+                if (game_mode == JOGO_OFENSIVO)
+		        (score_deuce_offensive > 98) ? score_deuce_offensive = 1 : score_deuce_offensive++;
+                else
+	                (score_deuce_defensive > 98) ? score_deuce_defensive = 1 : score_deuce_defensive++;
+	} else
+                if (jogador == LEGENDA_X) {
+                        if (game_mode == JOGO_OFENSIVO)
+		                (score_X_offensive > 98) ? score_X_offensive = 1 : score_X_offensive++;
+                        else
+                                (score_X_defensive > 98) ? score_X_defensive = 1 : score_X_defensive++;
+	        } else {
+                        if (game_mode == JOGO_OFENSIVO)
+                                (score_user_offensive > 98) ? score_user_offensive = 1 : score_user_offensive++;
+                        else
+                                (score_user_defensive > 98) ? score_user_defensive = 1 : score_user_defensive++;
+		}
+
+	if (!isDeadmatch)
+		writefile ();
+
+	while (1) {
+		RedrawWindow ();
+
+		usleep (BLINK);
+		while (XPending (display)) {
+			XNextEvent (display, &Event);
+			switch (Event.type) {
+				case Expose:
+					RedrawWindow ();
+					break;
+				case DestroyNotify:
+					XCloseDisplay (display);
+					exit (0);
+					break;
+				case ButtonRelease:
+					switch (Event.xbutton.button) {
+					        case 3:
+						        if (mostra_score ())
+                                                                return;
+							break;
+                                                default:
+                                                        reseta_tabuleiro ();
+                                                        return;
+					}
+			}
+
+		}
+		if (mostra) {
+			if (seq == -2)
+				desenhaAvisoEmpate ();
+			else {
+				if (jogador == LEGENDA_USUARIO)
+					desenhaAvisoVoceVenceu ();
+				else
+					desenhaAvisoEuVenci ();
+				for (i = 0; i < 3; i++)
+					if (jogador == LEGENDA_USUARIO)
+						desenhaJogador (sequencias[seq][i]);
+					else
+						desenhaX (sequencias[seq][i]);
+			}
+		} else {
+			desenhaAvisoLimpa ();
+			if (seq != -2)
+				for (i = 0; i < 3; i++)
+					desenhaLimpa (sequencias[seq][i]);
+		}
+		mostra = !mostra;
+	}
+}
+
+// -------------------------------------------------------------------------------------
+//    funcao: escreve_placar
+// descricao: escreve o placar do jogo na tela de score
+//        in: nada
+//       out: nada
+void
+escreve_placar ()
+{
+        int i;
+        int coluna_xpm = 65;
+	int coluna_score[6] = 
+	{8, 15, 26, 33, 43, 50 };
+        char placar[6];
+
+  	if (isDeadmatch){
+    		copyXPMArea(97, 74, 13, 9, 43, 88);
+		if (!mute_mode)
+		  sprintf(placar, 
+			  "%.2d%.2d%.2d", 
+			  game_mode == JOGO_OFENSIVO ? score_user_offensive : score_user_defensive, 
+			  game_mode == JOGO_OFENSIVO ? score_deuce_offensive : score_deuce_defensive,
+			  game_mode == JOGO_OFENSIVO ? score_X_offensive : score_X_defensive);
+	}
+	else
+	// desenha o glyph do X modo ofensivo no placar 
+		if (game_mode == JOGO_OFENSIVO) {
+		        copyXPMArea (110, 4, 13, 8, 43, 88);
+                	if (!mute_mode)
+		        	sprintf(placar, "%.2d%.2d%.2d", score_user_offensive, score_deuce_offensive, score_X_offensive);
+	        } else {
+        	        copyXPMArea (96, 4, 13, 8, 43, 88);
+			if (!mute_mode)
+	                	sprintf(placar, "%.2d%.2d%.2d", score_user_defensive, score_deuce_defensive, score_X_defensive);
+		}
+	
+	for (i = 0; i < 6; i++)
+       		copyXPMArea (coluna_xpm+((placar[i]-48)*6), 65, 6, 9, coluna_score[i], 100);
+}
+
+// -------------------------------------------------------------------------------------
+//    funcao: reseta_score
+// descricao: zera o placar do jogo
+//        in: nada
+//       out: nada
+void
+reseta_score ()
+{
+        score_X_offensive = 0;
+	score_user_offensive = 0;
+	score_deuce_offensive = 0;
+	score_X_defensive = 0;
+        score_user_defensive = 0;
+        score_deuce_defensive = 0;
+	score_opponent = 0;
+
+	writefile ();
+
+	escreve_placar ();
+}
+
+// -------------------------------------------------------------------------------------
+//    funcao: mostra_score
+// descricao: mostra o placar e aguarda o usuario pressionar qq botao
+//            para voltar ao jogo
+//        in: nada
+//       out: 0: se o modo d jogo continua o mesmo
+//            1: se o modo d jogo foi alterado
+int
+mostra_score ()
+{
+	XEvent  Event;
+        int     game_mode_changed = 0;
+
+        escreve_placar ();
+	while (1) {
+                RedrawWindowXY (0, 60);
+
+		while (XPending (display)) {
+			XNextEvent (display, &Event);
+			switch (Event.type) {
+				case Expose:
+					RedrawWindow ();
+					break;
+				case DestroyNotify:
+					XCloseDisplay (display);
+					exit (0);
+					break;
+				case ButtonRelease:
+				        if (Event.xbutton.button == 1 &&
+					    !isDeadmatch) {
+                                                troca_game_mode ();
+                                                game_mode_changed = 1;
+                                                escreve_placar ();
+				        } else
+                                                if (Event.xbutton.button == 2)
+					                reseta_score ();
+					        else
+					                return (game_mode_changed);
+			}
+
+		}
+		usleep (USLEEP);
+	}
+}
+
+// ----------------------------------------------------------------------------------
+//    funcao: principal
+// descricao: funcao principal do jogo
+//        in: argc - numero de argumentos passados por main()
+//            argv - matriz de strings com os argumentos passador por main()
+//       out: nada
+void
+principal (int argc, char **argv)
+{
+	int     i;
+	XEvent  Event;
+
+	createXBMfromXPM (wmtictactoe_mask_bits, wmtictactoe_master_xpm, wmtictactoe_mask_width, wmtictactoe_mask_height);
+	openXwindow (argc, argv, wmtictactoe_master_xpm, wmtictactoe_mask_bits, wmtictactoe_mask_width, wmtictactoe_mask_height);
+
+	for (i = 0; i < MAX_MOUSE_REGION; i++)
+		AddMouseRegion (i, quadrantes[i].left, quadrantes[i].top, quadrantes[i].right, quadrantes[i].bottom);
+
+	reseta_tabuleiro ();
+
+	if (!isDeadmatch)
+		readfile ();
+	mostra_score ();
+
+	if (!isDeadmatch && escolheJogador ())
+		jogaX ();
+
+	desenhaAvisoJoga ();
+
+	while (1) {
+	        RedrawWindow ();
+
+		while (XPending (display)) {
+			XNextEvent (display, &Event);
+			switch (Event.type) {
+				case Expose:
+					RedrawWindow ();
+					break;
+				case DestroyNotify:
+					XCloseDisplay (display);
+					exit (0);
+					break;
+				case ButtonRelease:
+					i = CheckMouseRegion (Event.xbutton.x, Event.xbutton.y);
+					switch (Event.xbutton.button) {
+						case 1:
+							if (validaJogada (i)) {
+								jogaHumano (i);
+								if (isDeadmatch)
+									desenhaAvisoJoga ();
+								else
+									jogaX ();
+							}
+							break;
+						case 2:
+							reseta_tabuleiro ();
+							break;
+					        case 3:
+						        mostra_score ();
+					}
+			}
+
+		}
+		usleep (USLEEP);
+	}
+
+}
+
+// ------------------------------------------------------------------------------
+//    funcao: livre_desempilha
+// descricao: esta rotina retira o quadrante "quad" da matriz de posicoes vazias
+//        in: quadrante
+//       out: nada
+void
+livre_desempilha (int quad)
+{
+	int     i = 0;
+
+	// localiza quadrante no vetor de quadrantes livres
+	while (livre[i] < quad)
+		i++;
+
+	// desempilha
+	while (i < livre_max) {
+		livre[i] = livre[i + 1];
+		i++;
+	}
+
+	// seta o ultimo elemento como -1
+	// *assim fica + facil debugar :) *
+	livre[--livre_max] = -1;
+}
+
+// ------------------------------------------------------------------------------
+//    funcao: tapa_buraco
+// descricao: verifica se o usuario nao estah por fechar alguma sequencia,
+//            retornando o quadrante onde o X deverah jogar para anular a jogada
+//        in: nada
+//       out: -1 - nao ha buraco
+//            > -1 - quadrante que tapa
+int
+tapa_buraco (void)
+{
+	int     sucesso = 0;
+	int     desocupado, seta;
+	int     i, i2;
+
+	for (i = 0; i < 8; i++) {
+		sucesso = 0;
+		desocupado = 0;
+		seta = 0;
+		for (i2 = 0; i2 < 3; i2++) {
+			if (tabuleiro[sequencias[i][i2]] == LEGENDA_USUARIO)
+				sucesso++;
+			if (tabuleiro[sequencias[i][i2]] == LEGENDA_VAZIO) {
+				desocupado = sequencias[i][i2];
+				seta = 1;
+			}
+		}
+		if ((sucesso == 2) && seta)
+			return (desocupado);
+	}
+	return (-1);
+}
+
+// ------------------------------------------------------------------------------
+//    funcao: tenta_fechar
+// descricao: verifica se nao existe alguma sequencia do jogador X por fechar
+//        in: nada
+//       out: -1 - nao ha sequencia
+//            > -1 - quadrante que fecha
+int
+tenta_fechar (void)
+{
+	int     sucesso;
+	int     desocupado, seta;
+	int     i, i2;
+
+	for (i = 0; i < 8; i++) {
+		sucesso = 0;
+		desocupado = 0;
+		seta = 0;
+		for (i2 = 0; i2 < 3; i2++) {
+			if (tabuleiro[sequencias[i][i2]] == LEGENDA_X)
+				sucesso++;
+			if (tabuleiro[sequencias[i][i2]] == LEGENDA_VAZIO) {
+				desocupado = sequencias[i][i2];
+				seta = 1;
+			}
+		}
+		if ((sucesso == 2) && seta)
+			return (desocupado);
+	}
+	return (-1);
+}
+
+// ------------------------------------------------------------------------------
+//    funcao: chuta_jogada
+// descricao: como ultima opcao de jogada para X, chuta um quadrante qualquer
+//        in: nada
+//       out: quadrante livre
+int
+chuta_jogada (void)
+{
+	srand ((int) time (NULL));
+	return (livre[(int) ((float) random () / (float) RAND_MAX * livre_max)]);
+}
+
+// ------------------------------------------------------------------------------
+//    funcao: analisa_jogo
+// descricao: analisa a melhor jogada, verificando as chances de cada jogador
+//        in: nada
+//       out: -1 - nao ha sequencia
+//            > -1 - quadrante para tentar criar sequencia
+int
+analisa_jogo (void)
+{
+        int     jogadas_usuario;
+        int     jogadas_X;
+        int     i, i2, maior_chance_X, maior_chance_usuario;
+        int     status_jogo[8][2]; // numero de jogadas em cada sequencia
+        int     chance[9][2];
+        int     possibilidades_de_jogadas[9];
+        int     limite_possibilidades;
+
+        // contabiliza o numero de jogadas do usuario e do X
+        for (i = 0; i < 8; i++) {
+                jogadas_usuario = 0;
+                jogadas_X = 0;
+                for (i2 = 0; i2 < 3; i2++) {
+                        if (tabuleiro[sequencias[i][i2]] == LEGENDA_USUARIO)
+                                jogadas_usuario++;
+                        if (tabuleiro[sequencias[i][i2]] == LEGENDA_X)
+                                jogadas_X++;
+                }
+                status_jogo[i][0] = jogadas_X;
+                status_jogo[i][1] = jogadas_usuario;
+        }
+
+        // zera a matriz... *preguiça*
+        for (i = 0; i < 9; i++) {
+                chance[i][0] = 0;
+                chance[i][1] = 0;
+        }
+
+        // estima a chance de jogo em cada _quadrante_ para cada jogador
+        for (i = 0; i < 8; i++) 
+                for (i2 = 0; i2 < 3; i2++) {    
+                        if (tabuleiro[sequencias[i][i2]] == LEGENDA_VAZIO && status_jogo[i][0] > 0 && status_jogo[i][1] == 0)
+                                chance[sequencias[i][i2]][0]++;
+                        if (tabuleiro[sequencias[i][i2]] == LEGENDA_VAZIO && status_jogo[i][1] > 0 && status_jogo[i][0] == 0)
+                                chance[sequencias[i][i2]][1]++;
+                }
+
+        // rotina p'ra verificar se existe alguma chance
+        // se nao houver, cai fora...
+        for (i = 0; i < 8 && (((chance[i][0] == chance[i][1]) == chance[i][0]) == 0); i++);
+        if (i == 8)
+                return(-1);
+
+        // seleciona _quadrante_ com maior probabilidade d jogo
+        // aqui a porca torce o rabo... :DDDD
+        limite_possibilidades = 0;
+        maior_chance_X = -1;
+        maior_chance_usuario = -1;
+        for (i = 0; i < 9; i++) {
+                if ( game_mode == JOGO_DEFENSIVO ? chance[i][1] > maior_chance_usuario : chance[i][0] > maior_chance_X) {
+                        limite_possibilidades = 0;
+                        possibilidades_de_jogadas[limite_possibilidades] = i;
+                        maior_chance_X = chance[i][0];
+                        maior_chance_usuario = chance[i][1];
+                } else {
+                        if ( game_mode == JOGO_DEFENSIVO ? chance[i][1] == maior_chance_usuario : chance[i][0] == maior_chance_X) {
+                                if ( game_mode == JOGO_DEFENSIVO ? chance[i][0] > maior_chance_X : chance[i][1] > maior_chance_usuario) {
+                                        limite_possibilidades = 0;
+                                        possibilidades_de_jogadas[limite_possibilidades] = i;
+                                        if (game_mode == JOGO_DEFENSIVO) 
+					        maior_chance_X = chance[i][0];
+					else
+					        maior_chance_usuario = chance[i][1];
+                                } else if ( game_mode == JOGO_DEFENSIVO ? chance[i][0] == maior_chance_X : chance[i][1] == maior_chance_usuario) {
+                                        limite_possibilidades++;
+                                        possibilidades_de_jogadas[limite_possibilidades] = i; 
+                                }
+                        }
+                }
+        }
+
+        // seleciona a jogadas que estao em "limite_possibilidades"
+        i = (float) random () / (float) RAND_MAX * (limite_possibilidades+1);
+
+        return(possibilidades_de_jogadas[i]);
+}
+
+// ------------------------------------------------------------------------------
+//    funcao: tenta_matar_jogada
+// descricao: procura matar uma sequencia que o usuario planeja fazer
+//        in: nada
+//       out: -1 - nao ha sequencia
+//            > -1 - quadrante para tentar criar sequen`cia
+int
+tenta_matar_jogada (void)
+{
+	int     sucesso;
+	int     jogadasX;
+	int     i, i2, maior_chance, opcao_escolhida, nr_opcoes;
+	int     p = -1;
+	int     provavel_jogada[8][2];
+	int     chance[9] =
+	{0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+	// procura por jogadas em aberto,
+	// contabilizando o numero de quadrantes jah ocupados das sequencias
+	for (i = 0; i < 8; i++) {
+		sucesso = 0;
+		jogadasX = 0;
+		for (i2 = 0; i2 < 3; i2++) {
+			if (tabuleiro[sequencias[i][i2]] == LEGENDA_USUARIO)
+				sucesso++;
+			if (tabuleiro[sequencias[i][i2]] == LEGENDA_X)
+				jogadasX++;
+		}
+		if (jogadasX == 0) {
+			p++;
+			provavel_jogada[p][0] = i;
+			provavel_jogada[p][1] = sucesso;
+		}
+	}
+
+	// procura jogar nas sequencias q jah tem casa preenchida
+	if (p >= 0) {
+		for (i = 0; i <= p; i++)
+			if (provavel_jogada[i][1] >= 0)
+				for (i2 = 0; i2 < 3; i2++)
+					if (tabuleiro[sequencias[provavel_jogada[i][0]][i2]] == LEGENDA_VAZIO)
+						chance[sequencias[provavel_jogada[i][0]][i2]]++;
+		maior_chance = chance[0];
+		nr_opcoes = 1;
+		for (i = 1; i <= 8; i++) {
+			if (maior_chance < chance[i]) {
+				nr_opcoes = 1;
+				maior_chance = chance[i];
+			} else {
+				if (maior_chance == chance[i]) {
+					nr_opcoes++;
+				}
+			}
+		}
+
+		opcao_escolhida = (float) random () / (float) RAND_MAX *(nr_opcoes);
+
+		i2 = 0;
+		for (i = 0; i <= 8; i++) {
+			if ((maior_chance == chance[i]) && (maior_chance >= 1)) {
+				if (i2 == opcao_escolhida)
+					return (i);
+				i2++;
+			}
+		}
+	}
+	// se nao tiver jeito, passa adiante... :)
+	return (-1);
+}
+
+
+// ------------------------------------------------------------------------------
+//    funcao: jogaX
+// descricao: cerebro do jogador X, nesta rotina que ele escolhe onde jogara
+//        in: nada
+//       out: nada
+void
+jogaX (void)
+{
+	int     q;
+
+	q = tenta_fechar ();
+	if (q == -1)
+	       	q = tapa_buraco ();
+	if (q == -1)
+	        q = analisa_jogo ();
+	if (q == -1)
+	        q = chuta_jogada();
+
+	livre_desempilha (q);
+
+	tabuleiro[q] = LEGENDA_X;
+
+	desenhaX (q);
+
+	game_over ();
+}
+
+// ------------------------------------------------------------------------------
+//    funcao: jogaHumano
+// descricao: rotina de verificacao da jogada do usuario
+//        in: quadrante clicado pelo usuario
+//       out: game over?
+void
+jogaHumano (int quadrante)
+{
+	if (adversario && isDeadmatch)
+		desenhaAdversario (quadrante);
+        else
+		desenhaJogador (quadrante);
+	adversario = !adversario;
+	livre_desempilha (quadrante);
+	game_over ();
+}
+
+// ------------------------------------------------------------------------------
+//    funcao: usage
+// descricao: help da aplicacao
+//        in: nada
+//       out: nada
+void
+usage (void)
+{
+	fprintf (stderr, "\nwmTicTacToe %s - The Ultimate TicTacToe for WindowMaker... :) \n", WMTICTACTOE_VERSION);
+	fprintf (stderr, "Copyright © 1999 André Ribeiro Camargo\n\n");
+	fprintf (stderr, "usage:\n");
+	fprintf (stderr, "\t-display <display name>\n");
+	fprintf (stderr, "\t-deadmatch\n");
+	fprintf (stderr, "\t-h\tthis screen\n");
+	fprintf (stderr, "\t-v\tprint the version number\n");
+	fprintf (stderr, "\t-o\tofensive mode\n");
+	fprintf (stderr, "\t-q\tquiet mode(for Debian's user)\n");
+	fprintf (stderr, "\t\tdefault: defensive mode\n");
+	fprintf (stderr, "\n");
+}
+
+// ------------------------------------------------------------------------------
+//    funcao: printversion
+// descricao: imprime a versao da aplicacao
+//        in: nada
+//       out: nada
+void
+printversion (void)
+{
+	if (!strcmp (ProgName, "wmtictactoe"))
+		fprintf (stderr, "%s\n", WMTICTACTOE_VERSION);
+}
+
+// ------------------------------------------------------------------------------
+//    funcao: readfile
+// descricao: lê o arquivo de configuracao da aplicação
+//        in: nada
+//       out: nada
+void 
+readfile (void)
+{
+        FILE *rcfile;
+	char rcfilen[256];
+	char buf[256];
+	int done;
+
+	sprintf(rcfilen, "%s/.wmtictactoe", getenv("HOME"));
+
+	if ((rcfile=fopen(rcfilen, "r")) != NULL){
+	        do {
+		        fgets(buf, 250, rcfile);
+			if((done = feof(rcfile)) == 0){
+			        buf[strlen(buf)-1]=0;
+				if(strncmp(buf, "score_user_offensive ", strlen("score_user "))==0)
+				        sscanf(buf, "score_user_offensive %i", &score_user_offensive);
+				if(strncmp(buf, "score_X_offensive ", strlen("score_X "))==0)
+				        sscanf(buf, "score_X_offensive %i", &score_X_offensive);
+				if(strncmp(buf, "score_deuce_offensive ", strlen("score_deuce "))==0)
+				        sscanf(buf, "score_deuce_offensive %i", &score_deuce_offensive);
+
+				if(strncmp(buf, "score_user_defensive ", strlen("score_user "))==0)
+				        sscanf(buf, "score_user_defensive %i", &score_user_defensive);
+				if(strncmp(buf, "score_X_defensive ", strlen("score_X "))==0)
+				        sscanf(buf, "score_X_defensive %i", &score_X_defensive);
+				if(strncmp(buf, "score_deuce_defensive ", strlen("score_deuce "))==0)
+				        sscanf(buf, "score_deuce_defensive %i", &score_deuce_defensive);
+			}
+		 } while(done == 0);
+		 fclose(rcfile);
+	}
+}
+
+// ------------------------------------------------------------------------------
+//    funcao: writefile
+// descricao: grava o arquivo de configuracao da aplicação
+//        in: nada
+//       out: nada
+void 
+writefile (void)
+{
+        FILE *rcfile;
+	char rcfilen[256];
+
+	sprintf(rcfilen, "%s/.wmtictactoe", getenv("HOME"));
+
+	if ((rcfile=fopen(rcfilen, "w")) != NULL){
+                fprintf(rcfile, "score_user_offensive %d\nscore_deuce_offensive %d\nscore_X_offensive %d\n", score_user_offensive, score_deuce_offensive, score_X_offensive);
+                fprintf(rcfile, "score_user_defensive %d\nscore_deuce_defensive %d\nscore_X_defensive %d\n", score_user_defensive, score_deuce_defensive, score_X_defensive);
+		fclose(rcfile);
+	}
+}
+
+// ------------------------------------------------------------------------------
+//    funcao: troca_game_mode
+// descricao: troca o modo de jogo
+//        in: nada
+//       out: nada
+void 
+troca_game_mode (void)
+{
+        game_mode = !game_mode;
+
+	if (!mute_mode)
+	        fprintf (stderr, "\nPlaying on %s mode... %s", (game_mode == JOGO_DEFENSIVO) ? "DEFENSIVE" : "OFFENSIVE", (game_mode == JOGO_DEFENSIVO) ? ":(" : ":)");
+
+        reseta_tabuleiro ();
+}
+
+
-- 
2.7.4


-- 
To unsubscribe, send mail to [email protected].
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.