Try PST[pieceType][toSquare] - PST[pieceType][fromSquare]maksimKorzh wrote: ↑Sat Jan 09, 2021 4:11 pmHi PioPio wrote: ↑Sat Jan 09, 2021 1:14 amIf you take toSquare minus fromSquare you will get an improvement.maksimKorzh wrote: ↑Sat Jan 09, 2021 12:59 amNo, I tried only toSquare.
Interesting idea. Maybe I'll try it when get done with tuning.
Actually I'm getting more nodes traversed instead, here's the code:output (no PST ordering)Code: Select all
function addMove(moveList, move) { let moveScore = 0; let piece = board[getMoveSource(move)] if (getMoveCapture(move)) { moveScore = mvvLva[board[getMoveSource(move)] * 13 + board[getMoveTarget(move)]]; moveScore += 10000; } else { if (killerMoves[searchPly] == move) moveScore = 9000; else if (killerMoves[maxPly + searchPly] == move) moveScore = 8000; else { moveScore = historyMoves[board[getMoveSource(move)] * 128 + getMoveTarget(move)]; //let delta = (piece < 7) ? 1: 7; //moveScore += 3 * (pst[opening][piece - delta][getMoveTarget(move)] - pst[opening][piece - delta][getMoveSource(move)]) } } moveList.push({ move: move, score: moveScore }); }
output (PST ordering)Code: Select all
info score cp 26 depth 1 nodes 50 time 19 pv g1f3 wukong.js:1682 info score cp -22 depth 2 nodes 151 time 63 pv g1f3 g8f6 wukong.js:1682 info score cp 22 depth 3 nodes 775 time 181 pv g1f3 g8f6 b1c3 wukong.js:1682 info score cp -22 depth 4 nodes 1852 time 413 pv g1f3 g8f6 b1c3 b8c6 wukong.js:1682 info score cp 14 depth 5 nodes 6097 time 534 pv g1f3 g8f6 b1c3 b8c6 e2e4 wukong.js:1682 info score cp -22 depth 6 nodes 25513 time 1268 pv g1f3 g8f6 d2d4 b8c6 d4d5 c6b4 wukong.js:1694 bestmove g1f3
Did I do something wrong?Code: Select all
info score cp 26 depth 1 nodes 40 time 18 pv g1f3 wukong.js:1682 info score cp -22 depth 2 nodes 120 time 58 pv g1f3 g8f6 wukong.js:1682 info score cp 22 depth 3 nodes 726 time 189 pv g1f3 g8f6 b1c3 wukong.js:1682 info score cp -22 depth 4 nodes 1753 time 441 pv g1f3 g8f6 b1c3 b8c6 wukong.js:1682 info score cp 14 depth 5 nodes 5843 time 604 pv g1f3 g8f6 b1c3 b8c6 e2e4 wukong.js:1682 info score cp -22 depth 6 nodes 27827 time 1276 pv g1f3 g8f6 d2d4 b8c6 d4d5 c6b4 wukong.js:1694 bestmove g1f3
EDIT:
changed (fromSq - toSq) to abs(fromSq - toSq)
now in starting position have only a few more nodes with PST ordering and in position with lots of captures
have a slight improvement:
no PST orderingPST orderingCode: Select all
info score cp 36 depth 1 nodes 2960 time 277 pv e2a6 b4c3 wukong.js:1682 info score cp 36 depth 2 nodes 6033 time 432 pv e2a6 b4c3 wukong.js:1682 info score cp 22 depth 3 nodes 10262 time 501 pv e2a6 b4c3 d2c3 h3g2 f3g2 e6d5 wukong.js:1682 info score cp 22 depth 4 nodes 16621 time 615 pv e2a6 b4c3 d2c3 h3g2 f3g2 e6d5 wukong.js:1682 info score cp 9 depth 5 nodes 34325 time 898 pv e2a6 b4c3 d2c3 e6d5 e4d5 h3g2 f3g2 b6d5 wukong.js:1682 info score cp 9 depth 6 nodes 78751 time 1299 pv e2a6 b4c3 d2c3 e6d5 e4d5 h3g2 f3g2 b6d5 wukong.js:1694 bestmove e2a6
Code: Select all
info score cp 36 depth 1 nodes 2957 time 293 pv e2a6 b4c3 wukong.js:1682 info score cp 36 depth 2 nodes 6137 time 480 pv e2a6 b4c3 wukong.js:1682 info score cp 22 depth 3 nodes 10418 time 562 pv e2a6 b4c3 d2c3 h3g2 f3g2 e6d5 wukong.js:1682 info score cp 22 depth 4 nodes 16845 time 682 pv e2a6 b4c3 d2c3 h3g2 f3g2 e6d5 wukong.js:1682 info score cp 9 depth 5 nodes 34951 time 981 pv e2a6 b4c3 d2c3 e6d5 e4d5 h3g2 f3g2 b6d5 wukong.js:1682 info score cp 9 depth 6 nodes 78385 time 1427 pv e2a6 b4c3 d2c3 e6d5 e4d5 h3g2 f3g2 b6d5 wukong.js:1694 bestmove e2a6
The logic is simple. If you would only have PST evaluation in your engine the move scoring would perfectly sort the moves in the last level. Make sure it is toSquare - fromSquare and not the opposite.
You will also have to order the moves in descending order taking the moves with highest scores first.