clean up code
**Non functional changes:**
in search.cpp:
- an unnecessary pair of parenthesis in the IIR condition has been removed.
- refactored the stalemate trap detection code
in movepick.cpp:
- use the variables `from`, `to`, `piece`, `pieceType` and `capturedPiece` instead of calling the same functions multiple times in `MovePicker::score()`.
- rename `MovePicker::other_piece_types_mobile()`.
**Functional changes:**
- make sure the processed move is always legal in `MovePicker::other_piece_types_mobile()`.
passed non regression STC:
https://tests.stockfishchess.org/tests/view/6829da686ec7634154f99faf
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 95680 W: 24962 L: 24820 D: 45898
Ptnml(0-2): 221, 9622, 28025, 9738, 234
Passed non regression LTC:
https://tests.stockfishchess.org/tests/view/682a102c6ec7634154f9a086
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 117666 W: 30065 L: 29957 D: 57644
Ptnml(0-2): 45, 10173, 38291, 10277, 47
Run of 10k games on the stalemate opening book:
https://tests.stockfishchess.org/tests/view/682b114e6ec7634154f9aa2d
Elo: 0.76 ± 0.9 (95%) LOS: 95.3%
Total: 10000 W: 4637 L: 4615 D: 748
Ptnml(0-2): 0, 75, 4828, 97, 0
nElo: 5.83 ± 6.8 (95%) PairsRatio: 1.29
closes https://github.com/official-stockfish/Stockfish/pull/6080
Bench: 2422771