justNo4b / Drofa

UCI chess engine
GNU General Public License v3.0
46 stars 7 forks source link

Possible problem (warning about missing PAWN switch)? #7

Closed rwbc closed 3 years ago

rwbc commented 3 years ago

Hello Alexander,

Today I have compiled Drofa again and noticed one warning, which sounds suspicious to me.

Guenther Simon@CAPPUCCINO MINGW64 ~/Drofa
$ make
mkdir obj
g++ -Wall -std=c++11 -O3 -march=native -flto -pthread -fno-exceptions -c -o obj/attacks.o src/attacks.cc
g++ -Wall -std=c++11 -O3 -march=native -flto -pthread -fno-exceptions -c -o obj/board.o src/board.cc
src/board.cc: In member function 'U64 Board::getMobilityForSquare(PieceType, Color, int, U64) const':
src/board.cc:74:10: warning: enumeration value 'PAWN' not handled in switch [-Wswitch]
   74 |   switch (pieceType) {
      |          ^

Looking at the code it seems you have a special case for PAWN in

U64 Board::getAttacksForSquare(PieceType pieceType, Color color, int square) const {
  // Special case for pawns
  if (pieceType == PAWN) {
    switch (color) {
      case WHITE: return _getWhitePawnAttacksForSquare(square);
      case BLACK: return _getBlackPawnAttacksForSquare(square);
    }

but not for 'getMobilityForSquare', is this intentional? I thought I let you better know. You can close this if you think it is no problem.

BTW this is the output for Drofa 2.08 dev from my slow hardware currently (startpos)

Drofa 2.0.8 by Rhys Rustad-Elliott and Litov Alexander (built Nov 30 2020 18:23:42)
uci
id name Drofa 2.0.8
id authors Rhys Rustad-Elliott and Alexander Litov

option name BookPath type string default book.bin
option name OwnBook type check default false
uciok
ucinewgame
isready
readyok
position startpos
go infinite
info depth 1 seldepth 1 nodes 51 score cp 97 nps 51000 time 1 pv e2e4
info depth 2 seldepth 2 nodes 202 score cp 0 nps 67000 time 3 pv e2e4 e7e5
info depth 3 seldepth 4 nodes 825 score cp 46 nps 137000 time 6 pv e2e3 d7d5 d2d4
info depth 4 seldepth 6 nodes 2421 score cp 25 nps 242000 time 10 pv e2e4 d7d5 f1b5 c8d7
info depth 5 seldepth 7 nodes 3863 score cp 53 nps 297000 time 13 pv e2e4 d7d5 e4d5 d8d5 d2d4
info depth 6 seldepth 8 nodes 7065 score cp 12 nps 392000 time 18 pv e2e4 d7d5 e4d5 d8d5 b1c3 d5d4
info depth 7 seldepth 10 nodes 15215 score cp 30 nps 524000 time 29 pv d2d4 d7d5 c1f4 e7e6 e2e3 f8b4 b1c3
info depth 8 seldepth 10 nodes 25336 score cp 15 nps 617000 time 41 pv d2d4 d7d5 c1f4 c8f5 e2e3 b8c6 g2g4 f5e4
info depth 9 seldepth 12 nodes 44668 score cp 23 nps 709000 time 63 pv d2d4 d7d5 c1f4 c8f5 e2e3 e7e6 f1d3 f8b4 b1c3
info depth 10 seldepth 13 nodes 87206 score cp 17 nps 800000 time 109 pv d2d4 d7d5 c1f4 c8f5 e2e3 e7e6 f1b5 b8c6 b1c3 f8d6
info depth 11 seldepth 15 nodes 155255 score cp 23 nps 848000 time 183 pv d2d4 d7d5 c1f4 c8f5 e2e3 e7e6 f1b5 c7c6 b5d3 f5d3 d1d3
info depth 12 seldepth 16 nodes 570968 score cp 32 nps 926000 time 616 pv e2e4 e7e6 d2d4 d7d5 e4e5 c7c5 b1c3 b8c6 c1e3 c8d7 g1f3 c5d4
info depth 13 seldepth 16 nodes 808439 score cp 36 nps 928000 time 871 pv e2e4 e7e6 d2d4 d7d5 e4e5 c7c5 b1c3 b8c6 c1e3 c8d7 d4c5 c6e5 g1f3
info depth 14 seldepth 18 nodes 1187955 score cp 43 nps 931000 time 1275 pv e2e4 e7e6 d2d4 d7d5 b1c3 d5e4 c3e4 b8c6 g1f3 g8f6 c1g5 f8e7 e4f6 e7f6
info depth 15 seldepth 18 nodes 1783713 score cp 31 nps 939000 time 1898 pv e2e4 e7e6 d2d4 d7d5 b1c3 d5e4 c3e4 b8c6 g1f3 g8f6 e4f6 d8f6 f1b5 c8d7 c1g5
info depth 16 seldepth 21 nodes 5492756 score cp 28 nps 930000 time 5905 pv e2e4 e7e5 d2d4 e5d4 d1d4 b8c6 d4c4 d7d6 b1c3 a7a6 g1f3 c8e6 c3d5 g8f6 f3d4 c6d4
justNo4b commented 3 years ago

Hello! I know that this issue exists, but i am still in progress of figuring out the most suited mobility code for me (ie what squares i want to be count, what pieces i want to count etc). In one of the later versions, when i reach some sort of conclusion, i`ll rewrite this part of the code accordingly and close this issue. Thanks again for giving Drofa some attention, it really motivates me, Alexander