# What does the sign of the score represent in chess engines?

I am trying to code a small chess engine, but I am confused with what the sign of the score means. This is my current minimax algorithm:

``````INFINITY = 999999
def minimax(self, depth, color):
if depth == 0:
return (1 if color else -1) * self.evaluate()
if color == WHITE:
max_value = -INFINITY
for move in board.generate_moves():
board.push(move)
score = minimax(depth - 1, not color)
board.pop()
max_value = max(score, max_value)
return max_value
else:
min_value = INFINITY
for move in board.generate_moves():
board.push(move)
score = minimax(depth - 1, not color)
board.pop()
min_value = min(score, min_value)
return min_value

def evaluate(self):
score = 0
if board.detect_checkmate():
return INFINITY
score += (piece_values[KING] * (piece_count(KING, WHITE) - piece_count(KING, BLACK))
+ piece_values[QUEEN] * (piece_count(QUEEN, WHITE) - piece_count(QUEEN, BLACK))
+ piece_values[ROOK] * (piece_count(ROOK, WHITE) - piece_count(ROOK, BLACK))
+ piece_values[KNIGHT] * (piece_count(KNIGHT, WHITE) - piece_count(KNIGHT, BLACK))
+ piece_values[BISHOP] * (piece_count(BISHOP, WHITE) - piece_count(BISHOP, BLACK))
+ piece_values[PAWN] * (piece_count(PAWN, WHITE) - piece_count(PAWN, BLACK)))
return score
``````

See, what is important isn't the lousy evaluation function I have, I think it is about the sign the evaluation function returns. I am confused about the colors of the players and the maximizing player and minimizing player. Is it that if the engine is playing black, it is the maximizing player? Or is the white always the maximizing player?