• Ng Justin (unregistered)

    I've had about 3months of "work in the real world" and one of my tasks was to refactor and rewrite some really bad code that a previous dude left behind.

    There was so much bad code that I had to have some way of keeping track of them. In the end, I just decided to right-click any fugly code and select "Refactor->Rename".

    The new method and class names would have the prefix "Fucked" added to it.

    I, of course, removed the names after they had been fixed.

    One such example was:

        #region Pet Level Array
    
        static int[][] BearLevelArray =  {          new int[]{ 1, 2, 0, 0, 1, 1, 0, 0 },
    								                new int[]{1,2,0,0,1,2,0,0},
    								                new int[]{2,3,0,0,2,3,0,1},
    								                new int[]{3,3,1,1,3,3,1,1},
    								                new int[]{2,3,0,0,2,3,0,0},
    								                new int[]{2,4,0,0,2,3,0,0},
    								                new int[]{3,4,0,0,2,3,0,1},
    								                new int[]{3,4,0,1,2,3,0,1},
                                                    new int[]{4,4,1,1,4,4,2,2}, //Bear lvl 10
                                                    new int[]{3,4,0,0,2,3,0,0},
                                                    new int[]{3,4,0,0,3,3,0,0},
                                                    new int[]{4,4,0,0,3,3,0,1},
                                                    new int[]{4,4,0,1,3,3,0,1},
                                                    new int[]{6,6,1,1,5,5,2,2}, //Bear lvl 15
                                                    new int[]{4,4,0,0,3,3,0,0},
                                                    new int[]{4,4,0,0,3,4,0,0},
                                                    new int[]{4,4,0,0,3,4,1,1},
                                                    new int[]{4,5,0,1,4,4,1,1},
                                                    new int[]{6,6,1,1,5,5,2,2}, //Bear lvl 20
                                                    new int[]{4,4,0,0,4,4,0,0},
                                                    new int[]{4,5,0,1,4,5,0,1},
                                                    new int[]{4,6,0,0,4,5,1,1},
                                                    new int[]{5,6,0,1,5,5,1,1},
                                                    new int[]{6,6,1,1,6,6,2,2}, //Bear lvl 25
                                                    new int[]{5,5,0,1,4,4,0,1},
                                                    new int[]{5,6,0,1,4,5,1,1},
                                                    new int[]{6,6,0,1,5,5,1,1},
                                                    new int[]{6,7,0,1,5,6,1,2},
                                                    new int[]{7,7,1,1,6,6,2,2}, //Bear lvl 30
                                                    new int[]{5,6,1,1,5,5,1,1},
                                                    new int[]{5,7,1,1,5,6,1,1},
                                                    new int[]{6,7,1,1,6,6,1,2},
                                                    new int[]{6,7,1,1,6,7,2,2},
                                                    new int[]{7,7,1,1,7,7,3,3}, //Bear lvl 35
                                                    new int[]{6,6,1,1,6,7,2,2},
                                                    new int[]{6,7,1,1,6,7,2,2},
                                                    new int[]{7,7,1,1,7,7,2,3},
                                                    new int[]{7,7,1,1,7,7,2,3},
                                                    new int[]{8,8,2,2,8,8,3,3}, //Bear lvl 40
                                                    new int[]{7,7,1,1,7,7,2,3},
                                                    new int[]{7,8,1,1,7,8,2,3},
                                                    new int[]{7,8,1,1,8,8,3,3},
                                                    new int[]{7,8,1,1,8,9,3,3},
                                                    new int[]{9,9,2,2,10,10,4,4}, //Bear lvl 45
                                                    new int[]{7,7,0,0,8,8,3,3},
                                                    new int[]{7,8,0,0,8,8,3,3},
                                                    new int[]{8,8,1,1,8,9,3,3},
                                                    new int[]{8,9,1,1,9,9,4,4},
                                                    new int[]{10,10,2,2,10,10,5,5} //Bear lvl 50
                                       };
    
        static int[][] BearRabbitLevelArray =  {    new int[]{0, 1, 1, 2, 0, 0, 0, 1},
    								                new int[]{0, 1, 1, 2, 0, 1, 1, 1},
    								                new int[]{0, 1, 1, 2, 1, 1, 1, 2},
    								                new int[]{2, 2, 3, 3, 1, 2, 2, 2},
    								                new int[]{1, 2, 2, 3, 1, 2, 2, 3}, //BearRabbit lvl 5
    								                new int[]{1, 3, 2, 3, 1, 2, 2, 3},
    								                new int[]{1, 3, 2, 4, 1, 2, 2, 3},
    								                new int[]{1, 3, 3, 4, 1, 2, 2, 3},
                                                    new int[]{3, 3, 4, 4, 2, 2, 3, 3}, //BearRabbit lvl 10
                                                    new int[]{1,3,3,4,1,1,1,3},
                                                    new int[]{1,3,3,4,1,1,1,3},
                                                    new int[]{2,3,3,4,1,2,2,3},
                                                    new int[]{2,3,4,4,1,2,2,3},
                                                    new int[]{5,5,5,5,2,2,4,4}, //BearRabbit lvl 15
                                                    new int[]{2,3,4,4,1,1,2,3},
                                                    new int[]{3,3,4,5,1,1,2,3},
                                                    new int[]{3,3,4,5,1,2,2,3},
                                                    new int[]{3,4,4,5,2,2,3,3},
                                                    new int[]{5,5,7,7,2,2,5,5}, //BearRabbit lvl 20
                                                    new int[]{3,3,4,4,2,2,3,3},
                                                    new int[]{3,4,4,5,2,3,3,3},
                                                    new int[]{3,4,5,5,2,3,3,4},
                                                    new int[]{4,4,5,5,3,3,4,4},
                                                    new int[]{5,5,7,7,3,3,5,5}, //BearRabbit lvl 25
                                                    new int[]{3,3,5,5,2,2,3,4},
                                                    new int[]{4,4,5,6,2,3,3,4},
                                                    new int[]{4,4,6,6,3,3,4,4},
                                                    new int[]{4,5,6,7,3,4,4,4},
                                                    new int[]{5,5,7,7,4,4,6,6}, //BearRabbit lvl 30
                                                    new int[]{4,4,6,7,4,4,4,4},
                                                    new int[]{4,5,6,7,4,5,4,5},
                                                    new int[]{4,5,6,8,4,6,5,5},
                                                    new int[]{5,5,7,8,4,6,5,5},
                                                    new int[]{6,6,8,8,5,5,6,6}, //BearRabbit lvl 35
                                                    new int[]{4,5,7,7,4,5,4,5},
                                                    new int[]{5,5,7,7,5,5,4,5},
                                                    new int[]{5,6,7,8,5,6,5,5},
                                                    new int[]{5,6,8,8,5,6,5,5},
                                                    new int[]{6,6,8,8,6,6,6,6}, //BearRabbit lvl 40
                                                    new int[]{5,5,7,8,5,5,5,6},
                                                    new int[]{5,6,8,8,5,6,6,6},
                                                    new int[]{5,7,8,8,5,6,6,6},
                                                    new int[]{5,7,8,8,6,6,6,7},
                                                    new int[]{7,7,9,9,7,7,7,7}, //BearRabbit lvl 45
                                                    new int[]{6,7,8,8,6,6,6,7},
                                                    new int[]{7,7,8,8,6,6,6,7},
                                                    new int[]{7,7,8,9,6,7,7,7},
                                                    new int[]{7,8,8,9,7,7,7,8},
                                                    new int[]{9,9,9,9,7,7,8,8}  //BearRabbit lvl 50
                                       };
    
        static int[][] ChinchillaLevelArray =  {    new int[]{0, 1, 1, 1, 0, 0, 0, 1},
    								                new int[]{0, 1, 1, 2, 0, 1, 1, 1},
    								                new int[]{1, 1, 1, 2, 1, 1, 1, 1},
    								                new int[]{2, 2, 2, 2, 1, 2, 2, 2},
    								                new int[]{1, 2, 1, 2, 1, 2, 2, 2}, //Chinchilla lvl 5
    								                new int[]{1, 3, 2, 3, 1, 2, 2, 3},
    								                new int[]{1, 3, 2, 3, 1, 2, 2, 3},
    								                new int[]{1, 3, 2, 3, 1, 2, 2, 4},
                                                    new int[]{4, 4, 3, 3, 2, 2, 4, 4}, //Chinchilla lvl 10
                                                    new int[]{1,3,1,3,1,1,1,4},
                                                    new int[]{1,3,1,3,1,1,1,4},
                                                    new int[]{2,3,2,3,1,2,2,4},
                                                    new int[]{2,3,2,3,1,2,2,4},
                                                    new int[]{3,3,4,4,2,2,4,4}, //Chinchilla lvl 15
                                                    new int[]{1,3,2,3,1,2,3,4},
                                                    new int[]{1,3,2,3,1,2,3,4},
                                                    new int[]{2,3,3,3,1,2,3,4},
                                                    new int[]{2,3,3,3,2,2,4,4},
                                                    new int[]{3,3,5,5,2,2,6,6}, //Chincilla lvl 20
                                                    new int[]{2,2,3,3,1,2,4,4},
                                                    new int[]{2,3,3,4,1,2,4,5},
                                                    new int[]{2,3,3,4,2,2,4,5},
                                                    new int[]{3,3,4,4,2,2,5,5},
                                                    new int[]{3,3,5,5,2,2,6,6}, //Chinchilla lvl 25
                                                    new int[]{2,3,3,3,2,2,5,5},
                                                    new int[]{2,3,4,4,2,2,5,6},
                                                    new int[]{3,3,4,5,2,3,5,6},
                                                    new int[]{3,4,4,5,3,3,6,6},
                                                    new int[]{4,4,6,6,3,3,7,7}, //Chinchilla lvl 30
                                                    new int[]{3,3,4,5,2,2,5,5},
                                                    new int[]{3,4,5,5,2,3,5,6},
                                                    new int[]{4,4,5,6,3,3,6,6},
                                                    new int[]{5,5,6,6,3,3,6,7},
                                                    new int[]{6,6,6,6,3,3,7,7}, //Chinchilla lvl 35
                                                    new int[]{4,4,5,7,3,3,6,6},
                                                    new int[]{4,5,5,7,3,3,6,7},
                                                    new int[]{5,5,6,7,3,4,7,7},
                                                    new int[]{5,5,7,7,4,4,7,7},
                                                    new int[]{6,6,7,7,4,4,8,8}, //Chincilla lvl 40
                                                    new int[]{5,5,7,7,3,3,6,6},
                                                    new int[]{5,5,7,8,3,4,6,7},
                                                    new int[]{5,6,7,8,4,4,7,7},
                                                    new int[]{5,7,8,8,4,4,8,8},
                                                    new int[]{7,7,8,8,4,4,9,9}, //Chinchilla lvl 45
                                                    new int[]{6,7,7,8,3,3,8,9},
                                                    new int[]{6,7,8,8,4,4,8,9},
                                                    new int[]{7,7,8,9,4,5,9,9},
                                                    new int[]{7,8,8,9,5,5,9,10},
                                                    new int[]{8,8,9,9,5,5,11,11} //Chincilla lvl 50
                                       };
    
        static int[][] CrabbyLevelArray =  {        new int[]{1, 1, 0, 0, 1, 2, 0, 0},
    								                new int[]{1, 1, 0, 0, 2, 2, 0, 0},
    								                new int[]{1, 2, 0, 1, 2, 2, 1, 1},
    								                new int[]{2, 2, 2, 2, 4, 4, 1, 1},
    								                new int[]{1, 2, 0, 1, 2, 3, 0, 0}, //Crabby lvl 5
    								                new int[]{2, 2, 1, 1, 2, 3, 0, 0},
    								                new int[]{2, 3, 1, 2, 2, 3, 1, 1},
    								                new int[]{3, 3, 1, 2, 2, 3, 0, 1},
                                                    new int[]{4, 4, 2, 2, 3, 4, 1, 1}, //Crabby lvl 10
                                                    new int[]{2,3,0,1,2,3,0,0},
                                                    new int[]{2,3,0,1,3,3,0,0},
                                                    new int[]{3,3,1,2,3,4,0,0},
                                                    new int[]{3,4,1,2,3,4,0,1},
                                                    new int[]{5,5,2,2,5,5,1,1}, //Crabby lvl 15
                                                    new int[]{3,3,1,2,3,5,0,0},
                                                    new int[]{3,4,1,2,3,5,0,0},
                                                    new int[]{4,4,1,3,4,5,0,1},
                                                    new int[]{4,4,1,3,4,5,0,1},
                                                    new int[]{4,4,3,3,6,6,1,1}, //Crabby lvl 20
                                                    new int[]{3,4,2,2,4,4,0,0},
                                                    new int[]{4,4,2,2,4,5,0,1},
                                                    new int[]{4,4,2,3,5,5,0,1},
                                                    new int[]{4,5,2,3,5,5,1,1},
                                                    new int[]{5,5,3,3,6,6,1,1}, //Crabby lvl 25
                                                    new int[]{4,4,2,3,5,6,0,1},
                                                    new int[]{4,4,3,3,5,7,0,1},
                                                    new int[]{4,5,3,3,6,7,1,1},
                                                    new int[]{5,5,3,4,7,7,1,1},
                                                    new int[]{5,5,4,4,8,8,1,1}, //Crabby lvl 30
                                                    new int[]{5,5,3,3,7,7,0,0},
                                                    new int[]{5,6,3,4,7,7,1,1},
                                                    new int[]{6,6,4,4,7,8,1,1},
                                                    new int[]{6,7,4,4,8,8,1,1},
                                                    new int[]{7,7,5,5,9,9,1,1}, //Crabby lvl 35
                                                    new int[]{7,8,3,5,7,7,1,2},
                                                    new int[]{7,8,4,5,7,8,1,2},
                                                    new int[]{8,8,4,5,7,8,1,2},
                                                    new int[]{8,8,5,5,8,8,1,2},
                                                    new int[]{8,8,5,5,9,9,2,2}, //Crabby lvl 40
                                                    new int[]{7,7,5,6,8,8,1,2},
                                                    new int[]{7,8,6,6,8,9,1,2},
                                                    new int[]{8,8,6,6,9,9,2,2},
                                                    new int[]{8,8,6,6,9,9,2,2},
                                                    new int[]{8,8,6,6,10,10,2,2}, //Crabby lvl 45
                                                    new int[]{7,7,6,6,9,9,1,1},
                                                    new int[]{8,8,6,7,9,9,1,1},
                                                    new int[]{8,9,7,7,9,10,1,2},
                                                    new int[]{9,9,7,7,9,10,2,2},
                                                    new int[]{9,9,7,7,11,11,2,2} //Crabby lvl 50
                                       };
    
        static int[][] BlueDragonLevelArray =  {        new int[]{1, 1, 0, 0, 0, 1, 1, 1},
    								                    new int[]{1, 2, 0, 1, 0, 1, 1, 1},
    								                    new int[]{1, 2, 1, 1, 0, 1, 1, 2},
    								                    new int[]{3, 3, 3, 3, 1, 2, 2, 2},
    								                    new int[]{1, 2, 1, 3, 1, 2, 1, 2},
    								                    new int[]{2, 2, 2, 3, 1, 2, 2, 2},
    								                    new int[]{2, 2, 2, 3, 2, 2, 2, 2},
    								                    new int[]{2, 3, 3, 3, 2, 2, 2, 3},
                                                        new int[]{4, 4, 5, 5, 2, 3, 2, 3}
                                       };
        static int[][] FeatherballLevelArray =  {        new int[]{0, 0, 0, 1, 0, 1, 0, 1},
    								                    new int[]{0, 1, 1, 1, 0, 1, 1, 1},
    								                    new int[]{0, 1, 1, 1, 1, 1, 1, 1},
    								                    new int[]{1, 1, 2, 2, 1, 1, 1, 1},
    								                    new int[]{0, 2, 1, 2, 1, 1, 1, 2},
    								                    new int[]{0, 2, 1, 3, 1, 2, 1, 2},
    								                    new int[]{1, 2, 2, 3, 1, 2, 2, 2},
    								                    new int[]{1, 2, 2, 3, 1, 2, 2, 2},
                                                        new int[]{2, 2, 3, 3, 2, 2, 2, 2}
                                       };
    
        public static void PetLevelUpFucked (PetInfoFucked petInfo)
        {
            switch ((PetType)petInfo.info.pet_type_id)
            {
                case PetType.Bear:
                    {
                        RandStatFucked(petInfo, BearLevelArray[petInfo.info.lvl - 2]);
                    }
                    break;
                case PetType.BearRabbit:
                    {
                        RandStatFucked(petInfo, BearRabbitLevelArray[petInfo.info.lvl - 2]);
                    }
                    break;
    
                case PetType.Chinchilla:
                    {
                        RandStatFucked(petInfo, ChinchillaLevelArray[petInfo.info.lvl - 2]);
                    }
                    break;
                case PetType.Crabby:
                    {
                        RandStatFucked(petInfo, CrabbyLevelArray[petInfo.info.lvl - 2]);
                    }
                    break;
                case PetType.BlueDragon:
                    {
                        RandStatFucked(petInfo, BlueDragonLevelArray[petInfo.info.lvl - 2]);
                    }
                    break;
                case PetType.Featherball:
                    {
                        RandStatFucked(petInfo, FeatherballLevelArray[petInfo.info.lvl - 2]);
                    }
                    break;
            }
        }
        #endregion
    
  • eric bloedow (unregistered)

    two things come to mind: someone "ran out of fucks to give" and a game called "time fcuk"...or was it "time fukc"...something like that...

Leave a comment on “Dirty Code”

Log In or post as a guest

Replying to comment #:

« Return to Article