Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 gtkboard (0.11pre0+cvs.2003.11.02-10) unstable; urgency=medium
 .
   [ Ondřej Nový ]
   * d/watch: Use https protocol
 .
   [ Takahide Nojima ]
   * Fix stack overflow in engine.c. (closes: #948527)
     It has 2 overflows.
       -The 'linebuf' have 4096 bytes,but '\0' puts in 4097th.
       -The last argument of g_io_channel_read should be
        'unsigned long' not 'int'.
 .
   [ Barak A. Pearlmutter ]
   * Bump debhelper from old 11 to 12.
   * Set debhelper-compat version in Build-Depends.
   * Bump policy
Author: Barak A. Pearlmutter <bap@debian.org>
Bug-Debian: https://bugs.debian.org/948527

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: 2020-01-13

--- /dev/null
+++ gtkboard-0.11pre0+cvs.2003.11.02/configure.ac
@@ -0,0 +1,121 @@
+AC_PREREQ([2.67])
+AC_INIT([gtkboard],[0.11pre0])
+AC_CONFIG_SRCDIR([src/])
+AC_CONFIG_HEADERS([config.h])
+
+AC_CANONICAL_HOST
+AC_CANONICAL_TARGET
+
+AM_INIT_AUTOMAKE(gtkboard,0.11pre0)
+
+# Checks for programs.
+AC_PROG_CC
+
+# Checks for libraries.
+AC_ARG_ENABLE(gtk2,
+		[  --disable-gtk2      Don't look for GTK2 libraries],
+		enable_gtk2=$enableval,
+		enable_gtk2="yes")
+
+found_gtk2=0;
+
+if test "$enable_gtk2" = "yes" ; then
+	dnl check if user has gtk2
+	PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.0.0, found_gtk2=1, found_gtk2=0)
+fi
+
+
+AC_ARG_ENABLE(sdl,
+        [  --disable-sdl      Don't look for the SDL library],
+        enable_sdl=$enableval,
+        enable_sdl="yes")
+
+if test "$enable_sdl" = "yes" ; then
+	dnl Check for SDL
+#	SDL_VERSION=1.2.0
+#	AM_PATH_SDL($SDL_VERSION,
+#			AC_DEFINE([HAVE_SDL], [], [Do we have the SDL library]), 
+#			AC_MSG_WARN([*** SDL version $SDL_VERSION not found. Sound will be disabled])
+#	)
+	AC_CHECK_LIB( SDL_mixer, Mix_OpenAudio, 
+		have_SDL_mixer=yes, have_SDL_mixer=no)
+
+	if test "$have_SDL_mixer" = "yes" ; then 
+#		CFLAGS="$CFLAGS -DHAVE_SDL" 
+		AC_DEFINE([HAVE_SDL], [], [Do we have the SDL library])
+	    LIBS="$LIBS -lSDL_mixer -lSDL"
+	else
+	    echo "*** SDL_mixer not found.  Configuring without audio support."
+	fi
+
+	
+#	CFLAGS="$CFLAGS $SDL_CFLAGS"
+#	LIBS="$LIBS $SDL_LIBS -lSDL_mixer"
+fi
+
+AC_CHECK_LIB([gmodule-2.0], [g_module_symbol], [LIBS="$LIBS -lgmodule-2.0"], AC_MSG_WARN([Cannot find gmodule-2.0 library]))
+
+AC_CHECK_LIB([m], [sincosf], [LIBS="$LIBS -lm"], AC_MSG_WARN([Cannot find math library]))
+
+gnome=false
+
+GNOME_CFLAGS=""
+GNOME_LIBS=""
+
+AC_ARG_ENABLE(gnome,[  --enable-gnome    Turn on gnome ],[
+	if test "x$enableval" = "xyes"; then
+		gnome=true
+	fi
+])
+
+if test "$gnome" = true ; then
+	PKG_CHECK_MODULES(GNOME, [
+			libgnome-2.0 >= 2.0.0
+			libgnomeui-2.0 >= 2.0.0
+	])
+	GNOME_CFLAGS="$GNOME_CFLAGS -DHAVE_GNOME=1"
+fi
+
+AC_SUBST(GNOME_CFLAGS)
+AC_SUBST(GNOME_LIBS)
+	
+AM_CONDITIONAL(WITH_GNOME, test "x$gnome" = "xtrue")
+
+dnl Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS([stdlib.h string.h unistd.h])
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_HEADER_STDBOOL
+
+dnl Checks for library functions.
+AC_FUNC_FORK
+AC_FUNC_MALLOC
+AC_CHECK_FUNCS([getcwd memset mkdir sqrt strcasecmp strncasecmp strpbrk strstr strtol])
+
+AC_CONFIG_FILES([Makefile
+                 doc/Makefile
+                 pixmaps/Makefile
+                 sounds/Makefile
+                 src/Makefile])
+AC_OUTPUT
+
+echo " "
+
+if test "$enable_gtk2" = "yes" ; then
+	AC_MSG_RESULT([    GTK2 enabled.])
+else
+	AC_MSG_RESULT([    GTK2 disabled.])
+fi
+
+if test "$enable_sdl" = "yes" ; then
+	AC_MSG_RESULT([     SDL enabled.])
+else
+	AC_MSG_RESULT([     SDL disabled.])
+fi
+if test "$enable_gnome" = "yes" ; then
+	AC_MSG_RESULT([   GNOME enabled.])
+else
+	AC_MSG_RESULT([   GNOME disabled.])
+fi
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/Makefile.am
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/Makefile.am
@@ -53,6 +53,7 @@ gtkboard_SOURCES = 	\
 	quarto.c\
 	rgb.c\
 	samegame.c\
+	simple.c\
 	stopgate.c\
 	tetris.c\
 	towers.c\
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/aaball.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/aaball.c
@@ -297,3 +297,6 @@ char ** pixmap_die_gen(int len, char *pi
 	return map;
 }
 
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/ab.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/ab.c
@@ -88,7 +88,7 @@ float ab_with_tt (Pos *pos, int player,
 	// origmove is the owning pointer and move is the aliasing pointer
 	else orig_move = move = movdup (move);
 	
-	newpos.board = (char *) malloc (board_wid * board_heit);
+	newpos.board = malloc (board_wid * board_heit);
 	assert (newpos.board);
 	if (game_stateful)
 	{
@@ -367,3 +367,7 @@ byte * ab_dfid (Pos *pos, int player)
 	}
 	return found ? best_move : NULL;
 }
+
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/antichess.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/antichess.c
@@ -731,3 +731,7 @@ ResultType antichess_eval_incr (Pos *pos
 	}
 	return RESULT_NOTYET;
 }
+
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/ataxx.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/ataxx.c
@@ -401,3 +401,6 @@ unsigned char * ataxx_get_rgbmap (int id
 	return rgbbuf;
 }
 
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/blet.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/blet.c
@@ -152,3 +152,6 @@ unsigned char * blet_get_rgbmap (int idx
 	return rgbbuf;
 }
 
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/board.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/board.c
@@ -74,7 +74,7 @@ gboolean state_board_flipped = FALSE;
 //! default background
 char board_default_colors [9] = {215, 215, 215, 215, 215, 215, 0, 0, 0};
 
-static int cell_size, num_pieces;
+int cell_size, num_pieces;
 
 extern void ui_make_human_move (byte *move, int *rmove);
 
@@ -677,4 +677,6 @@ void board_init ()
 	gdk_gc_destroy (def_gc);
 }
 
-
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/breakthrough.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/breakthrough.c
@@ -362,3 +362,6 @@ int breakthrough_getmove (Pos *pos, int
 	return 1;
 }
 
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/checkers.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/checkers.c
@@ -300,3 +300,7 @@ char ** checkers_get_pixmap (int idx, in
 			CHECKERS_ISWHITE(idx) ? 0xffffff : 0x0000ff, bg, 
 			(idx == CHECKERS_WP || idx == CHECKERS_BP) ? 8 : 12, 24);
 }
+
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/chess.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/chess.c
@@ -895,3 +895,7 @@ ResultType chess_eval (Pos * pos, Player
 	*eval = sum;
 	return RESULT_NOTYET;
 }
+
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/cpento.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/cpento.c
@@ -576,3 +576,6 @@ static int cpento_getmove(Pos *pos, int
     }
 }
 
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/dirmaze.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/dirmaze.c
@@ -275,3 +275,6 @@ char ** hypermaze_get_pixmap (int idx, i
 	}
 }
 
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/dotsandboxes.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/dotsandboxes.c
@@ -447,3 +447,7 @@ void dnb_search (Pos *pos, byte **movp)
 		return;
 	}
 }
+
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/eightqueens.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/eightqueens.c
@@ -43,7 +43,7 @@ char eightqueens_colors[6] = {200, 200,
 
 void eightqueens_init ();
 
-char ** eightqueens_pixmaps [] = 
+char ** eightqueens_pixmaps [] =
 {
 	chess_wq_54_xpm,
 	grey_square_54_xpm,
@@ -126,10 +126,13 @@ int eightqueens_getmove (Pos *pos, int x
 	*mp++ = x, *mp++ = y, *mp++ = EIGHTQUEENS_QUEEN;
 	for (i=0; i<board_wid; i++)
 	for (j=0; j<board_heit; j++)
-		if (!(i==x && j==y) && pos->board[j * board_wid + i] == EIGHTQUEENS_EMPTY 
+		if (!(i==x && j==y) && pos->board[j * board_wid + i] == EIGHTQUEENS_EMPTY
 				&& ATTACKS (i, j, x, y))
 			*mp++ = i, *mp++ = j, *mp++ = EIGHTQUEENS_CONTROLLED;
 	*mp++ = -1;
 	return 1;
 }
 
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/engine.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/engine.c
@@ -433,3 +433,6 @@ byte * engine_search (Pos *pos/*, int pl
 	return move;
 }
 
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/engine.h
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/engine.h
@@ -42,3 +42,7 @@ void engine_poll ();
 
 
 #endif
+
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/fifteen.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/fifteen.c
@@ -227,7 +227,7 @@ char ** fifteen_pixmap_square_gen (char
 	static char line[FIFTEEN_CELL_SIZE];
 	memset(line, ' ', FIFTEEN_CELL_SIZE);
 	pixmap = g_new(char *, FIFTEEN_CELL_SIZE + 2);
-	pixmap[0] = "60 60 1 1"; // FIXME: dont hard code
+	pixmap[0] = "60 60 1 1"; // FIXME: don't hard code
 	// FIXME: not freed
 	pixmap[1] = g_strdup_printf (" c %s", col);
 	for (i=0; i<FIFTEEN_CELL_SIZE; i++) pixmap[i+2] = line; return pixmap;
@@ -284,3 +284,7 @@ guchar *fifteen_get_rgbmap (int idx, int
 	}
 	return buf;
 }
+
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/flw.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/flw.c
@@ -342,3 +342,6 @@ void flw_free ()
 	flw_curx = flw_cury = -1;
 }
 
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/flwords.h
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/flwords.h
@@ -4360,3 +4360,7 @@ static const int num_flwords = sizeof (f
 
 
 #endif
+
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/game.h
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/game.h
@@ -27,6 +27,8 @@
   This is the only file that the games need to include.
 */
 
+#define GTKBOARD_VERSION "0.11pre0"
+
 //! Both moves and positions are arrays of <tt>byte</tt>s
 #ifndef byte 
 #define byte gint8
@@ -518,3 +520,7 @@ extern int (*game_scorecmp_def_iscore) (
 extern int (*game_scorecmp_def_time) (gchar *, int, gchar*, int);
 
 #endif
+
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/hash.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/hash.c
@@ -236,3 +236,7 @@ void hash_print_stats ()
 	}
 	if (opt_verbose) printf ("stale=%d\n", stale);
 }
+
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/hiq.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/hiq.c
@@ -286,3 +286,6 @@ InputType hiq_event_handler
 	return INPUT_LEGAL;
 }
 
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/infiltrate.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/infiltrate.c
@@ -205,3 +205,7 @@ char ** infiltrate_get_pixmap (int idx,
 			8, 24);
 }
 */
+
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/knights.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/knights.c
@@ -367,3 +367,7 @@ ResultType knights_eval (Pos *pos, Playe
 {
 	return knights_eval_real (pos, player, eval, FALSE);
 }
+
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/kttour.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/kttour.c
@@ -266,3 +266,6 @@ int kttour_getmove
 	return 1;
 }
 
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/mastermind.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/mastermind.c
@@ -470,3 +470,6 @@ int mastermind_getmove_kb (Pos *pos, int
 	return 1;
 }
 
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/maze.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/maze.c
@@ -289,3 +289,6 @@ char ** maze_get_pixmap (int idx, int co
 	//else return pixmap_ball_gen(MAZE_CELL_SIZE, 0xc0c040, bg, 2, 50);
 }
 
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/memory.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/memory.c
@@ -302,3 +302,6 @@ int memory_getmove (Pos *pos, int x, int
 	return 1;
 }
 
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/menu.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/menu.c
@@ -51,7 +51,7 @@ GtkItemFactory *menu_factory = NULL;
 void sb_messagebar_message (gchar *);
 void menu_cleanup_var_menus ();
 
-static char * menu_paths_sens_machine_thinking[] = 
+static char * menu_paths_sens_machine_thinking[] =
 {
 //	"/File/Load game",
 //	"/File/Save game",
@@ -63,7 +63,7 @@ static char * menu_paths_sens_machine_th
 	"/Move/Forward",
 };
 
-static char * menu_paths_sens_no_game[] = 
+static char * menu_paths_sens_no_game[] =
 {
 	"/Game/Start",
 	"/Game/Pause",
@@ -77,7 +77,7 @@ static char * menu_paths_sens_no_game[]
 	"/Settings/Player",
 };
 
-static char * menu_paths_sens_no_back_forw[] = 
+static char * menu_paths_sens_no_back_forw[] =
 {
 	"/Move/Back",
 	"/Move/Forward",
@@ -96,17 +96,17 @@ static char *menu_paths_sens_two_players
 	"/Game/Zap Highscores",
 };
 
-static char *menu_paths_sens_ui_stopped[] = 
+static char *menu_paths_sens_ui_stopped[] =
 {
 	"/Game/Pause",
 };
 
-static char *menu_paths_sens_machine_not_thinking[] = 
+static char *menu_paths_sens_machine_not_thinking[] =
 {
 	"/Move/Move Now",
 };
 
-static char *menu_paths_sens_eval_function[] = 
+static char *menu_paths_sens_eval_function[] =
 {
 //	"/Settings/Eval function",
 };
@@ -124,60 +124,63 @@ void menu_sensitize (int which, gboolean
 	if (!state_gui_active) return;
 	switch (which)
 	{
-		case MENU_SENS_MACHINE_THINKING: 
+		case MENU_SENS_MACHINE_THINKING:
 			menu_des_paths = menu_paths_sens_machine_thinking;
-			num_paths = sizeof (menu_paths_sens_machine_thinking) / 
+			num_paths = sizeof (menu_paths_sens_machine_thinking) /
 				sizeof (menu_paths_sens_machine_thinking[0]);
 			break;
-		case MENU_SENS_MACHINE_NOT_THINKING: 
+		case MENU_SENS_MACHINE_NOT_THINKING:
 			menu_des_paths = menu_paths_sens_machine_not_thinking;
-			num_paths = sizeof (menu_paths_sens_machine_not_thinking) / 
+			num_paths = sizeof (menu_paths_sens_machine_not_thinking) /
 				sizeof (menu_paths_sens_machine_not_thinking[0]);
 			break;
-		case MENU_SENS_NO_GAME: 
+		case MENU_SENS_NO_GAME:
 			menu_des_paths = menu_paths_sens_no_game;
-			num_paths = sizeof (menu_paths_sens_no_game) / 
+			num_paths = sizeof (menu_paths_sens_no_game) /
 				sizeof (menu_paths_sens_no_game[0]);
 			break;
-		case MENU_SENS_NO_BACK_FORW: 
+		case MENU_SENS_NO_BACK_FORW:
 			menu_des_paths = menu_paths_sens_no_back_forw;
-			num_paths = sizeof (menu_paths_sens_no_back_forw) / 
+			num_paths = sizeof (menu_paths_sens_no_back_forw) /
 				sizeof (menu_paths_sens_no_back_forw[0]);
 			break;
-		case MENU_SENS_SINGLE_PLAYER: 
+		case MENU_SENS_SINGLE_PLAYER:
 			menu_des_paths = menu_paths_sens_single_player;
-			num_paths = sizeof (menu_paths_sens_single_player) / 
+			num_paths = sizeof (menu_paths_sens_single_player) /
 				sizeof (menu_paths_sens_single_player[0]);
 			break;
 		case MENU_SENS_TWO_PLAYERS: 
 			menu_des_paths = menu_paths_sens_two_players;
-			num_paths = sizeof (menu_paths_sens_two_players) / 
+			num_paths = sizeof (menu_paths_sens_two_players) /
 				sizeof (menu_paths_sens_two_players[0]);
 			break;
-		case MENU_SENS_UI_STOPPED: 
+		case MENU_SENS_UI_STOPPED:
 			menu_des_paths = menu_paths_sens_ui_stopped;
-			num_paths = sizeof (menu_paths_sens_ui_stopped) / 
+			num_paths = sizeof (menu_paths_sens_ui_stopped) /
 				sizeof (menu_paths_sens_ui_stopped[0]);
 			break;
 		case MENU_SENS_EVAL_FUNCTION:
 			menu_des_paths = menu_paths_sens_eval_function;
-			num_paths = sizeof (menu_paths_sens_eval_function) / 
+			num_paths = sizeof (menu_paths_sens_eval_function) /
 				sizeof (menu_paths_sens_eval_function[0]);
 			break;
 		default:
 			g_assert_not_reached ();
 	}
 	for (i=0; i<num_paths; i++)
-		gtk_widget_set_sensitive (gtk_item_factory_get_widget (menu_factory, 
+		gtk_widget_set_sensitive (gtk_item_factory_get_widget (menu_factory,
 					menu_des_paths[i]), sens);
 }
 
+#if GTK_MAJOR_VERSION == 2
+#define size_sb_set_turn_image 20
+#endif
+
 void sb_set_turn_image ()
 {
 #if GTK_MAJOR_VERSION == 2
 	// FIXME: can't get existing bgcolor
-	const int size = 20;
-	static char pixbufs [7][size*(size+1)];
+	static char pixbufs [7][size_sb_set_turn_image*(size_sb_set_turn_image+1)];
 	char **pixmap_data;
 	static GdkPixmap *pixmaps[7];
 	int colors[7] = {0x007700, 0x77ff77, 0x770000, 0xff7777, 0x000077, 0x7777ff,
@@ -191,18 +194,18 @@ void sb_set_turn_image ()
 		int i;
 		for (i=0; i<7; i++)
 		{
-			pixmap_data = pixmap_ball_gen (size, pixbufs[i], colors[i], 
+			pixmap_data = pixmap_ball_gen (size_sb_set_turn_image, pixbufs[i], colors[i],
 					0xffffff, 6.5, 24);
-			pixmaps[i] = gdk_pixmap_create_from_xpm_d 
+			pixmaps[i] = gdk_pixmap_create_from_xpm_d
 				((GdkWindow *)main_window->window, NULL, NULL, pixmap_data);
 		}
-		gtk_image_set_from_pixmap (GTK_IMAGE (sb_turn_image), 
+		gtk_image_set_from_pixmap (GTK_IMAGE (sb_turn_image),
 				pixmaps[previndex = 6], NULL);
 		first = 0;
 	}
 	if (opt_infile || !opt_game)
 		index = 6;
-	else 
+	else
 	{
 		if (!game_single_player && ui_white == HUMAN && ui_black == HUMAN
 				&& cur_pos.player == BLACK) index = 4;
@@ -211,14 +214,14 @@ void sb_set_turn_image ()
 	}
 	g_assert (index >= 0 && index <= 6);
 	if (index == previndex) return;
-	gtk_image_set_from_pixmap (GTK_IMAGE (sb_turn_image), 
+	gtk_image_set_from_pixmap (GTK_IMAGE (sb_turn_image),
 			pixmaps[previndex = index], NULL);
 #endif
 }
 
 static void sb_set_cursor ()
 {
-	static GdkCursor *cursor_normal = NULL, *cursor_busy = NULL, 
+	static GdkCursor *cursor_normal = NULL, *cursor_busy = NULL,
 		*cursor_inactive = NULL;
 	// FIXME: is it ok to hard code the shape of the normal cursor?
 	if (!cursor_normal) cursor_normal = gdk_cursor_new (GDK_LEFT_PTR);
@@ -272,9 +275,9 @@ static void menu_show_dialog_real (gchar
 	dialog = gtk_dialog_new_with_buttons (title, GTK_WINDOW (main_window),
 			GTK_DIALOG_MODAL, NULL);
 	gtk_window_set_default_size (GTK_WINDOW (dialog), 300, 100);
-	okay_button = gtk_dialog_add_button (GTK_DIALOG (dialog), 
+	okay_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
 			GTK_STOCK_OK, GTK_RESPONSE_NONE);
-	g_signal_connect_swapped (GTK_OBJECT (dialog), 
+	g_signal_connect_swapped (GTK_OBJECT (dialog),
 			"response", G_CALLBACK (gtk_widget_destroy), GTK_OBJECT (dialog));
 	gtk_label_set_selectable (GTK_LABEL (label), TRUE);
 #endif
@@ -294,7 +297,7 @@ void menu_show_dialog_wrap (gchar *title
 {
 	menu_show_dialog_real (title, message, TRUE);
 }
-	
+
 
 void menu_pause_cb (GtkWidget *dialog)
 {
@@ -332,11 +335,12 @@ void menu_show_pause_dialog ()
 			GTK_DIALOG_MODAL,
 			GTK_MESSAGE_INFO,
 			GTK_BUTTONS_OK,
+			"%s",
 			msg);
 /*	dialog = gtk_dialog_new_with_buttons (title, GTK_WINDOW (main_window),
 			GTK_DIALOG_MODAL, NULL);
 	gtk_window_set_default_size (GTK_WINDOW (dialog), 300, 100);
-	okay_button = gtk_dialog_add_button (GTK_DIALOG (dialog), 
+	okay_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
 			GTK_STOCK_OK, GTK_RESPONSE_NONE);
 	gtk_label_set_selectable (GTK_LABEL (label), TRUE);
 */
@@ -375,13 +379,11 @@ void menu_show_about_dialog (gpointer da
 	menu_show_dialog ("About gtkboard", 
 			"gtkboard " VERSION "\n"
 			"http://gtkboard.sourceforge.net/\n"
-			"Maintainer: Arvind Narayanan <arvindn@users.sourceforge.net>\n"
+			"Author: Arvind Narayanan <arvindn@users.sourceforge.net>\n"
 			"Released under the GNU General Public License\n"
 			"See the file COPYING for details\n"
 			"\n"
-			"The documentation is available in the doc/ directory\n"
-			"of the source distribution or in the directory\n" 
-			"/usr/local/doc/gtkboard-" VERSION "/ if you installed from binary rpm.\n"
+			"The documentation is available locally in /usr/share/doc/gtkboard/.\n"
 			"The latest documentation will always be available at\n"
 			"http://gtkboard.sourceforge.net/doc/"
 			);
@@ -425,8 +427,8 @@ void menu_start_stop_game (gpointer data
 				sb_error ("Game over", FALSE);
 				break;
 			}
-			if (!impl_check()) 
-			{	
+			if (!impl_check())
+			{
 				sb_error ("Not yet implemented", TRUE);
 				break;
 			}
@@ -470,19 +472,19 @@ void menu_start_stop_game (gpointer data
 // if first is TRUE use opt_white and opt_black
 void menu_put_player (gboolean first)
 {
-	gchar *path, *paths[4] = { 
+	gchar *path, *paths[4] = {
 		"/Settings/Player/Human-Human", "/Settings/Player/Human-Machine",
 		"/Settings/Player/Machine-Human", "/Settings/Player/Machine-Machine"};
 	if (!state_gui_active) return;
 	if (first) {ui_white = opt_white; ui_black = opt_black;}
 	if (opt_infile)
 	{
-		gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM 
-		(gtk_item_factory_get_widget (menu_factory, "/Settings/Player/File")), 
+		gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
+		(gtk_item_factory_get_widget (menu_factory, "/Settings/Player/File")),
 		              TRUE);
-			
+
 		return;
-	}	
+	}
 	else if (ui_white == HUMAN && ui_black == HUMAN)
 		path = paths[0];
 	else if (ui_white == HUMAN && ui_black == MACHINE)
@@ -493,35 +495,38 @@ void menu_put_player (gboolean first)
 		path = paths[3];
 	else
 		return;
-	gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM 
+	gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
 			(gtk_item_factory_get_widget (menu_factory, path)), TRUE);
 }
 
 void menu_put_game ()
 {
-	gchar path[128] = "/Game/Select Game/";
+	gchar *prefix = "/Game/Select Game/";
+	gchar path0[128], path[128];
 	if (opt_game->group)
 	{
-		// FIXME: don't use strcat
-		strncat (path, opt_game->group, 128);
-		strncat (path, "/", 128);
+		snprintf (path0, sizeof (path0), "%s%s/", prefix, opt_game->group);
 	}
-	strncat (path, opt_game->name, 128);
-	gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM 
+	else
+	{
+		snprintf (path0, sizeof (path0), "%s", prefix);
+	}
+	snprintf (path, sizeof (path), "%s%s", path0, opt_game->name);
+	gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
 			(gtk_item_factory_get_widget (menu_factory, path)), TRUE);
 }
 
 GtkWidget *menu_selector;
-	
-void menu_load_file (GtkFileSelection *selector, gpointer user_data) 
+
+void menu_load_file (GtkFileSelection *selector, gpointer user_data)
 {
 	gchar const *filename;
 	static FILE *in;
-	filename = gtk_file_selection_get_filename 
+	filename = gtk_file_selection_get_filename
 		(GTK_FILE_SELECTION(menu_selector));
 	if (!(in = fopen (filename, "r")))
 	{
-		gchar *tempstr = g_strdup_printf 
+		gchar *tempstr = g_strdup_printf
 			("Could not open file \"%s\" for reading", filename);
 		sb_error (tempstr, TRUE);
 		g_free (tempstr);
@@ -544,7 +549,7 @@ void menu_set_player (gpointer *data, gu
 	/* the callback for a radio button appears to
 	   be called TWICE, once when selected and once when something else
 	   is selected. */
-	
+
 	if (!GTK_CHECK_MENU_ITEM(widget)->active)
 		return;
 
@@ -601,12 +606,12 @@ void menu_load_file_dialog ()
 	g_assert (menu_selector);
 	/*gtk_file_selection_complete (
 			GTK_FILE_SELECTION (menu_selector), "*.cbgf");*/
-	
-	gtk_signal_connect (GTK_OBJECT 
+
+	gtk_signal_connect (GTK_OBJECT
 		(GTK_FILE_SELECTION(menu_selector)->ok_button),
 		"clicked", GTK_SIGNAL_FUNC (menu_load_file), NULL);
-			   
-	gtk_signal_connect_object (GTK_OBJECT 
+
+	gtk_signal_connect_object (GTK_OBJECT
 		(GTK_FILE_SELECTION(menu_selector)->ok_button),
 		"clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),
 		(gpointer) menu_selector);
@@ -615,7 +620,7 @@ void menu_load_file_dialog ()
 		GTK_OBJECT (GTK_FILE_SELECTION(menu_selector)->cancel_button),
 		"clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),
 		(gpointer) menu_selector);
-   
+
    gtk_widget_show (menu_selector);
 }
 
@@ -671,7 +676,7 @@ void menu_show_game_doc (gpointer data,
 	dialog = gtk_dialog_new();
 	gtk_window_set_title (GTK_WINDOW (dialog), titlestr);
 	hbox = gtk_hbox_new (FALSE, 0);
-	msgarea = gtk_text_new (NULL, 
+	msgarea = gtk_text_new (NULL,
 			gtk_range_get_adjustment (GTK_RANGE (vbar)));
 	gtk_text_set_word_wrap (GTK_TEXT (msgarea), TRUE);
 	gtk_text_insert (GTK_TEXT (msgarea), NULL, NULL, NULL, msgstr, -1);
@@ -680,7 +685,7 @@ void menu_show_game_doc (gpointer data,
 	okay_button = gtk_button_new_with_label("  OK  ");
 	gtk_signal_connect_object (GTK_OBJECT (okay_button), "clicked",
 			GTK_SIGNAL_FUNC (gtk_widget_destroy), (gpointer) dialog);
-	gtk_box_pack_start (GTK_BOX (GTK_DIALOG(dialog)->action_area), 
+	gtk_box_pack_start (GTK_BOX (GTK_DIALOG(dialog)->action_area),
 			okay_button, FALSE, FALSE, 0);
 	gtk_widget_grab_focus (okay_button);	// contributed by Paddu
 	gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), hbox);
@@ -696,7 +701,7 @@ void menu_show_game_doc (gpointer data,
 	gtk_text_view_set_editable (GTK_TEXT_VIEW (msgarea), FALSE);
 	gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (msgarea), GTK_WRAP_WORD);
 	gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (msgarea), FALSE);
-	gtk_text_buffer_set_text (gtk_text_view_get_buffer 
+	gtk_text_buffer_set_text (gtk_text_view_get_buffer
 			(GTK_TEXT_VIEW (msgarea)), msgstr, -1);
 	scrwin = gtk_scrolled_window_new (NULL,
 		gtk_range_get_adjustment (GTK_RANGE(vbar)));
@@ -805,7 +810,8 @@ void menu_insert_recent_game (gchar *gam
 	if (tmpname)
 	{
 		GtkWidget *wid;
-		gtk_widget_destroy (menu_recent_widgets[i == NUM_RECENT_GAMES ? i - 1 : i]);
+		if (i == NUM_RECENT_GAMES) i -= 1;
+		gtk_widget_destroy (menu_recent_widgets[i]);
 		menu_recent_widgets[i] = NULL;
 		gtk_item_factory_delete_item (menu_factory, tmp = g_strdup_printf ("/Game/%s", tmpname));
 		g_free (tmp);
@@ -827,21 +833,21 @@ void menu_insert_recent_game (gchar *gam
 void menu_start_game ()
 {
 	ui_start_game ();
-	
+
 	{
 	int i;
-	GtkItemFactoryEntry help_items [3];
+	GtkItemFactoryEntry help_items [4];
 	help_items[0].path = g_strdup_printf ("/Help/%s", opt_game->name);
 	help_items[0].accelerator = NULL;
 	help_items[0].callback = NULL;
 	help_items[0].item_type = "<Branch>";
 	gtk_item_factory_create_item (menu_factory, help_items, NULL, 1);
-	
-	help_items[0].path = g_strdup_printf ("/Help/%s/_About", opt_game->name); 
+
+	help_items[0].path = g_strdup_printf ("/Help/%s/_About", opt_game->name);
 	help_items[0].callback_action = MENU_DOC_ABOUT;
-	help_items[1].path = g_strdup_printf ("/Help/%s/_Rules", opt_game->name); 
+	help_items[1].path = g_strdup_printf ("/Help/%s/_Rules", opt_game->name);
 	help_items[1].callback_action = MENU_DOC_RULES;
-	help_items[2].path = g_strdup_printf ("/Help/%s/_Strategy", opt_game->name); 
+	help_items[2].path = g_strdup_printf ("/Help/%s/_Strategy", opt_game->name);
 	help_items[2].callback_action = MENU_DOC_STRATEGY;
 	help_items[3].path = g_strdup_printf ("/Help/%s/_History", opt_game->name); 
 	help_items[3].callback_action = MENU_DOC_HISTORY;
@@ -980,7 +986,7 @@ void menu_back_forw (gpointer data, guin
 					sb_message ("You cheated! No highscore for this game.", FALSE);
 				ui_cheated = TRUE;
 			}
-			// FIXME: there should be only one round of communication 
+			// FIXME: there should be only one round of communication
 			// in which client gets both the move and who_won
 			ui_check_who_won ();
 			if (game_reset_uistate) game_reset_uistate();
@@ -1037,7 +1043,7 @@ void menu_set_eval_function ()
 		if (game_htab)
 		for (i=0; game_htab[i].name; i++)
 		{
-			heur_item.path = g_strdup_printf ("/Settings/Eval function/%s/%s", 
+			heur_item.path = g_strdup_printf ("/Settings/Eval function/%s/%s",
 					*color, game_htab[i].name);
 			if (i == 0) strncpy (pathbuf, heur_item.path, 63);
 			heur_item.accelerator = NULL;
@@ -1261,9 +1267,9 @@ void sb_update ()
 		if (ui_white == MACHINE) player[0] = 'M';
 		if (ui_black == HUMAN) player[2] = 'H';
 		if (ui_black == MACHINE) player[2] = 'M';
-		gtk_label_set_text (GTK_LABEL(sb_player_label), 
+		gtk_label_set_text (GTK_LABEL(sb_player_label),
 				ui_white != NONE ? player : "File");
-		gtk_label_set_text (GTK_LABEL(sb_who_label), cur_pos.player == WHITE ? 
+		gtk_label_set_text (GTK_LABEL(sb_who_label), cur_pos.player == WHITE ?
 				game_white_string : game_black_string);
 	}
 	gtk_label_set_text (GTK_LABEL(sb_score_label), sb_score_str);
@@ -1295,3 +1301,7 @@ gboolean sb_update_periodic ()
 	first = FALSE;
 	return TRUE;
 }
+
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/move.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/move.c
@@ -190,4 +190,6 @@ byte *mov_getinv (byte *board, byte *mov
 	return inv;
 }
 
-
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/ninemm.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/ninemm.c
@@ -263,3 +263,7 @@ void ninemm_reset_uistate ()
 {
 	curx = cury = -1;
 }
+
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/othello.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/othello.c
@@ -564,3 +564,7 @@ gboolean othello_use_incr_eval (Pos *pos
 	// TODO: use different threshold for Othello6x6
 	return pos->num_moves > 50 ? TRUE : FALSE;
 }
+
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/pacman.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/pacman.c
@@ -204,7 +204,7 @@ int pacman_animate (Pos *pos, byte **mov
 	int oldboard;
 	// FIXME: do this using stateful
 	static int prevx[4] = {0, 0, 0, 0}, prevy[4] = {0, 0, 0, 0};
-	// make sure the ghosts dont step on each others toes
+	// make sure the ghosts don't step on each others' toes
 	int taken[4] = {-1, -1, -1, -1}, t=0, gid;
 	byte *board = pos->board;
 	pacman_set_dist (board);
@@ -500,3 +500,6 @@ char ** pacman_get_pixmap (int idx, int
 	return NULL;
 }
 
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/pentaline.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/pentaline.c
@@ -495,3 +495,7 @@ void *pentaline_newstate (Pos *pos, byte
 	pos->board [move[1] * board_wid + move[0]] = 0; 
 	return &state;
 }
+
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/plot4.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/plot4.c
@@ -302,3 +302,6 @@ char ** plot4_get_pixmap (int idx, int c
 	return pixmap_ball_gen(55, pixbuf, fg, bg, 17.0, 30.0);
 }
 
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/prefs.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/prefs.c
@@ -563,3 +563,7 @@ void prefs_read_config_file ()
 	
 	fclose (in);
 }
+
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/prefs.h
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/prefs.h
@@ -80,3 +80,7 @@ void prefs_write_config_file ();
 gboolean prefs_get_bool_val (gchar *value);
 extern int (*game_scorecmp) (gchar *, int, gchar*, int);
 #endif
+
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/quarto.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/quarto.c
@@ -312,4 +312,6 @@ unsigned char * quarto_get_rgbmap (int i
 	
 }
 
-
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/rgb.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/rgb.c
@@ -224,3 +224,7 @@ static ResultType rgb_eval (Pos *pos, Pl
 	*eval = 0;
 	return RESULT_NOTYET;
 }
+
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/samegame.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/samegame.c
@@ -409,3 +409,7 @@ void samegame_getxy (byte *board, int *x
 		}
 	}
 }
+
+// Local Variables:
+// tab-width: 4
+// End:
--- /dev/null
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/simple.c
@@ -0,0 +1,890 @@
+/*  This file is a part of gtkboard, a board games system.
+    Copyright (C) 2003, Arvind Narayanan <arvindn@users.sourceforge.net>
+
+    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., 59 Temple Place - Suite 330, Boston, MA 02111 USA
+
+*/
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+#include <stdlib.h>
+
+#include "game.h"
+#include "aaball.h"
+
+#define SIMPLE_CELL_SIZE 55
+#define SIMPLE_NUM_PIECES 3 //piece number 2 is the ENTER xpm, 3 is highlighted button
+
+#define SIMPLE_BOARD_WID 7
+#define SIMPLE_BOARD_HEIT 4
+
+#define SIMPLE_BUTTON 1
+#define ENTER_BUTTON 2
+#define HIGHLIGHTED_BUTTON 3
+#define SIMPLE_EMPTY 0
+
+#define NO_ROW_ACTIVE -1
+#define FIRST_ROW 0
+#define SECOND_ROW 1
+#define THIRD_ROW 2
+
+#define SELECTED (HIGHLIGHTED_BUTTON << 8 | RENDER_REPLACE)
+#define PRINT_POINTER_ADDRESS(pt) fprintf(stderr, "\n Pointer address: 0x%lx",(unsigned long) pt);
+
+#define MACHINE_GOES_GOOD 1
+#define HUMAN_GOES_GOOD 0
+#define MACHINE_LOST 5
+#define HUMAN_LOST 8
+#define NO_STATE 2
+
+
+static char simple_colors[6] = {140, 140, 180, 140, 140, 180};
+
+static char * arrow_blue_return_55_xpm[]=
+{
+"55 55 2 1",
+". c cyan",
+"  c none",
+"                                                       ",
+"                                                       ",
+"                                                       ",
+"                                                       ",
+"                                                       ",
+"                                                       ",
+"                                                       ",
+"                                   .............       ",
+"                                   .............       ",
+"                                   .............       ",
+"                                   .............       ",
+"                                   .............       ",
+"                                   .............       ",
+"                    .              .............       ",
+"                   ..              .............       ",
+"                  ...              .............       ",
+"                 ....              .............       ",
+"                .....              .............       ",
+"               ......              .............       ",
+"              .......              .............       ",
+"             ........              .............       ",
+"            .........              .............       ",
+"           ..........              .............       ",
+"          ...........              .............       ",
+"         .......................................       ",
+"        ........................................       ",
+"       .........................................       ",
+"      ..........................................       ",
+"     ...........................................       ",
+"    ............................................       ",
+"    ............................................       ",
+"     ...........................................       ",
+"      ..........................................       ",
+"       .........................................       ",
+"        ........................................       ",
+"         .......................................       ",
+"          ...........                                  ",
+"           ..........                                  ",
+"            .........                                  ",
+"             ........                                  ",
+"              .......                                  ",
+"               ......                                  ",
+"                .....                                  ",
+"                 ....                                  ",
+"                  ...                                  ",
+"                   ..                                  ",
+"                    .                                  ",
+"                                                       ",
+"                                                       ",
+"                                                       ",
+"                                                       ",
+"                                                       ",
+"                                                       ",
+"                                                       ",
+"                                                       ",
+};
+
+static int simple_init_pos [SIMPLE_BOARD_WID*SIMPLE_BOARD_HEIT] = 
+{
+	1 , 1 , 1 , 1 , 1 , 1 , 1 ,
+	0 , 1 , 1 , 1 , 1 , 1 , 0 ,
+	0 , 0 , 1 , 1 , 1 , 0 , 0 ,
+	0 , 0 , 0 , 0 , 0 , 0 , 2
+};
+
+int simple_game_state;
+void simple_init ();
+ResultType simple_who_won (Pos *, Player , char **);
+unsigned char * simple_get_rgbmap (int, int);
+char ** simple_get_pixmap (int, int);
+InputType simple_event_handler (Pos *pos, GtkboardEvent *event, MoveInfo *move_info_p);
+//static ResultType simple_eval (Pos *, Player, float *);
+void simple_search (Pos *pos, byte **move);
+gboolean only_one_piece_on_board (Pos *);
+//The next three functions compute the best move for the machine
+int comprueba (int matriz[3][7], int level);
+int compruebael (int matriz[3][7], int level);
+int compruebamas (int matriz[3][7], int level);
+int vector1[8]={9,9,9,9,9,9,9,9};//la funcion comprueba requiere esta VARIABLE GLOBAL
+int htirar=43; //la funcion comprueba necesita esta VARIABLE GLOBAL
+int nivel = 1; //level of difficulty
+Game Simple = { SIMPLE_CELL_SIZE, SIMPLE_BOARD_WID, SIMPLE_BOARD_HEIT, 
+	SIMPLE_NUM_PIECES,
+	simple_colors, simple_init_pos, NULL, "Simple Game", "Nimlike games", simple_init};
+Game Simple_easy = { SIMPLE_CELL_SIZE, SIMPLE_BOARD_WID, SIMPLE_BOARD_HEIT, 
+	SIMPLE_NUM_PIECES,
+	simple_colors, simple_init_pos, NULL, "Simple Game Easy", "Nimlike games", simple_init};
+Game Simple_medium = { SIMPLE_CELL_SIZE, SIMPLE_BOARD_WID, SIMPLE_BOARD_HEIT, 
+	SIMPLE_NUM_PIECES,
+	simple_colors, simple_init_pos, NULL, "Simple Game Medium", "Nimlike games", simple_init};
+Game Simple_master = { SIMPLE_CELL_SIZE, SIMPLE_BOARD_WID, SIMPLE_BOARD_HEIT, 
+	SIMPLE_NUM_PIECES,
+	simple_colors, simple_init_pos, NULL, "Simple Game Master", "Nimlike games", simple_init};
+//SCORE_FIELD simple_score_fields[] = {SCORE_FIELD_USER, SCORE_FIELD_SCORE, SCORE_FIELD_TIME, SCORE_FIELD_DATE, SCORE_FIELD_NONE};
+//char *simple_score_field_names[] = {"User", "Flips", "Time", "Date", NULL};
+
+GameLevel simple_levels[] =
+{
+	{"Very Easy", &Simple},
+	{"Easy", &Simple_easy},
+	{"Medium", &Simple_medium},
+	{"Master", &Simple_master},
+	{ NULL, NULL }
+};
+
+void simple_init (Game *game)
+{
+// HERE WE SETUP ALL THE HOOKS
+//	game_getmove = blet_getmove; //deprecated by game_event_handler
+	game_levels = simple_levels;
+	if (game == &Simple)
+		nivel = 1;
+	else if (game == &Simple_easy)
+		nivel = 2;
+	else if (game == &Simple_medium)
+		nivel = 3;
+	else if (game == &Simple_master)
+		nivel = 4;
+	//game_eval = simple_eval; //OUR GAME IS SO SIMPLE SO
+	//game_movegen = simple_movegen;// WE DONT NEED MINIMAX
+	game_search = simple_search;//A function to search and return the best move - for games for which minimax is not appropriate. 
+	game_get_pixmap = simple_get_pixmap;
+	simple_game_state = NO_STATE;
+	//game_get_rgbmap = simple_get_rgbmap;
+	/*
+	  game_single_player = TRUE;
+	  game_score_fields = simple_score_fields;
+	  game_score_field_names = simple_score_field_names;
+	  game_scorecmp = game_scorecmp_def_iscore;
+	*/
+	game_who_won = simple_who_won;
+	game_white_string = "Human";
+	game_black_string = "Machine";
+	
+	game_event_handler = simple_event_handler;
+
+	game_doc_about_status = STATUS_COMPLETE;
+	game_doc_about = 
+		"Simple Game\n"
+		"URL: "GAME_DEFAULT_URL("Simple Game");
+	game_doc_rules = 
+		"Simple game has only two rules:\n"
+		"- The player who has to remove the last piece looses.\n"
+		"- In a turn, you can only remove pieces from one row,\n"
+		"but you can remove as many pieces as you want, for "
+		" example the entire row.\n\n"
+		" Select the pieces you want to remove and click on the\n"
+		"blue arrow square to remove them.\n\n"
+		"Game algorithm: Daniel Rios\n"
+		"Game implementation: Nelson Benitez <gnelsonATcenobioracingDOTcom>";
+	game_doc_strategy = 
+		"In the very easy level of difficulty, avoid having only two rows with the same number of pieces, "
+		"that scenario will end you in a lost game. Higher levels has other scenarios you have to avoid"
+		" in order to win.  In the master level of difficulty, you will only have a chance to win if you have"
+		" the first turn to play.";
+	game_doc_history = 
+		"Game algorithm: Daniel Rios\n"
+		"Game implementation: Nelson Benitez <gnelsonATcenobioracingDOTcom>\n\n"
+		"This game appeared in a TV programme in Spain where people phoned to play the game and win money,\n"
+		"my friend Daniel found out all the ways to win and I coded it for fun.";
+}
+
+ResultType simple_who_won (Pos *pos, Player player, char **commp)
+{
+	//This function is called after every move, both for single player and two player games. 
+	//The Player argument in single_player_mode is NULL for the machine and 1 for the human player
+	static char comment[32];
+	const char* nivel_char[4] = {"VERY EASY","EASY","MEDIUM","MASTER"};
+	//My function that computes the machine's move also sets the simple_game_state variable that 
+	//duplicate the functionality of game_who_won function, so I only attend that variable
+	switch (simple_game_state) {
+	case MACHINE_GOES_GOOD:
+		//snprintf (comment, 32, "You are in the %s level.",nivel_char[nivel-1]);
+		//*commp = comment;
+		return RESULT_NOTYET;
+	case HUMAN_GOES_GOOD:
+		snprintf (comment, 32, "Hey, good movement...");
+		*commp = comment;
+		return RESULT_NOTYET;
+	case MACHINE_LOST:
+		snprintf (comment, 32, "You won! ,the machine lost.");
+		*commp = comment;
+		return RESULT_LOST;
+        case HUMAN_LOST:
+		snprintf (comment, 32, "You lost! ,the machine won.");
+		*commp = comment;
+		return RESULT_WON;
+	case NO_STATE: //we are in HUMAN TO HUMAN game type
+		if (only_one_piece_on_board(pos)) {
+			snprintf (comment, 32, "%s won! , %s lost.",(player == WHITE) ? "Machine" : "Human",(player == WHITE) ? "Human" : "Machine");
+			*commp = comment;
+			return RESULT_WON;
+		}
+	}
+	return RESULT_NOTYET;
+}
+
+gboolean only_one_piece_on_board(Pos *pos) {
+int y,x,count=0;
+	for (y=1; y<SIMPLE_BOARD_HEIT; y++){ //nos saltamos la ltima fila
+		for (x=0; x<SIMPLE_BOARD_WID; x++){
+			if (pos->board[y * SIMPLE_BOARD_WID + x] == SIMPLE_BUTTON)
+				count++;
+		}
+	}
+	if (count <= 1 )//for Human to Human, the one who removes the entire last row (scenario people playing dumb) wins too.
+		return TRUE;
+	else
+		return FALSE;
+}
+      
+InputType simple_event_handler(Pos *pos, GtkboardEvent *event, MoveInfo *move_info_p) {
+	struct ITEM {int x; int y; int value;}; //a struct to store the selected items because
+	static struct ITEM selected_items[SIMPLE_BOARD_WID];//looping the pos->render is broken
+	static char comment[32];
+	static byte movement[4*SIMPLE_BOARD_WID+1]; //largest case is the entire upper row
+	static int items_selected=0;
+	static int active_row;
+	static int rmove[4*SIMPLE_BOARD_WID+1];
+	byte *pt;
+	int *ptr;
+	int i;
+	static int total_moves=-1,x,y,event_item;
+	static gboolean new_turn;
+	x = event->x;
+	y = event->y;
+
+	if (event->type != GTKBOARD_BUTTON_RELEASE)
+		return INPUT_NOTYET;
+
+	event_item = pos->board [y * SIMPLE_BOARD_WID + x];
+	new_turn = (total_moves < pos->num_moves); //handles when we are in a new turn
+	if (items_selected == 0 ) 
+		new_turn = TRUE;
+	if ( event_item == SIMPLE_EMPTY) { 
+		move_info_p->help_message = "You must click on a valid item."; 
+		return INPUT_NOTYET;
+	}
+	if (new_turn) {
+		assert(pos->render[y * SIMPLE_BOARD_WID + x] != SELECTED);//the render info stores in pos->render array
+		active_row = NO_ROW_ACTIVE;
+		total_moves = pos->num_moves;
+		if (event_item == ENTER_BUTTON) { 
+			move_info_p->help_message = "You must select at least one item."; 
+			return INPUT_ILLEGAL;
+		}
+		rmove[0] = x;
+		rmove[1] = y;
+		rmove[2] = SELECTED; // See http://gtkboard.sourceforge.net/doc/doxygen/game_h.html#a103a89
+		rmove[3] = -1;
+		move_info_p->rmove = rmove;
+		active_row = y;
+		items_selected++;
+		selected_items[x].x = x; //we index by the col number (x)
+		selected_items[x].y = y;
+		selected_items[x].value = SIMPLE_BUTTON; //SIMPLE_BUTTON -> SELECTED, SIMPLE_EMPTY-> NO SELECTED
+		return INPUT_NOTYET;
+	} else {
+		if (pos->render[y * SIMPLE_BOARD_WID + x] == SELECTED) event_item = HIGHLIGHTED_BUTTON;
+	
+		switch (event_item) {
+		case SIMPLE_BUTTON:
+			if (active_row != y) {
+				move_info_p->help_message = "You must select items only from one row."; 
+				return INPUT_ILLEGAL;
+			}
+			rmove[0] = x;
+			rmove[1] = y;
+			rmove[2] = SELECTED; // See http://gtkboard.sourceforge.net/doc/doxygen/game_h.html#a103a89
+			rmove[3] = -1;
+			move_info_p->rmove = rmove;
+			items_selected++;
+			selected_items[x].x = x; //we index by the col number (x)
+			selected_items[x].y = y;
+			selected_items[x].value = SIMPLE_BUTTON; //SIMPLE_BUTTON -> SELECTED, SIMPLE_EMPTY-> NO SELECTED
+			return INPUT_NOTYET;
+		case HIGHLIGHTED_BUTTON:
+			rmove[0] = x;
+			rmove[1] = y;
+			rmove[2] = RENDER_NONE; // See http://gtkboard.sourceforge.net/doc/doxygen/game_h.html#a103a89
+			rmove[3] = -1;
+			move_info_p->rmove = rmove;
+			items_selected--;
+			selected_items[x].value = SIMPLE_EMPTY; //SIMPLE_BUTTON -> SELECTED, SIMPLE_EMPTY-> NO SELECTED
+			return INPUT_NOTYET;
+		case ENTER_BUTTON:
+			pt = movement;
+			ptr = rmove;
+			for (i=0;i<SIMPLE_BOARD_WID;i++) {
+				if (selected_items[i].value == SIMPLE_BUTTON) {
+					*pt++ = selected_items[i].x; *pt++ = selected_items[i].y; *pt++ = SIMPLE_EMPTY; 
+					*ptr++ = selected_items[i].x; *ptr++ = selected_items[i].y; *ptr++ = RENDER_NONE;
+					selected_items[i].value = SIMPLE_EMPTY; //reset at the same time
+				}
+			}
+			*pt++ = -1;// The end of a movelet is a -1
+			*ptr++ = -1;
+			move_info_p->move = movement;
+			move_info_p->rmove = rmove;
+			items_selected = 0;//reset cause we going to a new turn
+			return INPUT_LEGAL;
+		}
+	}
+	
+	return INPUT_NOTYET;
+}
+
+char ** simple_get_pixmap (int piece, int color)
+{
+	int bg, i, fg, rad, grad;
+	char *colors;
+	static char pixbuf[SIMPLE_CELL_SIZE * (SIMPLE_CELL_SIZE+1)];
+	if (piece == ENTER_BUTTON) return arrow_blue_return_55_xpm;
+	colors = simple_colors;
+	if (color == BLACK) colors += 3;
+	for(i=0, bg=0;i<3;i++) 
+	{ int col = colors[i]; if (col<0) col += 256; bg += col * (1 << (16-8*i));}
+	if (piece == HIGHLIGHTED_BUTTON)
+		fg = 0xff << 8;//highlighted piece,never comes here cause highlighted stores in render info
+	else
+		fg = 0xcc << 8;//normal piece is green
+	return pixmap_ball_gen(55, pixbuf, fg, bg, 17.0, 35.0);
+}
+
+void board2matriz(Pos *pos,int matriz[3][7]) { 	
+ int y,x;
+//Reads the board and translate it to a matrix which my old functions work with
+//The pos->board[0] is the botton left piece in the board
+//convert the board to my matriz:
+// X X X X X X X
+// - X X X X X -
+// - - X X X - -
+ for (y=1; y<SIMPLE_BOARD_HEIT; y++){ //skip the bottom row
+	for (x=0; x<SIMPLE_BOARD_WID; x++){
+		if (pos->board[y * SIMPLE_BOARD_WID + x] == SIMPLE_BUTTON) {
+			matriz[(SIMPLE_BOARD_HEIT-1)-y][x] = 1;
+		} else {
+			matriz[(SIMPLE_BOARD_HEIT-1)-y][x] = 0;
+		}
+	}
+}
+//now convert matriz to format:
+// X X X X X X X
+// X X X X X - -
+// X X X - - - -
+ for (y=1;y<3;y++) { //skip first row cause its already good
+	 for (x=0;x<SIMPLE_BOARD_WID;x++){
+		 if (y==1 && x>0)
+			 matriz[y][x-1]=matriz[y][x];
+
+		 if (y==2 && x>1)
+			 matriz[y][x-2]=matriz[y][x];
+	 }
+ }
+ matriz[1][5]=matriz[1][6]=matriz[2][3]=matriz[2][4]=matriz[2][5]=matriz[2][6]=0;
+}
+
+void make_machine_move(byte movement[3*SIMPLE_BOARD_WID+1]) {
+	//Move format See: http://gtkboard.sourceforge.net/doc/doxygen/move_h.html#_details
+	//See too: http://gtkboard.sourceforge.net/doc/doxygen/struct_MoveInfo.html#m0
+	
+	byte *pt = movement;
+	//PRINT_POINTER_ADDRESS(movement);
+	//PRINT_POINTER_ADDRESS(pt);
+	int i,y,x=0;
+	y = (SIMPLE_BOARD_HEIT-1) - htirar;
+	assert(y > 0);
+	assert(y < 4);
+	for (i=1;i<8;i++) { //la itirar empiezan a partir de vector1[1] incluido.
+		if (vector1[i]!=9) {
+			if (y==1)
+				x=vector1[i]+2;
+			if (y==2)
+				x=vector1[i]+1;
+			if (y==3)
+				x=vector1[i];
+
+			 *pt++ = x; *pt++ = y; *pt++ = SIMPLE_EMPTY;
+		}  else { 
+			 break;
+		}
+	 }
+	*pt++ = -1;
+	g_usleep(700000); //sleep 0.7 seconds so user can perceive machine move
+}
+
+void simple_search (Pos *pos, byte **move) {
+// Coordinates of the board in http://gtkboard.sourceforge.net/doc/doxygen/struct_Pos.html#m0
+// Format of the board and how to access squares in the board, see http://gtkboard.sourceforge.net/doc/doxygen/struct_Pos.html#m0
+	static int matriz[3][7];
+	static byte movement[4*SIMPLE_BOARD_WID+1];
+	//PRINT_POINTER_ADDRESS(movement);
+	int ret=1;
+	int y,x;
+	board2matriz(pos,matriz);
+	ret=comprueba(matriz,nivel);
+	switch (ret){
+	case 0:
+		simple_game_state = HUMAN_GOES_GOOD;
+		make_machine_move(movement);
+		*move = movement;
+		break;
+	case 1:
+		simple_game_state = MACHINE_GOES_GOOD;
+		make_machine_move(movement);
+		*move = movement;
+		break;
+	case 5:
+		simple_game_state = MACHINE_LOST;
+		make_machine_move(movement);
+		*move = movement;
+		break;
+	case 8:
+		simple_game_state = HUMAN_LOST;
+		make_machine_move(movement);
+		*move = movement;
+		break;
+		}
+}
+
+
+// BELOW THIS LINE ARE THE FUNCTIONS THAT LOOKS FOR THE BEST MOVE FOR THE MACHINE
+// THEY ARE VERY POOR AND BEGINNER C CODE,YOU BETTER DONT WANT TO LOOK AT THEM
+// THEY WERE WRITTEN WHEN I WAS LEARNING C AND I PRACTICED WITH THIS GAME.
+// YOU ARE ADVISED ;-)
+
+int comprueba (int matriz[3][7], int level)
+{
+/*RETORNA 1 si en alguna jugada(de todas las nuestras posibles) el
+OTRO le es imposible dejarnos a nosotros en MISMO O 1|1|1 o 1|2|3 etc (dependiendo del nivel de chekeo), y
+la jugada en cuestion se haya en las VARIABLES GLOBALES htirar y a partir de vector1[1](incluido)
+
+RETORNA 8 si ganamos la partida porque la ultima casilla quedo en pie para que la tire EL OTRO
+
+RETORNA  5 si perdimos la partida porque nos toco tirar la ultima casilla, y la ultima casilla a tirar
+           esta en htirar y vector[1]
+
+RETORNA 0 si para todas nuestras jugadas posibles el OTRO en cualquiera de ellas
+puede hacernos MISMO O 1|1|1 o etc (depende del level) y la jugada esta en htirar y vector1[1], 
+tambien retorna 0 en el caso que nos quede la ultima casilla por tirar (HEMOS PERDIDO)*/
+
+int w,e,acum,p,q,con=1;
+int copia[3][7];
+int up,down;//solo pa restablecer la copia de seguridad porke toy kemao
+/*****************************************
+ INICIALIZACION DE HTIRAR Y VECTOR1
+****************************************/
+htirar=43;
+ for (q=0;q<8;q++)
+ {
+ vector1[q]=9;
+ }
+/*****************************************
+ FIN INICIALIZACION DE HTIRAR Y VECTOR1
+****************************************/
+/***************************************
+ COMENZAMOS COPIA DE SEGURIDAD DE MATRIZ
+****************************************/
+for (w=0;w<3;w++)
+{
+  for (e=0;e<7;e++)
+   {
+    copia[w][e]=matriz[w][e];
+    }
+}
+/******************************************
+ TERMINAMOS LA COPIA DE SEGURIDAD DE MATRIZ
+*******************************************/
+for (w=0;w<3;w++)
+{
+ for (e=0;e<7;e++)
+ {
+  if ((w==1 && e==5) || (w==2 && e==3))
+  {
+   break;
+  }
+  if (matriz[w][e]!=0)
+  {
+   matriz[w][e]=0;
+   htirar=w;
+   vector1[0]=43;
+   vector1[0+con]=e;
+   con=con+1;
+
+  if ((p=compruebael(matriz, level))) 
+  {
+/***************************************
+ COMENZAMOS A RESTABLECER COPIA DE SEGURIDAD DE MATRIZ
+****************************************/
+for (up=0;up<3;up++)
+{
+  for (down=0;down<7;down++)
+   {
+    matriz[up][down]=copia[up][down];
+    }
+}
+/******************************************
+ TERMINAMOS DE RESTABLECER LA COPIA DE SEGURIDAD DE MATRIZ
+*******************************************/
+
+  if (p==8)
+  {
+    return 8;//esto es que tras nuestra tirada,, al OTRO solo le quedara tirar la ultima casilla 
+   }
+   return 1; // y la posicion estan en htirar y vector1 GLOBALES
+  } //fin del IF p=compruebael
+  } //fin del IF !=0
+  }//fin del FOR de la e
+ if (vector1[0]==43)
+ {
+ for (up=1;up<8;up++)
+ {
+  if (vector1[up]!=9)
+    {
+     matriz[w][vector1[up]]=1;
+    }
+ }
+ con=1;
+ htirar=43;
+ for (q=0;q<8;q++)
+ {
+ vector1[q]=9;
+ }
+ }//fin del IF 43
+} //fin del FOR de la w
+
+/***************************************
+ COMENZAMOS A RESTABLECER COPIA DE SEGURIDAD DE MATRIZ
+****************************************/
+for (up=0;up<3;up++)
+{
+  for (down=0;down<7;down++)
+   {
+    matriz[up][down]=copia[up][down];
+    }
+}
+/******************************************
+ TERMINAMOS DE RESTABLECER LA COPIA DE SEGURIDAD DE MATRIZ
+*******************************************/
+// A CONTINUACION BUSCAMOS LA PRIMERA CASILLA QUE ENCONTREMOS Y LA ANOTAMOS PARA TIRARLA
+// YA QUE NOS DA IGUAL PORQUE NO EXISTE NINGUNA JUGADA SATISFACTORIA Y SALDREMOS CON RETORNO 0
+// DE PASO UTILIZAMOS UN ACUMULADOR PARA SABER SI ES LA ULTIMA CASILLA
+w=20;
+acum=0;
+for (up=0;up<3;up++)
+ {
+  for (down=0;down<7;down++)
+  {
+   if ((up==1 && down==5) || (up==2 && down==3))
+   {
+    break; //saltamos para ajustar la matriz al tamao de nuestras filas
+   }
+   if (matriz[up][down]==1)
+   {
+     if (w==20)
+     {
+      w=up;   //almacenamos los indices de
+      e=down; //la primera casilla que encontramos
+     }
+    acum+=1;
+   }
+  } //fin del FOR f
+ } //fin del FOR r
+htirar=w;     // escribimos en las globales
+vector1[0]=43;// la
+vector1[1]=e; // posicion de la casilla
+//Y AHORA COMPROBAMOS SI ES LA ULTIMA FICHA, PARA SALIR CON RETORNO 5 Y ASI SABER QUE HEMOS PERDIDO
+if (acum==1)
+{
+ return 5; //devolvemos 5 para decir que hemos perdido y la ultima casilla por tirar esta en las globales
+}
+//Y AHORA LA SALIDA NORMAL EN CASO DE QUE NOS ESTEN GANANDO
+return 0; //para todas nuestras jugadas posibles el OTRO consigue hacernos MISMO
+} //fin de la DEFINICION de la funcion comprueba
+
+
+int compruebael (int matriz[3][7], int level)
+{
+/*RETORNA 1 si tras probar todas las posibilidades del OTRO en ninguna
+de ellas consigue hacernos MISMO
+
+RETORNA 0 si al probar todas las posibilidades del OTRO en alguna puede
+hacernos MISMO*/
+int v,b,a=43,q,con=1;
+int heltirar=43; //en este caso son variables LOCALES
+int vector1el[8]={9,9,9,9,9,9,9,9}; //en este caso son variables LOCALES
+int seguridad[3][7];
+int big,small; //solo para restablecer copia de seguridad porke toy kemao de variables
+/***************************************
+ COMENZAMOS COPIA DE SEGURIDAD DE MATRIZ
+****************************************/
+for (v=0;v<3;v++)
+{
+  for (b=0;b<7;b++)
+   {
+    seguridad[v][b]=matriz[v][b];
+    }
+}
+/******************************************
+ TERMINAMOS LA COPIA DE SEGURIDAD DE MATRIZ
+*******************************************/
+for (v=0;v<3;v++)
+{
+ for (b=0;b<7;b++)
+ {
+  if ((v==1 && b==5) || (v==2 && b==3))//los saltos de acuerdo al size de our filas
+  {
+   break;
+  }
+  if (matriz[v][b]!=0)
+  {
+   matriz[v][b]=0;
+   heltirar=v;
+   vector1el[0]=43;
+   vector1el[0+con]=b;
+   con=con+1;
+
+  if ((a=compruebamas(matriz, level))==1) //no hace falta poner compruebamas(matriz [3][7])
+  {
+/***************************************
+ COMENZAMOS A RESTABLECER COPIA DE SEGURIDAD DE MATRIZ
+****************************************/
+for (big=0;big<3;big++)
+{
+  for (small=0;small<7;small++)
+   {
+    matriz[big][small]=seguridad[big][small];
+    }
+}
+/******************************************
+ TERMINAMOS DE RESTABLECER LA COPIA DE SEGURIDAD DE MATRIZ
+*******************************************/
+   return 0;
+  }
+  } //fin del IF !=0
+  }//fin del FOR de la e
+ if (vector1el[0]==43)
+ {
+ for (big=0;big<8;big++)
+ {
+  if (vector1el[big]!=9)
+   {
+    matriz[v][vector1el[big]]=1;
+   }
+ }
+ con=1;
+ heltirar=43;
+ for (q=0;q<8;q++)
+ {
+ vector1el[q]=9;
+ }
+ }//fin del IF 43
+} //fin del FOR de la w
+
+/***************************************
+ COMENZAMOS A RESTABLECER COPIA DE SEGURIDAD DE MATRIZ
+****************************************/
+for (big=0;big<3;big++)
+{
+  for (small=0;small<7;small++)
+   {
+    matriz[big][small]=seguridad[big][small];
+    }
+}
+/******************************************
+ TERMINAMOS DE RESTABLECER LA COPIA DE SEGURIDAD DE MATRIZ
+*******************************************/
+if (a==8){
+return 8;
+}
+else {        //esto es para si compruebael recibe una matriz vacia (caso de la ultima casilla por tirar)
+  if (a==43) { return 0; } //pues no devolvemos 1, sino 0, que indica que es malo para nosotros, y es lo
+     }         //lo que se espera que devuelva para el caso especial de la ultima casilla
+return 1;
+} //fin de la DEFINICION de la funcion compruebael
+
+
+
+int compruebamas(int matriz[3][7], int level)
+{
+/*RETORNA 1 si de la matriz recibida existen DOS filas con el mismo numero de
+ bloques y la TERCERA no tiene ningun bloque, a esta situacion se le denomina
+ MISMO o hacer un MISMO. Tambien retorna 1 si existe un 1|1|1 o 1|2|3 o 1|0|0
+ o 3|4|5 (predecesor del 1|2|3) o 5|4|1
+ NOTA:el que le hace un MISMO a otra persona, esa otra persona ya pierde la partida.
+
+ RETORNA 0 si NO existen SOLO dos filas con el mismo numero de bloques y que
+ la tercera no tenga ningun bloque, esto es, si no existe un MISMO, SOLO EN
+ EL MISMO 1|1 DEVUELVE TAMBIEN 0 (YA QUE ES BUENO PARA NOSOTROS), tambien
+ devuelve 0 si a parte de no haber MISMO no hay tampoco un 1|1|1 ni 1|2|3
+ ni 1|0|0 ni 3|4|5*/
+int r,f,contador1[3]={0,0,0};
+ for (r=0;r<3;r++)
+ {
+  for (f=0;f<7;f++)
+  {
+   if ((r==1 && f==5) || (r==2 && f==3))
+   {
+    break; //saltamos para ajustar la matriz al tamao de nuestras filas
+   }
+   if (matriz[r][f]==1)
+   {
+    contador1[r]=contador1[r]+1;
+   }
+  } //fin del FOR f
+ } //fin del FOR r
+ if (contador1[0]==contador1[1] && contador1[2]==0)
+ {
+  if (contador1[0]==0 && contador1[1]==0)//ESTO ES QUE NOS DEJA UN 0|0|0 ,QUE SIGNIFICA QUE HEMOS
+      {                                  //GANADO PORQUE EL OTRO TIRO LA ULTIMA, AQUI SE DA EL 
+       return 8;                         //VALOR DE RETORNO QUE INDICA QUE HEMOS GANADO LA PARTIDA
+      }
+  if (contador1[0]==1 && contador1[1]==1)
+  {          
+   return 0; // es un MISMO del tipo 1|1
+  }
+  else
+  {
+  return 1; //existen DOS filas con el mismo numero de bloques y la TERCERA no tiene ningun bloque
+  }
+ }
+ else
+ {
+  if (contador1[2]==contador1[1] && contador1[0]==0)
+  {
+   if (contador1[2]==1 && contador1[1]==1)
+  {
+   return 0; //es un MISMO del tipo 1|1
+  }
+  else
+  {
+  return 1; //existen DOS filas con el mismo numero de bloques y la TERCERA no tiene ningun bloque
+  }
+  }
+  else
+  {
+   if (contador1[2]==contador1[0] && contador1[1]==0)
+   {
+    if (contador1[2]==1 && contador1[0]==1)
+  {
+   return 0; //es un MISMO del tipo 1|1
+  }
+  else
+  {
+  return 1; //existen DOS filas con el mismo numero de bloques y la TERCERA no tiene ningun bloque
+  }
+   }
+  }
+ }
+ //AHORA COMPROBAMOS SI EXISTE UN 1|2|3 (6 combinaciones)
+ //Nota: No ponemos IF anidados porque en cualquiera se sale con return
+if (level==2 || level==3 || level==4)//el chekeo 1|2|3 y 1|1|1 se hara si tiene uno de estos niveles
+{
+ if (contador1[0]==1 && contador1[1]==2 && contador1[2]==3)
+ {
+  return 1; //existe un 1|2|3
+  }
+ if (contador1[0]==3 && contador1[1]==2 && contador1[2]==1)
+ {
+  return 1; //existe un 1|2|3
+  }
+ if (contador1[0]==2 && contador1[1]==1 && contador1[2]==3)
+ {
+  return 1; //existe un 1|2|3
+  }
+ if (contador1[0]==2 && contador1[1]==3 && contador1[2]==1)
+ {
+  return 1; //existe un 1|2|3
+  }
+ if (contador1[0]==3 && contador1[1]==1 && contador1[2]==2)
+ {
+  return 1; //existe un 1|2|3
+  }
+ if (contador1[0]==1 && contador1[1]==3 && contador1[2]==2)
+ {
+  return 1; //existe un 1|2|3
+  }
+ //FIN COMPROBACION DE 1|2|3
+ //AHORA COMPROBAMOS SI EXISTE UN 1|1|1
+ if (contador1[0]==1 && contador1[1]==1 && contador1[2]==1)
+ {
+  return 1; //existe un 1|1|1, que nos hace el mismo mal que un MISMO
+ }
+} //FIN DEL IF LEVEL==1 || LEVEL ==2 ...
+ //FIN COMPROBACION DE 1|1|1
+ //AHORA COMPROBAMOS SI EXISTE 3|4|5 (PREDECESOR DE 1|2|3) (solo 2 combinaciones
+ //porque el 3 solo puede estar en una fila)
+if (level==3 || level==4)
+{
+ if (contador1[0]==5 && contador1[1]==4 && contador1[2]==3)
+ {
+  return 1;//existe un 3|4|5 (predecesor del 1|2|3)
+ }
+ if (contador1[0]==4 && contador1[1]==5 && contador1[2]==3)
+ {
+  return 1;//existe un 3|4|5 (predecesor del 1|2|3)
+ }
+} //fin del if level==3 || level==4
+ //FIN COMPROBACION DE 3|4|5 (PREDECESOR DE 1|2|3)
+ //COMPROBAMOS EL 5|4|1
+if (level==4)
+{
+ if (contador1[0]==5 && contador1[1]==4 && contador1[2]==1)
+ {
+  return 1;//existe un 5|4|1
+ }
+ if (contador1[0]==4 && contador1[1]==5 && contador1[2]==1)
+ {
+  return 1;//existe un 5|4|1
+ }
+}//fin del if level==4
+ //TERMINAMOS COMPROBAR 5|4|1
+ 
+ //AHORA COMPROBAMOS SI EXISTE 1|0|0 (son 3 combinaciones)
+ if (contador1[0]==1 && contador1[1]==0 && contador1[2]==0)
+ {
+  return 1; //existe un 1|0|0 que nos perjudica igual k MISMO y 1|1|1 y 1|2|3
+ }
+ if (contador1[0]==0 && contador1[1]==1 && contador1[2]==0)
+ {
+  return 1; //existe un 1|0|0 que nos perjudica igual k MISMO y 1|1|1 y 1|2|3
+ }
+ if (contador1[0]==0 && contador1[1]==0 && contador1[2]==1)
+ {
+  return 1; //existe un 1|0|0 que nos perjudica igual k MISMO y 1|1|1 y 1|2|3
+ }
+ //FIN COMPROBACION DE 1|0|0
+ 
+ return 0; //NO existen SOLO dos filas con el mismo numero de bloques
+ //ni tampoco un 1|1|1 ni 1|2|3 ni 1|0|0 ni 3|4|5 ni 5|4|1
+} //fin de DEFINICION de compruebamas
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/sound.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/sound.c
@@ -169,3 +169,7 @@ void sound_play (SoundEvent event)
 	sound_play_real (sound_file);
 	g_free (sound_file);
 }
+
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/sound.h
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/sound.h
@@ -25,3 +25,7 @@ void sound_set_enabled (gboolean enabled
 void sound_enable_pref_cb (gchar *key, gchar *value);
 
 #endif
+
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/stack.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/stack.c
@@ -34,6 +34,9 @@
    movstack_ptr ---> movstack_max : "forward" list
 */
 
+//! Start offset of the stack in the circular buffer
+static int movstack_start = 0;
+
 //! Current position in the stack
 static int movstack_ptr = 0;
 
@@ -67,31 +70,38 @@ int movstack_get_num_moves()
 
 void movstack_push (byte *board, byte *move)
 {
-	assert (movstack_ptr < STACK_SIZE - 1);
-	movstack[movstack_ptr] = movdup (move);
-	movinvstack[movstack_ptr] = mov_getinv (board, move);
-	movstack_ptr++;
-	if (movstack_ptr > movstack_max)
-		movstack_max = movstack_ptr;
+	movstack[(movstack_start + movstack_ptr) % STACK_SIZE] = movdup (move);
+	movinvstack[(movstack_start + movstack_ptr) % STACK_SIZE] = mov_getinv (board, move);
+	if (movstack_ptr < STACK_SIZE - 1) {
+		movstack_ptr++;
+		if (movstack_ptr > movstack_max)
+			movstack_max = movstack_ptr;
+	} else {
+		free (movstack[movstack_start]);
+		free (movinvstack[movstack_start]);
+		movstack_start = (movstack_start + 1) % STACK_SIZE;
+	}
 }
 
 byte *movstack_pop ()
 {
 	if (movstack_ptr == 0)
 		return NULL;
-	return movstack[--movstack_ptr];
+	movstack_ptr--;
+	return movstack[(movstack_start + movstack_ptr) % STACK_SIZE];
 }
 
-//! Truncates a stack to the current poisition. 
-/** This will be called when the user makes a move when it is not the final poisition. */
+//! Truncates a stack to the current position. 
+/** This will be called when the user makes a move when it is not the final position. */
 void movstack_trunc ()
 {
 	int i;
 	assert (movstack_ptr <= movstack_max);
 	for (i = movstack_ptr; i < movstack_max; i++)
 	{
-		free (movstack[i]);
-		free (movinvstack[i]);
+		int j = (movstack_start + i) % STACK_SIZE;
+		free (movstack[j]);
+		free (movinvstack[j]);
 	}
 	movstack_max = movstack_ptr;
 }
@@ -101,7 +111,7 @@ byte * movstack_forw ()
 	if (movstack_ptr < movstack_max)
 		movstack_ptr++;
 	else return NULL;
-	return movstack[movstack_ptr-1];
+	return movstack[(movstack_start + movstack_ptr - 1) % STACK_SIZE];
 }
 
 byte * movstack_back ()
@@ -109,7 +119,7 @@ byte * movstack_back ()
 	if (movstack_ptr > 0)
 		movstack_ptr--;
 	else return NULL;
-	return movinvstack[movstack_ptr];
+	return movinvstack[(movstack_start + movstack_ptr) % STACK_SIZE];
 }
 
 void movstack_free ()
@@ -117,8 +127,9 @@ void movstack_free ()
 	int i;
 	for (i=0; i<movstack_max; i++)
 	{
-		free (movstack[i]);
-		free (movinvstack[i]);
+		int j = (movstack_start + i) % STACK_SIZE;
+		free (movstack[j]);
+		free (movinvstack[j]);
 	}
 	movstack_max = movstack_ptr = 0;
 }
@@ -128,7 +139,7 @@ void movstack_free ()
    state stack
 */
 
-static int statestack_ptr = 0, statestack_max = 0;
+static int statestack_start = 0, statestack_ptr = 0, statestack_max = 0;
 
 static void *statestack[STACK_SIZE];
 
@@ -136,28 +147,35 @@ static void *statestack[STACK_SIZE];
 void statestack_push (void *state)
 {
 	void *newstate;
-	assert (statestack_ptr < STACK_SIZE - 1);
 	newstate = malloc (game_state_size);
 	assert (newstate);
 	memcpy (newstate, state, game_state_size);
-	statestack[statestack_ptr] = newstate;
-	statestack_ptr++;
-	if (statestack_ptr > statestack_max)
-		statestack_max = statestack_ptr;
+
+	statestack[(statestack_start + statestack_ptr) % STACK_SIZE] = newstate;
+
+	if (statestack_ptr < STACK_SIZE - 1) {
+		statestack_ptr++;
+		if (statestack_ptr > statestack_max)
+			statestack_max = statestack_ptr;
+	} else {
+		free (statestack[statestack_start]);
+		statestack_start = (statestack_start + 1) % STACK_SIZE;
+	}
 }
 
 void *statestack_peek ()
 {
 	if (statestack_ptr == 0)
 		return NULL;
-	return statestack[statestack_ptr-1];
+	return statestack[(statestack_start + statestack_ptr - 1) % STACK_SIZE];
 }
 
 void *statestack_pop ()
 {
 	if (statestack_ptr == 0)
 		return NULL;
-	return statestack[--statestack_ptr];
+	statestack_ptr--;
+	return statestack[(statestack_start + statestack_ptr) % STACK_SIZE];
 }
 
 void statestack_trunc ()
@@ -165,7 +183,7 @@ void statestack_trunc ()
 	int i;
 	assert (statestack_ptr <= statestack_max);
 	for (i = statestack_ptr; i < statestack_max; i++)
-		free (statestack[i]);
+		free (statestack[(statestack_start + i) % STACK_SIZE]);
 	statestack_max = statestack_ptr;
 }
 
@@ -174,7 +192,7 @@ void * statestack_forw ()
 	if (statestack_ptr < statestack_max)
 		statestack_ptr++;
 	else return NULL;
-	return statestack[statestack_ptr-1];
+	return statestack[(statestack_start + statestack_ptr - 1) % STACK_SIZE];
 }
 
 void * statestack_back ()
@@ -182,13 +200,17 @@ void * statestack_back ()
 	if (statestack_ptr > 0)
 		statestack_ptr--;
 	else return NULL;
-	return statestack[statestack_ptr-1];
+	return statestack[(statestack_start + statestack_ptr - 1) % STACK_SIZE];
 }
 
 void statestack_free ()
 {
 	int i;
 	for (i=0; i<statestack_max; i++)
-		free (statestack[i]);
+		free (statestack[(statestack_start + i) % STACK_SIZE]);
 	statestack_max = statestack_ptr = 0;
 }
+
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/stopgate.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/stopgate.c
@@ -527,5 +527,6 @@ int stopgate_getmove (Pos *pos, int x, i
 	return 1;
 }
 
-
-
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/tetris.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/tetris.c
@@ -505,3 +505,6 @@ char ** tetris_get_pixmap (int idx, int
 	return pixmap;
 }
 
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/towers.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/towers.c
@@ -412,3 +412,7 @@ void towers_get_render (Pos *pos, byte *
 	*rp++ = -1;
 	*rmovp = rmove;
 }
+
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/ui.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/ui.c
@@ -27,6 +27,7 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/wait.h>
+#include <getopt.h>
 
 #include <glib.h>
 
@@ -61,7 +62,7 @@ extern Game
 	Pentaline, Mastermind, Pacman, Flw, Wordtris,
 	Ninemm, Stopgate, Knights, Breakthrough, 
 	CapturePento, Towers, Quarto, Kttour, Eightqueens, Dnb,
-	Blet, Othello6x6
+	Blet, Othello6x6, Simple
 	;
 
 Game *games[] = { 
@@ -105,6 +106,7 @@ Game *games[] = {
 	&Checkers, 
 	&Memory, 
 	&Ninemm, 
+	&Simple
 		
 };
 
@@ -667,7 +669,25 @@ static void parse_opts (int argc, char *
 {
 	char *wheur = NULL, *bheur = NULL;
 	int c, i;
-	while ((c = getopt (argc, argv, "g:G:d:f:l:p:w:b:Hqvh")) != -1)
+	int option_index = 0;
+	static struct option long_options[] = {
+	  {"game",1,0,'g'},
+	  {"plugin",1,0,'G'},
+	  {"delay",1,0,'d'},
+	  {"file",1,0,'f'},
+	  {"log",1,0,'l'},
+	  {"players",1,0,'p'},
+	  {"w-heuristic",1,0,'w'},
+	  {"b-heuristic",1,0,'b'},
+	  {"html-help",0,0,'H'},
+	  {"hide-board",0,0,'q'},
+	  {"verbose",0,0,'v'},
+	  {"help",0,0,'h'},
+	  {"version",0,0,'V'},
+	  {0, 0, 0, 0}
+	};
+	while ((c = getopt_long (argc, argv, "g:G:d:f:l:p:w:b:HqvhV",
+							 long_options, &option_index)) != -1)
 	{
 		switch (c)
 		{
@@ -787,22 +807,27 @@ static void parse_opts (int argc, char *
 			case 'v':
 				opt_verbose = 1;
 				break;
+			case 'V':
+				printf("gtkboard %s\n", GTKBOARD_VERSION);
+				exit(0);
 			case 'h':
-				printf ("Usage: gtkboard \t[-qvh] "
-						"[-g game] [-G file] [-f file] [-l logfile] [-d msec]\n"
-						"\t\t\t[-p XX] [-w wheur -b bheur] "
+				printf ("Usage: gtkboard \t[-qvhV]"
+						" [-g game] [-G file] [-f file] [-l logfile] [-d msec]"
+						" [-p XX] [-w wheur -b bheur]"
+						"\n"
 						"\n"
-						"\t-g\tname of the game\n"
-						"\t-G\tplugin file to load game from\n"
-						"\t-f\tfile to load game from\n"
-						"\t-l\tlog file to record game\n"
-						"\t-q\tdon't show board\n"
-						"\t-d\tdelay in milliseconds\n"
-						"\t-p\thuman or machine players. Each X must be 'h' or 'm'\n"
-						"\t-w\tname of heuristic function for white\n"
-						"\t-b\tname of heuristic function for black\n"
-						"\t-v\tbe verbose\n"
-						"\t-h\tprint this help\n"
+						"\t-g, --game\tname of the game\n"
+						"\t-G, --plugin\tplugin file to load game from\n"
+						"\t-f, --file\tfile to load game from\n"
+						"\t-l, --log\tlog file to record game\n"
+						"\t-q, --hide-board\tdon't show board\n"
+						"\t-d, --delay\tdelay in milliseconds\n"
+						"\t-p, --players\thuman or machine players. Each X must be 'h' or 'm'\n"
+						"\t-w, --w-heuristic\tname of heuristic function for white\n"
+						"\t-b, --b-heuristic\tname of heuristic function for black\n"
+						"\t-v, --verbose\tbe verbose\n"
+						"\t-V, --version\tprint version and exit\n"
+						"\t-h, --help\tprint this help and exit\n"
 					   );
 				exit (0);
 			default:
@@ -1199,7 +1224,7 @@ void html_help_gen_format (FILE *fout, g
 		perror (NULL);
 		exit(1);
 	}
-	fprintf (ftmp, string);
+	fprintf (ftmp, "%s", string);
 	fclose (ftmp);
 	fprintf (fout, "<h2> %s </h2>\n\n <pre>", title);
 	fflush (fout);
@@ -1304,8 +1329,7 @@ void html_help_gen ()
 {
 	int i;
 	char dirbuf[1024];
-	getcwd (dirbuf, 1024);
-	if (strcmp (basename (dirbuf), "games"))
+	if (getcwd (dirbuf, 1024) && strcmp (basename (dirbuf), "games"))
 	{
 		fprintf (stderr, "To generate html help, you must be in the \"games\" directory.\n");
 		exit (1);
@@ -1379,3 +1403,7 @@ int main (int argc, char **argv)
 	}
 	return 0;
 }
+
+// Local Variables:
+// tab-width: 4
+// End:
--- gtkboard-0.11pre0+cvs.2003.11.02.orig/src/wordtris.c
+++ gtkboard-0.11pre0+cvs.2003.11.02/src/wordtris.c
@@ -122,7 +122,7 @@ static char **wordtris_pixmaps [] =
 
 // TODO: change this so that we only need to specify pixmaps for individual squares
 
-static const int lava_xpm_header_size = 253+1;
+#define lava_xpm_header_size (253+1)
 static char * lava_xpm_header[] = 
 {
 "144 504 253 2",
@@ -569,7 +569,7 @@ static void wordtris_init ()
 		"\n"
 		"You get a point for every new word you make. You have a total of ten lives. You lose a life when a block falls to the bottom row. The game ends when you lose all your lives.";
 	game_doc_strategy = 
-		"Try to replace rarely occuring letters with more commonly occuring	letters\n";
+		"Try to replace rarely occurring letters with more commonly occurring letters\n";
 }
 
 static int wordtris_curx = 0, wordtris_cury = 0;
@@ -783,5 +783,6 @@ int wordtris_animate (Pos *pos, byte **m
 	return 1;
 }
 
-
-
+// Local Variables:
+// tab-width: 4
+// End:
