コード例 #1
0
ファイル: stm.c プロジェクト: markkings/reversi
WERT newab(
  int player, 
  int al, int be, 
  int lastmove, 
  int lastval, 
  int  depth, 
  REAL diffsum
)
{
  int		i, ZugAnz, val0;
  PARTEI	nplayer;
  SFPOS		BestZug, move;
  WERT		value, lo_value, hi_value, max;
  KILLTAB	*Kill;
  SFPOS		*pl;
  BRETT		*pbr;
  DELTA		delta;
  uint4		ha;
  HASHEINTRAG	*ph;
  sint1		*pumg;
  static int 	zaehler = 0;
  ZUGMENGE	zm;
  REAL		P;


  if (depth > maxdepth) maxdepth = depth;

  val0 = AlphaBeta1(&zio, sdepth[depth]+depthinc, player, WERTMIN, WERTMAX,
		    ZUG_UNBEKANNT); 

  if (diffsum <= 0) return val0;

  P = EXPWERT(WERT_TO_REAL(val0))-EXPWERT(WERT_TO_REAL(lastval));

  if (P < 0) diffsum += P;

  pbr  = &zio.Brett;
  pumg = pbr->umg;


/* Spielfeld voll */

  if (pbr->SteinAnz == 64) return BewDiff(pbr, player);

#if 0
  {
    int maxval = WERTMIN;

  for (i=0; i <= pbr->LastIndex; i++) 
    if (Setzen(pbr, player, move=pbr->umgl[i].UPos, &delta)) {

      value = -zio.BewMitte(pbr, GEGNER(player));

    if (value > maxval) maxval = value;

      Zurueck(pbr, &delta);
    } 


  val0 = maxval + 10000;


  }
#endif



  ZM_LOESCHEN;

  ZugAnz = 0;

  BestZug  = ZUG_UNBEKANNT; 
  lo_value = WERTMIN; 
  hi_value = be;
  max      = al;


  nplayer = GEGNER(player);



#if HASH

/* war Stellung schon da? */


  ha = pbr->Hash1 & (HASHANZ-1);
  if (player == WHITE) ha = HASH_WHITE(ha);

  ph = &zio.hash.HashTab[ha];

  move = ph->BesterZug;

  if (ZUG(move) && LOCK_EQUAL(ph->Hash2, pbr->Hash2)) { TRY }

#endif


#if ECKEN_ZUERST

/* jetzt alle Eckenzüge */

  move = A1; TRY;
  move = H8; TRY;
  move = A8; TRY;
  move = H1; TRY;

#endif


  if (1) {

#if KILLER
  
/* Rest gemäß Killertabelle oder DefaultKill */

    if (ZUG(lastmove)) {

      if (player == BLACK) Kill = zio.killer.KillWHITE; 
      else 		   Kill = zio.killer.KillBLACK;

      pl = &Kill->Liste[lastmove][0];

    } else {

#endif

      pl = &zio.killer.DefaultKill[0];

#if KILLER

    }

#endif


    for (i=zio.killer.FreiAnz; i > 0; i--) {

      move = *pl++;
      TRY
    }


  } else {
コード例 #2
0
ファイル: KOORPAAR.CPP プロジェクト: hkaiser/TRiAS
CKoordPaar :: CKoordPaar( const char *txt )
{	Setzen( txt );
}	// Konstruktion