public Location[] getPieces(Square[][] board, char p)
    {
        Location[] pieces = new Location[12];
        int count = 0;
        for (int x = 0; x < 8; x++)
        {
            for (int y = 0; y < 8; y++)
            {
                if (board[x][y].getPiece() == p)
                {
                    pieces[count] = new Location(x, y);
                    count++;
                }
            }
        }


        Location[] trRet = new Location[count];

        for (int x = 0; x < count; x++)
        {
            trRet[x] = pieces[x];
        }
        return trRet;

    }