Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Uri's ETC

Author: rasjid chan

Date: 11:05:02 03/24/04

Go up one level in this thread



My term "cutoff" is only pseudo C.
So the following call is just like my search()
except for the purpose of checking if the move need to be searched.
Maybe ok for now. I'll check later if buggy.

Tahnks
Rasjid



int hash_cutoff_before_make(int alpha, int beta, int depth, int check){
	int j, q;
	long m;
	depth += fExt / 60;
	q = 0;
	++ply;

/*
	  return -INFI means no cutoff, otherwise means makemove will fail-low / fail-
high
      P_MATE == winning mate score
      M_MATE == losing mate score

  */

	if (depth <= 0 || depth >= MAX_DEPTH || ply >= MAX_PLY - 2){
		if (beta <= M_MATE && !check){
			return mtl[side] - mtl[xside] + ply--;
		}
		if (alpha >= P_MATE){
			--ply;
			return alpha;
		}
		q = 1;//means will probe in qsearch()
	}


	if ((hash & hash_mask) < hash_record)
	phT = hashT + (hash & hash_mask); //ptr to hash TT
	else{
		assert((hash & hash_mask)  - hash_record_less >= 0);
		phT = hashT + (hash & hash_mask) - hash_record_less;
	}

	if (probeHash){
		//ep / cstl ok
		side ^= -1;
		if ((m = hashMove()) == 0xffffL){
			side ^= -1;
			--ply;
			return -INFI;
			//goto LOST_RIGHTS for ep / cstl;
		}
		side ^= -1;
		++hashHit;
		j = hashValue;
		assert(j > -INFI && j < INFI);
		assert(hashDepth >= 0 && hashDepth <= MAX_PLY);
		assert(j >= P_MATE ? j <= INFI - ply - 1:1);
		assert(j <= M_MATE ? j >= -INFI + ply:1);

		if (q || hashDepth)
		switch(hashType){
		case tEX:
			if (hashDepth >= depth
			|| j <= M_MATE || (j >= P_MATE && alpha < P_MATE)){
			if (m){
			 pv[ply][ply].u = m;
			 pv_length[ply] = ply + 1;
			}
			--ply;
			return j;
		}
			break;
		case tLB:
			if ((j >= beta && (q || hashDepth >= depth))
				|| (j >= P_MATE && alpha < P_MATE)){
				if (m){
					pv[ply][ply].u = m;
					pv_length[ply] = ply + 1;
				}
				--ply;
				return j;
			}
			break;
		case tUB:
			if (hashDepth >= depth){
				if (j <= alpha){
					--ply;
					return j;
				}
			}
			break;
		case tSM:// all move searched
			if (m){//may have move
				pv[ply][ply].u = m;//valid
				pv_length[ply] = ply + 1;
			}
			//cannot set draw, only for rept3 / fifty
			--ply;
			return 0;
		}
	}

	--ply;
	return -INFI; // means move had to be searched
}



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.