Back to index

gcompris  8.2.2
awele_utils.h
Go to the documentation of this file.
00001 /*
00002  * gcompris - awele.c Copyright (C) 2005 Frederic Mazzarol This program is
00003  * free software; you can redistribute it and/or modify it under the terms 
00004  * of the GNU General Public License as published by the Free Software
00005  * Foundation; either version 2 of the License, or (at your option) any
00006  * later version.  This program is distributed in the hope that it will
00007  * be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
00008  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00009  * General Public License for more details.  You should have received a
00010  * copy of the GNU General Public License along with this program; if not, 
00011  * write to the Free Software Foundation, Inc., 59 Temple Place, Suite
00012  * 330, Boston, MA 02111-1307 USA 
00013  */
00014 
00015 #include "gcompris/gcompris.h"
00016 
00017 #ifndef TRUE
00018 #define TRUE 1
00019 #define FALSE 0
00020 #endif
00021 
00022 #define NBHOLE 12           // Nombre de cases de l'awele
00023 #define NBTOTALBEAN 48             // Nombre de graines totale de l'awale
00024 #define NBPLAYER 2          // Nombre de joueur
00025 #define HUMAN 0                    // Numero du joueur Humain (camp Sud)
00026 #define COMPUTER 1          // Numero du joueur virtuel (camp nord)
00027 #define START_HUMAN 0              // Premiere case du camp Sud
00028 #define START_COMPUTER 6    // Premiere Case du camp Nord
00029 #define END_HUMAN 5         // Derniere case du camp Sud
00030 #define END_COMPUTER 11            // Derniere case du camp Nord
00031 #define NBBEANSPERHOLE 4    // Nbre de graine par case en debut de partie
00032 #define HALF_SIZE 6         // nbre de case dans un camp
00033 #define DEF_DEPTH 3         // Profondeur de recherche de l'algo minimax
00034 #define INFINI 50           // Infini pour alphaBeta
00035 
00036 /*
00037 *      Code erreur retour des fonctions de test mouvements
00038 */
00039 #define EMPTY_HOLE 51
00040 #define HUNGRY 52
00041 #define GAMEOVER 53
00042 #define NOT_GAMEOVER 54
00043 
00044 #define MSG_FAMINE "declenche une famine"
00045 #define MSG_AREA "clic dans ton camp"
00046 #define MSG_EMPTYHOLE "Cette case est vide, selectionne une autre case"
00047 
00048 
00052 typedef struct {
00053   short int board[NBHOLE];
00054   short int CapturedBeans[NBPLAYER];
00055   short int player;
00056   short int last_play;
00057 } AWALE;
00058 
00059 
00060 
00061 
00062 
00066 gboolean diedOfHunger(AWALE *aw);
00067 AWALE *moveAwale(short int hole, AWALE * aw);
00068 short int think(AWALE * a, short int level);
00069 short int randplay(AWALE * a);
00070 
00071 short int switch_player(short int player);
00072 
00073 short int threatenDelta(AWALE * aw);
00074 short int moveDelta(AWALE * aw);
00075 gint eval(GNode *node);