//tim mot trang thai (the co) trong Transposition Table bang cach dung Key tinh tu ham bam public bool LookUp(Board brd, out int eval, out int depth, out int type) { ///* //tinh khoa hash cho brd int key = Math.Abs(brd.HashKey() % SIZE); TranspositionEntry entry = Table[key]; //kiem tra xem entry nay co rong hay khong if (entry.type == -1) { eval = 0; depth = 0; type = -1; return(false); } //kiem tra luot 2 - tranh dung do if (entry.theLock != brd.HashLock()) { eval = 0; depth = 0; type = -1; return(false); } //da tim dung entry tuong ung, copy du lieu tuong ung eval = entry.eval; depth = entry.depth; type = entry.type; return(true); //*/ }
public TranspositionTable() { Table = new TranspositionEntry[SIZE]; for (int i = 0; i < SIZE; i++) { Table[i] = new TranspositionEntry(); } }