Skip to content

Commit

Permalink
clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
tryingsomestuff committed Mar 31, 2020
1 parent 65882da commit 63086de
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
15 changes: 10 additions & 5 deletions Source/material.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,11 +299,16 @@ namespace MaterialHash { // idea from Gull
}

void updateMaterialOther(Position & p){
p.mat[Co_White][M_M] = p.mat[Co_White][M_q] + p.mat[Co_White][M_r]; p.mat[Co_Black][M_M] = p.mat[Co_Black][M_q] + p.mat[Co_Black][M_r];
p.mat[Co_White][M_m] = p.mat[Co_White][M_b] + p.mat[Co_White][M_n]; p.mat[Co_Black][M_m] = p.mat[Co_Black][M_b] + p.mat[Co_Black][M_n];
p.mat[Co_White][M_t] = p.mat[Co_White][M_M] + p.mat[Co_White][M_m]; p.mat[Co_Black][M_t] = p.mat[Co_Black][M_M] + p.mat[Co_Black][M_m];
p.mat[Co_White][M_bl] = (unsigned char)countBit(p.whiteBishop()&whiteSquare); p.mat[Co_White][M_bd] = (unsigned char)countBit(p.whiteBishop()&blackSquare);
p.mat[Co_Black][M_bl] = (unsigned char)countBit(p.blackBishop()&whiteSquare); p.mat[Co_Black][M_bd] = (unsigned char)countBit(p.blackBishop()&blackSquare);
p.mat[Co_White][M_M] = p.mat[Co_White][M_q] + p.mat[Co_White][M_r];
p.mat[Co_Black][M_M] = p.mat[Co_Black][M_q] + p.mat[Co_Black][M_r];
p.mat[Co_White][M_m] = p.mat[Co_White][M_b] + p.mat[Co_White][M_n];
p.mat[Co_Black][M_m] = p.mat[Co_Black][M_b] + p.mat[Co_Black][M_n];
p.mat[Co_White][M_t] = p.mat[Co_White][M_M] + p.mat[Co_White][M_m];
p.mat[Co_Black][M_t] = p.mat[Co_Black][M_M] + p.mat[Co_Black][M_m];
p.mat[Co_White][M_bl] = (unsigned char)countBit(p.whiteBishop()&whiteSquare);
p.mat[Co_White][M_bd] = (unsigned char)countBit(p.whiteBishop()&blackSquare);
p.mat[Co_Black][M_bl] = (unsigned char)countBit(p.blackBishop()&whiteSquare);
p.mat[Co_Black][M_bd] = (unsigned char)countBit(p.blackBishop()&blackSquare);
}

void initMaterial(Position & p){ // M_p .. M_k is the same as P_wp .. P_wk
Expand Down
2 changes: 2 additions & 0 deletions Source/moveGen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ void movePiece(Position & p, Square from, Square to, Piece fromP, Piece toP, boo

template < Color c>
inline void movePieceCastle(Position & p, CastlingTypes ct, Square kingDest, Square rookDest){
START_TIMER
const Piece pk = c==Co_White?P_wk:P_bk;
const Piece pr = c==Co_White?P_wr:P_br;
const CastlingRights ks = c==Co_White?C_wks:C_bks;
Expand All @@ -123,6 +124,7 @@ inline void movePieceCastle(Position & p, CastlingTypes ct, Square kingDest, Squ
if (p.castling & qs) p.h ^= Zobrist::ZT[sqs][13];
if (p.castling & ks) p.h ^= Zobrist::ZT[sks][13];
p.castling &= ~(ks | qs);
STOP_AND_SUM_TIMER(MovePiece)
}

void applyNull(Searcher & context, Position & pN);
Expand Down

0 comments on commit 63086de

Please sign in to comment.