Simplify a condition in is_KXK()

No functional change.
Small renaming in material weights

Also dropped some temporary variable: compiler
is more than able to push on stack temp values
by itself (verified).

No functional change.
Move game_phase() to Position

It seems a more natural to place this
function there.

No functional change.
Better value clipping in game_phase()

No functional change.