Starlight-30036225 / ChessTCP

FILLMELATER
0 stars 0 forks source link

Kings can touch #26

Closed Starlight-30036225 closed 9 months ago

Starlight-30036225 commented 9 months ago

Kings should never be able to touch. But they can...

image

That;s not good.

Starlight-30036225 commented 9 months ago

image

Kings are still ignoring eachother when checking for possible moves. This is a left over from some early code. Im not sure if removing it will cause new issues though

Starlight-30036225 commented 9 months ago

static boolean isLocationSafe(Piece[][] Board, Piece piece, int x, int y) { for (Piece[] col : Board) { for (Piece p : col) { //Iterates through all pieces if (p != null && piece.white != p.white && p.getClass() != King.class && p.GetPossibleMoves(Board).contains(x + "" + y)) { return false; } } } return true; }

This function ignores checks for possible moves if the piece is a king. This was to stop infinite loops. I dont think that will happen anymore, but there is only one way to find out...

image

That was easy...