public DList legalMoves(int color){
        DList moveList = new DList();
        int index = 0;
        int opponentColor = enemyColor(color);
        int colorConversion = (color-1) * 10;

        // if(!checkOnBoard())
        for(int i = 0; i < DIMENSION; i++)
                for(int j =0; j < DIMENSION; j++){

                    if(getColor(i,j) == color){
                        int piece = getContent(i, j);
                        
                        if(piece == WHITE_BISHOP + colorConversion){
                            moveList.insertAfter(bishop(i, j));
                        }

                        if(piece == WHITE_KNIGHT + colorConversion){
                            moveList.insertAfter(knight(i, j));
                        }

                        if(piece == WHITE_ROOK + colorConversion){
                            moveList.insertAfter(rook(i, j));
                        }

                        if(piece == WHITE_PAWN + colorConversion){
                            moveList.insertAfter(pawn(i, j));
                        }

                        if(piece == WHITE_QUEEN + colorConversion){
                            moveList.insertAfter(queen(i, j));
                        }

                        if(piece == WHITE_KING + colorConversion){
                            moveList.insertAfter(king(i, j));
                        }
                    }
                }
        // return listToArray(moveList);

        return moveList;
    }