File: eval.h

package info (click to toggle)
gnubg 0.90-3
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 30,800 kB
  • ctags: 8,224
  • sloc: ansic: 92,884; xml: 13,338; sh: 9,675; makefile: 425; python: 392; yacc: 295; sql: 237; lex: 220; php: 102; cs: 81; awk: 25; sed: 16
file content (623 lines) | stat: -rw-r--r-- 19,321 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
/*
 * eval.h
 *
 * by Gary Wong <gary@cs.arizona.edu>, 1998-2001.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of version 3 or later of the GNU General Public License as
 * published by the Free Software Foundation.
 *
 * 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-1307  USA
 *
 * $Id: eval.h,v 1.153 2008/03/12 22:56:33 Superfly_Jon Exp $
 */

#ifndef _EVAL_H_
#define _EVAL_H_

#include "dice.h"
#include "bearoff.h"
#include "neuralnet.h"

#define WEIGHTS_VERSION "0.15"
#define WEIGHTS_VERSION_BINARY 0.15f
#define WEIGHTS_MAGIC_BINARY 472.3782f

#define NUM_OUTPUTS 5
#define NUM_CUBEFUL_OUTPUTS 4
#define MAX_ROLLOUT_CUBEINFO 16
#define NUM_ROLLOUT_OUTPUTS 7

#define BETA_HIDDEN 0.1f
#define BETA_OUTPUT 1.0f

#define OUTPUT_WIN 0
#define OUTPUT_WINGAMMON 1
#define OUTPUT_WINBACKGAMMON 2
#define OUTPUT_LOSEGAMMON 3
#define OUTPUT_LOSEBACKGAMMON 4

#define OUTPUT_EQUITY 5 /* NB: neural nets do not output equity, only
			   rollouts do. */
#define OUTPUT_CUBEFUL_EQUITY 6

/* Cubeful evalutions */
typedef enum {
  OUTPUT_OPTIMAL = 0,
  OUTPUT_NODOUBLE ,
  OUTPUT_TAKE, 
  OUTPUT_DROP,
  N_CUBEFUL_OUTPUTS
} CubefulOutputs;

/* A trivial upper bound on the number of (complete or incomplete)
 * legal moves of a single roll: if all 15 chequers are spread out,
 * then there are 18 C 4 + 17 C 3 + 16 C 2 + 15 C 1 = 3875
 * combinations in which a roll of 11 could be played (up to 4 choices from
 * 15 chequers, and a chequer may be chosen more than once).  The true
 * bound will be lower than this (because there are only 26 points,
 * some plays of 15 chequers must "overlap" and map to the same
 * resulting position), but that would be more difficult to
 * compute. */
#define MAX_INCOMPLETE_MOVES 3875
#define MAX_MOVES 3060

/* If this is increased, the nSearchCandidates member in struct _evalcontext
   must also be enlarged. */
#define MAX_SEARCH_CANDIDATES 127


typedef struct movefilter_s {
  int   Accept;    /* always allow this many moves. 0 means don't use this */
		   /* level, since at least 1 is needed when used. */
  int   Extra;     /* and add up to this many more... */
  float Threshold; /* ...if they are within this equity difference */
} movefilter;

/* we'll have filters for 1..4 ply evaluation */
#define MAX_FILTER_PLIES	4
extern movefilter defaultFilters[MAX_FILTER_PLIES][MAX_FILTER_PLIES];

typedef struct {
    /* FIXME expand this... e.g. different settings for different position
       classes */
    unsigned int fCubeful : 1; /* cubeful evaluation */
    unsigned int nPlies   : 3;
#if defined( REDUCTION_CODE )
    unsigned int nReduced : 3; /* this will need to be expanded if we add
				  support for nReduced != 3 */
#else
    unsigned int fUsePrune : 1;
#endif
    unsigned int fDeterministic : 1;
    float        rNoise;       /* standard deviation */
} evalcontext;

/* identifies the format of evaluation info in .sgf files
   early (pre extending rollouts) had no version numbers
   extendable rollouts have a version number of 1
   with pruning nets, we have two possibilities - reduction could still
   be enabled (version = 2) or, given the speedup and performance 
   improvements, I assume we will drop reduction entirely. (ver = 3 or more)
   When presented with an .sgf file, gnubg will attempt to work out what
   data is present in the file based on the version number
*/

#if defined( REDUCTION_CODE )
#define SGF_FORMAT_VER 2
#else
#define SGF_FORMAT_VER 3
#endif

typedef struct {

  evalcontext aecCube[ 2 ], aecChequer [ 2 ]; /* evaluation parameters */
  evalcontext aecCubeLate[ 2 ], aecChequerLate [ 2 ]; /* ... for later moves */
  evalcontext aecCubeTrunc, aecChequerTrunc; /* ... at truncation point */
  movefilter aaamfChequer[ 2 ][ MAX_FILTER_PLIES ][ MAX_FILTER_PLIES ];
  movefilter aaamfLate[ 2 ][ MAX_FILTER_PLIES ][ MAX_FILTER_PLIES ];
  
  unsigned int fCubeful : 1; /* Cubeful rollout */
  unsigned int fVarRedn : 1; /* variance reduction */
  unsigned int fInitial: 1;  /* roll out as opening position */
  unsigned int fRotate : 1;  /* quasi-random dice */
  unsigned int fTruncBearoff2 : 1; /* cubeless rollout: trunc at BEAROFF2 */
  unsigned int fTruncBearoffOS: 1; /* cubeless rollout: trunc at BEAROFF_OS */
  unsigned int fLateEvals : 1; /* enable different evals for later moves */
  unsigned int fDoTruncate : 1; /* enable truncated rollouts */
  unsigned int fStopOnSTD : 1;    /* stop when std's are small enough */
  unsigned int fStopOnJsd : 1;
  unsigned int fStopMoveOnJsd : 1;    /* stop multi-line rollout when jsd
					 is small enough */
  unsigned short nTruncate; /* truncation */
  unsigned int   nTrials; /* number of rollouts */
  unsigned short nLate; /* switch evaluations on move nLate of game */
  rng rngRollout;
  unsigned long nSeed;
  unsigned int nMinimumGames; /* but always do at least this many */
  double       rStdLimit;     /* stop when abs( value / std ) < this */
  unsigned int nMinimumJsdGames;
  double       rJsdLimit;
  unsigned int nGamesDone;
  int          nSkip;
} rolloutcontext;


typedef struct {
  float  rEquity;
  float  rJSD;
  int    nOrder;
  int	 nRank;
} jsdinfo;

typedef enum {
  EVAL_NONE, EVAL_EVAL, EVAL_ROLLOUT
} evaltype;


/* enumeration of variations of backgammon
   (starting position and/or special rules) */

typedef enum {
  VARIATION_STANDARD,      /* standard backgammon */
  VARIATION_NACKGAMMON,    /* standard backgammon with nackgammon starting
                            position */
  VARIATION_HYPERGAMMON_1, /* 1-chequer hypergammon */
  VARIATION_HYPERGAMMON_2, /* 2-chequer hypergammon */
  VARIATION_HYPERGAMMON_3, /* 3-chequer hypergammon */
  NUM_VARIATIONS
} bgvariation;

extern bgvariation bgvDefault;

extern int anChequers[ NUM_VARIATIONS ];
extern const char *aszVariations[ NUM_VARIATIONS ];
extern const char *aszVariationCommands[ NUM_VARIATIONS ];


/*
 * Cubeinfo contains the information necesary for evaluation
 * of a position.
 * These structs are placed here so that the move struct can be defined
 */

typedef struct {
    /*
     * nCube: the current value of the cube,
     * fCubeOwner: the owner of the cube,
     * fMove: the player for which we are
     *        calculating equity for,
     * fCrawford, fJacoby, fBeavers: optional rules in effect,
     * arGammonPrice: the gammon prices;
     *   [ 0 ] = gammon price for player 0,
     *   [ 1 ] = gammon price for player 1,
     *   [ 2 ] = backgammon price for player 0,
     *   [ 3 ] = backgammon price for player 1.
     *
     */
    int nCube, fCubeOwner, fMove, nMatchTo, anScore[ 2 ], fCrawford, fJacoby,
	fBeavers;
    float arGammonPrice[ 4 ];
    bgvariation bgv;
} cubeinfo;


typedef struct {
  evaltype et;
  evalcontext ec;
  rolloutcontext rc;

} evalsetup;

typedef enum  {
  DOUBLE_TAKE, DOUBLE_PASS, NODOUBLE_TAKE, TOOGOOD_TAKE, TOOGOOD_PASS,
  DOUBLE_BEAVER, NODOUBLE_BEAVER,
  REDOUBLE_TAKE, REDOUBLE_PASS, NO_REDOUBLE_TAKE,
  TOOGOODRE_TAKE, TOOGOODRE_PASS,
  NO_REDOUBLE_BEAVER,
  NODOUBLE_DEADCUBE,     /* cube is dead (match play only) */
  NO_REDOUBLE_DEADCUBE,     /* cube is dead (match play only) */
  NOT_AVAILABLE, /* Cube not available */
  OPTIONAL_DOUBLE_TAKE,
  OPTIONAL_REDOUBLE_TAKE,
  OPTIONAL_DOUBLE_BEAVER,
  OPTIONAL_DOUBLE_PASS,
  OPTIONAL_REDOUBLE_PASS
} cubedecision;

typedef enum {
  DT_NORMAL,
  DT_BEAVER,
  DT_RACCOON,
  NUM_DOUBLE_TYPES
} doubletype;

typedef enum {
  TT_NA,
  TT_NORMAL,
  TT_BEAVER
} taketype;

extern const char* aszDoubleTypes[ NUM_DOUBLE_TYPES ];


/*
 * prefined settings
 */

#define NUM_SETTINGS            8
#define SETTINGS_GRANDMASTER    7
#define SETTINGS_SUPREMO        6
#define SETTINGS_WORLDCLASS     5
#define SETTINGS_ADVANCED       4
#define SETTINGS_EXPERT         3
#define SETTINGS_INTERMEDIATE   2
#define SETTINGS_NOVICE         1
#define SETTINGS_BEGINNER       0

extern evalcontext aecSettings[ NUM_SETTINGS  ];
extern int aiSettingsMoveFilter[ NUM_SETTINGS ];
extern const char *aszSettings[ NUM_SETTINGS ];


#define NUM_MOVEFILTER_SETTINGS 5

extern const char *aszMoveFilterSettings[ NUM_MOVEFILTER_SETTINGS ];
extern movefilter aaamfMoveFilterSettings[ NUM_MOVEFILTER_SETTINGS ][ MAX_FILTER_PLIES ][ MAX_FILTER_PLIES ];

typedef struct {
  int anMove[ 8 ];
  unsigned char auch[ 10 ];
  unsigned int cMoves, cPips;
  /* scores for this move */
  float rScore, rScore2; 
  /* evaluation for this move */
  float arEvalMove[ NUM_ROLLOUT_OUTPUTS ];
  float arEvalStdDev[ NUM_ROLLOUT_OUTPUTS ];
  evalsetup esMove;
} move;


extern int fInterrupt;
extern cubeinfo ciCubeless;
extern const char *aszEvalType[ (int)EVAL_ROLLOUT + 1 ];
extern int fEgyptian;

extern bearoffcontext *pbc1;
extern bearoffcontext *pbc2;
extern bearoffcontext *pbcOS;
extern bearoffcontext *pbcTS;
extern bearoffcontext *apbcHyper[ 3 ];

typedef struct {
    unsigned int cMoves; /* and current move when building list */
    unsigned int cMaxMoves, cMaxPips;
    int iMoveBest;
    float rBestScore;
    move* amMoves;
} movelist;

/* cube efficiencies */

extern float rOSCubeX;
extern float rRaceFactorX;
extern float rRaceCoefficientX;
extern float rRaceMax;
extern float rRaceMin;
extern float rCrashedX;
extern float rContactX;

/* position classes */

typedef enum  {
    CLASS_OVER = 0,     /* Game already finished */
    CLASS_HYPERGAMMON1, /* hypergammon with 1 chequers */
    CLASS_HYPERGAMMON2, /* hypergammon with 2 chequers */
    CLASS_HYPERGAMMON3, /* hypergammon with 3 chequers */
    CLASS_BEAROFF2,     /* Two-sided bearoff database (in memory) */
    CLASS_BEAROFF_TS,   /* Two-sided bearoff database (on disk) */
    CLASS_BEAROFF1,     /* One-sided bearoff database (in memory) */
    CLASS_BEAROFF_OS,   /* One-sided bearoff database /on disk) */
    CLASS_RACE,         /* Race neural network */
    CLASS_CRASHED,      /* Contact, one side has less than 7 active checkers */
    CLASS_CONTACT       /* Contact neural network */
} positionclass;

#define N_CLASSES (CLASS_CONTACT + 1)

#define CLASS_PERFECT CLASS_BEAROFF_TS

#define CFMONEY(arEquity,pci) \
   ( ( (pci)->fCubeOwner == -1 ) ? arEquity[ 2 ] : \
   ( ( (pci)->fCubeOwner == (pci)->fMove ) ? arEquity[ 1 ] : arEquity[ 3 ] ) )

#define CFHYPER(arEquity,pci) \
   ( ( (pci)->fCubeOwner == -1 ) ? \
     ( ( (pci)->fJacoby ) ? arEquity[ 2 ] : arEquity[ 1 ] ) : \
     ( ( (pci)->fCubeOwner == (pci)->fMove ) ? arEquity[ 0 ] : arEquity[ 3 ] ) )

extern void EvalInitialise( char *szWeights, char *szWeightsBinary,
		int fNoBearoff, void (*pfProgress)( unsigned int ) );

extern int EvalShutdown( void );

extern void EvalStatus( char *szOutput );

extern int EvalNewWeights( int nSize );

extern int 
EvalSave( const char *szWeights );

extern int 
EvaluatePosition( NNState *nnStates, const TanBoard anBoard, float arOutput[],
                  const cubeinfo* pci, const evalcontext* pec );

extern void
InvertEvaluationR ( float ar[ NUM_ROLLOUT_OUTPUTS], const cubeinfo* pci);

extern void 
InvertEvaluation( float ar[ NUM_OUTPUTS ] );

extern void 
InvertEvaluationCf( float ar[ 4 ] );

extern 
int FindBestMove( int anMove[ 8 ], int nDice0, int nDice1,
                  TanBoard anBoard, cubeinfo *pci,
                  evalcontext *pec,
                  movefilter aamf[ MAX_FILTER_PLIES ][ MAX_FILTER_PLIES ] ); 

extern int 
FindnSaveBestMoves( movelist *pml,
                    int nDice0, int nDice1, const TanBoard anBoard,
                    unsigned char *auchMove, const float rThr,
                    const cubeinfo* pci, const evalcontext* pec,
                    movefilter aamf[ MAX_FILTER_PLIES ][ MAX_FILTER_PLIES ] );

extern void
PipCount( const TanBoard anBoard, unsigned int anPips[ 2 ] );

extern int 
ThorpCount( const TanBoard anBoard, int *pnLeader, float *adjusted, int *pnTrailer );

extern int
KeithCount( const TanBoard anBoard, int pn[2]);

extern int 
DumpPosition( const TanBoard anBoard, char *szOutput,
              const evalcontext* pec, cubeinfo* pci, int fOutputMWC,
	      int fOutputWinPC, int fOutputInvert, const char *szMatchID );

extern void 
SwapSides( TanBoard anBoard );

extern int 
GameStatus( const TanBoard anBoard, const bgvariation bgv );

extern void
EvalCacheFlush(void);

extern int 
EvalCacheResize( unsigned int cNew );

extern int 
EvalCacheStats( unsigned int *pcUsed, unsigned int *pcSize, unsigned int *pcLookup, unsigned int *pcHit );

extern int 
GenerateMoves( movelist *pml, const TanBoard anBoard,
               int n0, int n1, int fPartial );

extern int 
ApplyMove( TanBoard anBoard, const int anMove[ 8 ],
           const int fCheckLegal );

extern positionclass 
ClassifyPosition( const TanBoard anBoard, const bgvariation bgv );

/* internal use only */
extern int EvalBearoff1Full( const TanBoard anBoard,
                             float arOutput[] );

extern float
Utility( float ar[ NUM_OUTPUTS ], const cubeinfo* pci );

extern float
UtilityME( float ar[ NUM_OUTPUTS ], const cubeinfo *pci );


extern int 
SetCubeInfoMoney( cubeinfo *pci, const int nCube, const int fCubeOwner,
                  const int fMove, const int fJacoby, const int fBeavers,
                  const bgvariation bgv );

extern int 
SetCubeInfoMatch( cubeinfo *pci, const int nCube, const int fCubeOwner,
                  const int fMove, const int nMatchTo, const int anScore[ 2 ],
                  const int fCrawford, const bgvariation bgv );

extern int 
SetCubeInfo ( cubeinfo *pci, const int nCube, const int fCubeOwner, 
              const int fMove, const int nMatchTo, const int anScore[ 2 ], 
              const int fCrawford, const int fJacoby, const int fBeavers, 
              const bgvariation bgv );
 
extern void 
swap_us( unsigned int *p0, unsigned int *p1 );

extern void 
swap( int *p0, int *p1 );

extern void 
SanityCheck( const TanBoard anBoard, float arOutput[] );

extern int
EvalBearoff1( const TanBoard anBoard, float arOutput[], 
              const bgvariation bgv, NNState *nnStates );

extern int
EvalOver( const TanBoard anBoard, float arOutput[], const bgvariation bgv, NNState *nnStates );

extern float
KleinmanCount (int nPipOnRoll, int nPipNotOnRoll);

extern int
GetDPEq ( int *pfCube, float *prDPEq, const cubeinfo *pci );

extern float
mwc2eq ( const float rMwc, const cubeinfo *ci );

extern float
eq2mwc ( const float rEq, const cubeinfo *ci );
 
extern float
se_mwc2eq ( const float rMwc, const cubeinfo *ci );

extern float
se_eq2mwc ( const float rEq, const cubeinfo *ci );
 
extern char 
*FormatEval ( char *sz, evalsetup *pes );

extern cubedecision
FindCubeDecision ( float arDouble[],
                   float aarOutput[][ NUM_ROLLOUT_OUTPUTS ],
		   const cubeinfo *pci );

extern int
GeneralCubeDecisionE ( float aarOutput[ 2 ][ NUM_ROLLOUT_OUTPUTS ],
                       const TanBoard anBoard,
                       const cubeinfo* pci, const evalcontext* pec,
		       const evalsetup* pes );

extern int
GeneralEvaluationE ( float arOutput [ NUM_ROLLOUT_OUTPUTS ],
                     const TanBoard anBoard,
                     const cubeinfo* pci, const evalcontext* pec );

extern int
GeneralEvaluationEPlied ( NNState *nnStates, float arOutput [ NUM_ROLLOUT_OUTPUTS ],
                          const TanBoard anBoard,
                          const cubeinfo* pci, const evalcontext* pec,
			  int nPlies );

extern int 
EvaluatePositionCubeful3( NNState *nnStates, const TanBoard anBoard,
                          float arOutput[ NUM_OUTPUTS ],
                          float arCubeful[],
                          const cubeinfo aciCubePos[], int cci, 
                          const cubeinfo* pciMove, const evalcontext* pec,
			  int nPlies, int fTop );

extern int 
GeneralEvaluationEPliedCubeful ( NNState *nnStates, float arOutput [ NUM_ROLLOUT_OUTPUTS ],
                                 const TanBoard anBoard,
                                 const cubeinfo* pci, const evalcontext* pec,
                                 int nPlies );
extern int
cmp_evalsetup ( const evalsetup *pes1, const evalsetup *pes2 );

extern int
cmp_evalcontext ( const evalcontext *pec1, const evalcontext *pec2 );

extern int
cmp_rolloutcontext ( const rolloutcontext *prc1, const rolloutcontext *prc2 );

extern char 
*GetCubeRecommendation ( const cubedecision cd );

extern cubedecision
FindBestCubeDecision ( float arDouble[], 
                       float aarOutput[ 2 ][ NUM_ROLLOUT_OUTPUTS ], 
                       const cubeinfo *pci );

extern int
getCurrentGammonRates ( float aarRates[ 2 ][ 2 ], 
                        float arOutput[], 
                        const TanBoard anBoard,
                        cubeinfo *pci,
                        evalcontext *pec );

extern void
calculate_gammon_rates( float aarRates[ 2 ][ 2 ],
                        float arOutput[],
                        cubeinfo *pci );

extern void
getMoneyPoints ( float aaarPoints[ 2 ][ 7 ][ 2 ],
                 const int fJacoby, const int fBeavers,
                 float aarRates[ 2 ][ 2 ] );

extern void
getMatchPoints ( float aaarPoints[ 2 ][ 4 ][ 2 ],
                 int afAutoRedouble[ 2 ],
                 int afDead[ 2 ],
                 cubeinfo *pci,
                 float aarRates[ 2 ][ 2 ] );

extern void
getCubeDecisionOrdering ( int aiOrder[ 3 ],
                          float arDouble[ 4 ], 
                          float aarOutput[ 2 ][ NUM_ROLLOUT_OUTPUTS ],
                          const cubeinfo* pci );

extern float
getPercent ( const cubedecision cd,
             const float arDouble[] );

extern void
RefreshMoveList ( movelist *pml, int *ai );

extern int 
ScoreMove( NNState *nnStates, move *pm, const cubeinfo* pci, const evalcontext* pec, int nPlies );

extern void
CopyMoveList ( movelist *pmlDest, const movelist *pmlSrc );

extern int
isCloseCubedecision ( const float arDouble[] );

extern int
isMissedDouble ( float arDouble[], 
                 float aarOutput[ 2 ][ NUM_ROLLOUT_OUTPUTS ], 
                 const int fDouble, 
                 const cubeinfo *pci );

extern unsigned int
locateMove ( const TanBoard anBoard, 
             const int anMove[ 8 ], const movelist *pml );

extern int
MoveKey ( const TanBoard anBoard, const int anMove[ 8 ], 
          unsigned char auch[ 10 ] );

extern int
equal_movefilter ( const int i, 
                   movefilter amf1[ MAX_FILTER_PLIES ],
                   movefilter amf2[ MAX_FILTER_PLIES ] );

extern int
equal_movefilters ( movefilter aamf1[ MAX_FILTER_PLIES ][ MAX_FILTER_PLIES ],
                    movefilter aamf2[ MAX_FILTER_PLIES ][ MAX_FILTER_PLIES ] );


extern doubletype
DoubleType ( const int fDoubled, const int fMove, const int fTurn );

extern int
PerfectCubeful ( bearoffcontext *pbc, 
                 const TanBoard anBoard, float arEquity[] );

extern void
baseInputs(const TanBoard anBoard, float arInput[]);

extern void 
CalculateRaceInputs(const TanBoard anBoard, float inputs[]);

#endif