Back to index

gcompris  8.2.2
gcompris_alphabeta.h
Go to the documentation of this file.
00001 /* gcompris - gcompris_alphabeta.h
00002  *
00003  * Time-stamp: <2006/08/28 21:20:56 bruno>
00004  *
00005  * Copyright (C) 2000 Bruno Coudoin
00006  *
00007  * This program is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2 of the License, or
00010  * (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00020  */
00021 
00022 #ifndef _GOMPRIS_ALPHABETA_H_
00023 #define _GOMPRIS_ALPHABETA_H_
00024 
00025 #include "gcompris.h"
00026 
00027 /* gc_alphabeta returns the best value of evaluation functions */
00028 /* set the bestChild to the index of child with this value */
00029 /* maximize : TRUE if depth is maximize one, neither FALSE. */
00030 /* treeGame : pointer on game to pass to others functions, */
00031 /* bestChild : pointer on GList wich will contains list of indexes fo best plays. */
00032 /* isLeaf : TRUE if game correspond to a Leaf of Tree. */
00033 /* firstChild : return pointer on first  child of a node. */
00034 /* nextSibling : return pointer on next sibling of a node. */
00035 /* heuristic : evaluation function of game. */
00036 /* depth is max depth of recursion */
00037 
00038 typedef gint         (*EvalFunction)              (gpointer treeGame); 
00039 typedef gboolean     (*LeafFunction)              (gpointer treeGame); 
00040 typedef gpointer     (*FirstChildGameFunction)    (gpointer treeGame); 
00041 typedef gpointer     (*NextSiblingGameFunction)     (gpointer treeGame); 
00042 
00043 gint gc_alphabeta (gboolean maximize,
00044                  gpointer treeGame,
00045                  EvalFunction heuristic,
00046                  gint *bestChild,
00047                  FirstChildGameFunction firstChild,
00048                  NextSiblingGameFunction nextSibling,
00049                  gint alpha,
00050                  gint beta,
00051                  gint depth
00052                  );
00053 
00054 #endif
00055 
00056 /* Local Variables: */
00057 /* mode:c */
00058 /* eval:(load-library "time-stamp") */
00059 /* eval:(make-local-variable 'write-file-hooks) */
00060 /* eval:(add-hook 'write-file-hooks 'time-stamp) */
00061 /* eval:(setq time-stamp-format '(time-stamp-yyyy/mm/dd time-stamp-hh:mm:ss user-login-name)) */
00062 /* End: */