1. Лучший говнокод

    В номинации:
    За время:
  2. Java / Говнокод #4522

    +73

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    private long tournamentId;
    
    /**
     * The winner takes it all
     * The loser standing small
     * Beside the victory
     * That's her destiny
     */
    private boolean theWinnerTakesItAll;

    dvb, 03 Ноября 2010

    Комментарии (9)
  3. Java / Говнокод #3947

    +73

    1. 1
    progress = progress != null ? progress + "%" : progress;

    Да, давно я не смеялся...

    raorn, 11 Августа 2010

    Комментарии (19)
  4. Java / Говнокод #3928

    +73

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    96. 96
    class game {
      public static void main (String args[])
          throws java.io.IOException {
     
        double x = 0.0;
        byte php = 100, mhp = 100, pd = 0, md = 0;
        char pd_ch;
        boolean b1, b2;
     
        System.out.println("Welcome to \"Kill the mob\" v0.1!");
        System.out.println();
        System.out.println("While you where wandering in deep dark tunnels, a mob appeared in your way.");
        System.out.println("It appeared to be very agressive, so a fight started.");
        System.out.println();
     
        do {
          System.out.println("Your opponent is ready to act. You need to do something. What are you going to do?");
          System.out.print("Enter \"1\" to attack, \"2\" to defend yourself and \"3\" to regenerate: ");
          pd_ch = (char) System.in.read();
          if (pd_ch == '1')
            pd = 1;
          else if (pd_ch == '2')
            pd = 2;
          else
            pd = 3;
          x = Math.random();
          if (x < 0.33333)
            md = 1;
          else if (x > 0.66666)
            md = 3;
          else
            md = 2;
          System.out.println(md);
          System.out.println(pd);
          switch(pd) {
            case 1:
              System.out.print("You chose to attack, while mob chose to ");
              switch (md) {
                case 1:
                  System.out.println("attack too!");
                  System.out.println("You both lose 20 HP.");
                  php -= 20;
                  mhp -= 20;
                  break;
                case 2:
                  System.out.println("defend.");
                  System.out.println("You did not manage to hurt him.");
                  break;
                case 3:
                  System.out.println("regenerate.");
                  System.out.println("He lost 30 HP.");
                  mhp -= 30;
                  break;
              }
              break;
            case 2:
              System.out.print("You chose to defend, while mob chose to ");
              switch (md) {
                case 1:
                  System.out.println("attack.");
                  System.out.println("You did not let him hurt you.");
                  break;
                case 2:
                  System.out.println("defend too!");
                  System.out.println("You standed like two retards.");
                  break;
                case 3:
                  System.out.println("regenerate.");
                  System.out.println("He gained 20 HP.");
                  mhp += 20;
                  break;
              }
              break;
            case 3:
              System.out.print("You chose to regenerate, while mob chose to ");
              switch (md) {
                case 1:
                  System.out.println("attack.");
                  System.out.println("You was completely protectless. you you've lost 30 HP.");
                  php -= 30;
                  break;
                case 2:
                  System.out.println("defend.");
                  System.out.println("He standed like a retard, while you gained 20 HP.");
                  php += 20;
                  break;
                case 3:
                  System.out.println("regenerate too!");
                  System.out.println("Your energies helped each other, so you both gained 30 HP.");
                  mhp += 30;
                  php += 30;
                  break;
              }
              break;
          }
          System.out.println("Your HP: " + php);

    Цикл после одного ввода делается какого-то хуя 3 раза, причем с рандомными (1, 2, 3) pd и md. ЧЯДНТ?

    jesuschrist, 10 Августа 2010

    Комментарии (4)
  5. Java / Говнокод #3391

    +73

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    private static final double[][][] charsets = {{
      {1, 2, 3, 4},
     // 30 lines of a 3-dimentional array (4x9x3) declaration skipped
    }}
    
    // Later on
    double dx = charsets[order[n[0]][i - 1]][n[i]][j];

    Ну что тут еще скажешь... Legacy code forever!

    Koshiku, 03 Июня 2010

    Комментарии (1)
  6. Java / Говнокод #3181

    +73

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    public enum MONTHS {
    		January(31), February(28), March(31), April(30), May(31), June(30), July(31), August(31), September(30), October(31), November(30), December(31);
    		
    		private int days;
    		
    		private MONTHS(int days){
    			this.days = days;
    		}
    
    		public int getDays() {
    			return days;
    		}
    
    		public void setDays(int days) {
    			this.days = days;
    		}
    		
    		public static int getIndex(MONTHS month){
    			int i = 0;
    			for (MONTHS m : MONTHS.values()) {
    				if(m.equals(month)){
    					return i;
    				}
    				i++;
    			}
    			return 0;
    		}
    	}

    Хоть код и GWT (нету j.u.Calendar), но все равно феерично, я считаю.

    OlegYch, 07 Мая 2010

    Комментарии (4)
  7. C++ / Говнокод #3127

    +73

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    ICQ::logInIcq( )
    {
          TLV   clid1,clid,clm,clmin,clless,clbild,cldistr,cllang,clcontr,t1;
          WSA   ws;
          int   packn;
          unsigned char st1[40];
    
       port=ControlIcqPropert.portIcqServer;        
       host=(char*)ControlIcqPropert.IcqServer;
       if((strlen(host)==0)|(port==0)) 
       {
          port=DEFAULT_SERVER_PORT;
          host=DEFAULT_SERVER_HOST;
       }
       if(strlen(password)<3) return 0;
    
       pn=sock.Connect( host,port );      
       packn=sock.Receive( ( char * )uc,sizeof( uc ),0,0 );
    
       if(  packn <= 0  ){return 1;}
       //SetIndic(10);
       tUin.type=0x0100;
       tUin.lenght[0]=0x00;//htons( ( BYTE )strlen( uin ) );
       tUin.lenght[1]=strlen(uin);
       memcpy( tUin.data,uin,strlen( uin ) );
       flap.chan_id=0x01;
       flap.Sequence+=0x0100;
       flap.datalenght[0]=0x00;
       flap.datalenght[1]=0x04;
       flap.data[0]=0x00;
       flap.data[1]=0x00;
       flap.data[2]=0x00;
       flap.data[3]=0x01;
       packn=sock.Send( ( const char * )&flap,10,0 );
       flap.Sequence+=0x0100;
       flap.chan_id=0x02;
       t1.type=0x1700;
       t1.lenght[0]=0x00;
       t1.lenght[1]=0x06;
       t1.data[0]=0x00;
       t1.data[1]=0x00;
       t1.data[2]=0x00;
       t1.data[3]=0x00;
       t1.data[4]=0x00;
       t1.data[5]=0x00;
       int lnum=0;
       lnum+=10;
       memcpy( &st1,&t1,lnum );
       memcpy( &st1[lnum],&tUin,strlen(uin)+4 );
       lnum+=strlen(uin)+4;
       
       unsigned char u1[4];
       u1[0]=0x00;
       u1[1]=0x4B;
       u1[2]=0x00;
       u1[3]=0x00;
       
       memcpy( &st1[lnum],&u1,4 );
       lnum+=4;
       memcpy( flap.data,&st1,lnum );
       flap.datalenght[0]=0x00;
       flap.datalenght[1]=0x1B;
       lnum+=6;
       packn=sock.Send( ( char * )&flap,lnum,0 );
       //memcpy( &flap,NULL,4096 );
       packn=sock.Receive( ( char * )&inflap,sizeof( inflap ),0 );
       memcpy( &uc,&inflap,packn );
       memcpy( &snac,&uc[6],packn-6 );
       memcpy( key,&snac.data[2],snac.data[1] );
       int ii;
       MD5_CTX Md5Ctx;
       HASH hash;
       MD5Init  (  &Md5Ctx  );
       MD5Update(  &Md5Ctx, (  unsigned char*  )password, strlen( password ) );
       MD5Final ( ( uchar*  )hash, &Md5Ctx  );
       MD5Init  (  &Md5Ctx  );
       MD5Update(  &Md5Ctx, (  unsigned char*  )key, snac.data[1] );
       MD5Update(  &Md5Ctx, (  unsigned char*  )hash, 16 );
       MD5Update(  &Md5Ctx, (  unsigned char*  )AIM_MD5_STRING, strlen( AIM_MD5_STRING ) );
       MD5Final ( (  uchar*  )hash, &Md5Ctx  );
    
       flap.chan_id=0x02;
       flap.Sequence+=0x0100;
       flap.datalenght[0]=0x00;
       flap.datalenght[1]=0x72;
       t1.lenght[0]=0x00;               //Not Lenght!!! it is SNAC!!!
       t1.lenght[1]=0x02;
       memcpy( uc,&t1,10 );
       memcpy( &uc[10],&tUin,13 );
       TLV auth_h;
       auth_h.type=0x2500;
       auth_h.lenght[0]=0x00;
       auth_h.lenght[1]=0x10;
       memcpy( &auth_h.data,&hash,16 );
       memcpy( &uc[23],&auth_h,20 );
       uc[43]=0x00;
       uc[44]=0x4c;
       uc[45]=0x00;
       uc[46]=0x00;
       clid1.type=0x0300;

    Много лет назад, будучи молодым программером писал абсолютное гавно. Была поставлена задача реализовать протокол оскар 11 в одной бухгалтерской системе. Полное отсутствие архитектуры приложения, бизнес-слоя. В общем мне тогда сказали что так писать не надо и с треском выгнали. После этого так перестал писать :-)

    ursus, 29 Апреля 2010

    Комментарии (38)
  8. Java / Говнокод #1828

    +73

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    ..........
    
    if (year.equals(beginYear)) {
        //таск полностью попадает в месяц
        if ((beginMonth == month) && (endMonth == month)) {
         for (int i = 1; i < beginDate; i++) {
          row.add(3);
         }
         for (int i = beginDate; i < realizationDate; i++) {
             row.add(-1);
         }
         row.add(1);
         for (int i = realizationDate + 1; i <= endDate; i++) {
             row.add(2);
         }
         for (int i = endDate; i < columnCount; i++) {
          row.add(3);
         }
        }
        
        //таск полностью не попадает в месяц или полностью занимает месяц
        if ((beginMonth < month) && (endMonth > month)) {
         for (int i = 1; i < columnCount; i++) {
          row.add(-1);
         }
        } else if ((beginMonth < month) && (endMonth < month)) {
         for (int i = 1; i < columnCount; i++) {
          row.add(3);
         }
        } else if ((beginMonth > month) && (endMonth > month)) {
         for (int i = 1; i < columnCount; i++) {
          row.add(3);
         }
        }
        
        //таск попадает в месяц частично
        if ((beginMonth == month) && (beginMonth < endMonth)) {
         if (beginMonth == realizationMonth) {
          for (int i = 1; i < beginDate; i++) {
           row.add(3);
          }
          for (int i = beginDate; i < realizationDate; i++) {
              row.add(-1);
          }
          row.add(1);
          for (int i = realizationDate + 1; i < columnCount; i++) {
              row.add(2);
          }
         } else {
          for (int i = 1; i < beginDate; i++) {
           row.add(3);
          }
          for (int i = beginDate; i < columnCount; i++) {
              row.add(-1);
          }
         }
        } else if ((endMonth == month) && (beginMonth < endMonth)){
         if (endMonth == realizationMonth) {
          for (int i = 1; i < realizationDate; i++) {
           row.add(-1);
          }
          row.add(1);
        
          for (int i = realizationDate + 1; i <= endDate; i++) {
              row.add(2);
          }
          for (int i = (endDate + 1); i < columnCount; i++) {
           row.add(3);
          }
         } else {
          for (int i = 1; i <= endDate; i++) {
           row.add(2);
          }
          for (int i = (endDate + 1); i < columnCount; i++) {
           row.add(3);
          }
         } 
        }
       } else {
        for (int i = 1; i < columnCount; i++) {
         row.add(3);
        }
       }
    ...........

    Вот так корень кладёт данные в таблицу по определённой дате

    paranoid, 11 Сентября 2009

    Комментарии (1)
  9. Java / Говнокод #1629

    +73

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    public static List<Record> glueList(List<Record> list) {
    		List<Record> result = new ArrayList<Record>();
    		Record tlr = new Record();
    		boolean isToGlue = false;
    		for (int i = 0; i < list.size(); i++) {
    			if (!isToGlue) {
    				tlr = new Record();
    				tlr = list.get(i).clone();
    			}
    			Date endTime = new Date(list.get(i).getEndTime().getTime() + INSIGNIFICANT_TIME_BREAK);
    			if (list.size() > i + 1 && endTime.compareTo(list.get(i + 1).getStartTime()) >= 0) {
    				isToGlue = true;
    				tlr.setEndTime(list.get(i + 1).getEndTime());
    			} else {
    				isToGlue = false;
    				result.add(tlr);
    			}
    		}
    		return result;
    	}

    1. Два раза создается и не используется объект Record
    2. Для сравнения дат используется метод compareTo вместо методов after/before

    intr13, 19 Августа 2009

    Комментарии (16)
  10. Куча / Говнокод #1311

    +73

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    program test;
    uses crt;
    label ww,1,2,ww2,ee,ee2,rr,rr2,tt,tt2,tt3,yy,yy2,yy3,uu,uu2,uu3,ii,ii2,ii3,ii4,oo,oo2,oo3,oo4,00,z,x,c,v;
    var q,q2,w,e,r,t,w2,e2,r2,t2,t3,y,y2,y3,u,u2,u3,i,i2,i3,i4,o,o2,o3,o4:real;
    begin
    1:clrscr;
    textcolor(4);
    writeln('++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++');
    textcolor(2);
    writeln('+Если вы отвечаете "ДА",то нажимайте "1" ,а если "НЕТ",то "0"+ ');
    textcolor(4);
    writeln('++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++');
    writeln;
    textcolor(2);
    writeln('Ответьте пожалуйста на следующие вопросы:');
    writeln('*****************************************');
    textcolor(8);
    writeln('Вы помните всю таблицу умножения?');
    read(q);
    if q=1 then begin writeln('Вы давно были на рок-концерте?');read(w);goto ww end;
    if q=0 then begin writeln('Вы играете в волейбол?');read(w2);goto ww2 end;
    ww:if w=1 then begin writeln('Вы играете в волейбол?');read(w2);goto ww2 end;
    if w=0 then begin writeln('Вы йог?');read(e);goto ee end;
    ww2:if w2=1 then begin writeln('Вы летали на истребителе?');read(e2);goto ee2 end;
    if w2=0 then begin writeln('Вы йог?');read(e);goto ee end;
    ee:if e=1 then begin writeln('Вы играете в очко?');read(r2);goto rr2 end;
    if e=0 then begin writeln('У вас часто болит голова?');read(r);goto rr end;
    ee2:if e2=1 then begin writeln('У вас часто болит голова?');read(r);goto rr end;
    if e2=0 then begin writeln('Вы играете в очко?');read(r2);goto rr2 end;
    rr:if r=1 then begin writeln('У вас смуглая кожа?');read(t);goto tt end;
    if r=0 then begin writeln('У вас есть загородный дом?');read(t2);goto tt2 end;
    rr2:if r2=1 then begin writeln('Вы часто лежите в больнице?');read(t3);goto tt3 end;
    if r2=0 then begin writeln('У вас часто болит голова?');read(r);goto rr end;
    tt:if t=1 then begin writeln('У вас есть загородный дом?');read(t2);goto tt2 end;
    if t=0 then begin writeln('В вашем подъезде кодовый замок?');read(y);goto yy end;
    tt2:if t2=1 then begin writeln('Вы часто лежите в больнице?');read(t3);goto tt3 end;
    if t2=0 then begin writeln('В вашем подъезде кодовый замок?');read(y);goto yy end;
    tt3:if t3=1 then begin writeln('Телесериалы бывают интересными?');read(y3);goto yy3 end;
    if t3=0 then begin writeln('Вы пишете роман?');read(y2);goto yy2 end;
    yy:if y=1 then begin writeln('Вы знаете что такое "дежа вю"?');read(u2);goto uu2 end;
    if y=0 then begin writeln('Вам всегда жалко бездомных собак?');read(u);goto uu end;
    yy2:if y2=1 then begin writeln('В вашем подъезде кодовый замок?');read(y);goto yy end;
    if y2=0 then begin writeln('Телесериалы бывают интересными?');read(y3);goto yy3 end;
    yy3:if y3=1 then begin writeln('Вы знаете что такое "дежа вю"?');read(u2);goto uu2 end;
    if y3=0 then begin writeln('В детстве вы играли в индейцев?');read(u3);goto uu3 end;
    uu:if u=1 then begin writeln('Вы любите варёную рыбу?');read(i);goto ii end;
    if u=0 then begin writeln('Вы знаете что такое ДЕЖА ВЮ ?');read(u2);goto uu2 end;
    uu2:if u2=1 then begin writeln('Вы любите вареную рыбу?');read(i);goto ii end;
    if u2=0 then begin writeln('В детстве вы играли в индейцев?');read(u3);goto uu3 end;
    uu3:if u3=1 then begin writeln('У вас отключена горячая вода?');read(i4);goto ii4 end;
    if u3=0 then begin writeln('Макароны вы едите с хлебом ?');read(i3);goto ii3 end;
    ii:if i=1 then begin writeln('Вы могли бы рекламировать бельё?');read(i2);goto ii2 end;
    if i=0 then begin writeln('Вы любите петь?');read(o);goto oo end;
    ii2:if i2=1 then begin writeln('Вы любите морковный сок?');read(o3);goto oo3 end;
    if i2=0 then begin writeln('Вы хотите стать гражданином США ?');read(o2);goto oo2 end;
    ii3:if i3=1 then begin writeln('Вам нравятся горы?');read(o4);goto oo4 end;
    if i3=0 then begin writeln('Вы любите морковный сок?');read(o3);goto oo3 end;
    ii4:if i4=1 then begin writeln('Вам нравятся горы?');read(o4);goto oo4 end;
    if i4=0 then begin writeln('Вы любите морковный сок?');read(o3);goto oo3 end;
    oo:if o=1 then goto z;
    if o=0 then goto x;
    oo2:if o2=1 then goto z;
    if o2=0 then goto x;
    oo3:if o3=1 then goto c;
    if o3=0 then begin writeln('Вы хотите стать гражданином США ?');read(o2);goto oo2 end;
    oo4:if o4=1 then goto v;
    if o4=0 then goto c;
    z:clrscr;
    textcolor(5);
    writeln('                ------ИТОГ: добрый ли вы человек?-------');
    textcolor(14);
    writeln('Вы случайно не мать Тереза?Бескрайняя ваша доброта...почти также как и глупость');
    writeln('Мало настрадались по своей вине?То ли ещё будет.');goto 00;
    x:clrscr;
    textcolor(5);
    writeln('                ------ИТОГ: добрый ли вы человек? -------');
    textcolor(14);
    writeln('Вы не безнадёжны.В детстве с вами явно занимались.Но годы делают своё дело-');
    writeln('ещё немного и от ваших лучших качеств не останется и следа.');goto 00;
    c:clrscr;
    textcolor(5);
    writeln('                -------ИТОГ: добрый ли вы человек?-------');
    textcolor(14);
    writeln('Брр... С вами близко лучше не знакомиться.Кошек вы конечно не мучаете ,но и на');
    writeln('гуманиста абсолютно не тянете.Надо за собой следить');goto 00;
    v:clrscr;
    textcolor(5);
    writeln('                ------ИТОГ: добрый ли вы человек? -------');
    textcolor(14);
    writeln('Бесцветность вашей натуры не оставляет места для разговоров о добре и зле');
    writeln('В вас всего по немногу-может это и есть идеальный вариант?');goto 00;
    00:writeln;
    ...
    writeln('Если вы хотите ещё раз протестироваться нажмите "1",если нет "0"');
    textcolor(4);
    writeln('-----------------------------------------------------------------');
    read(q2);
    if q2=1 then goto 1;
    if q2=0 then goto 2;
    2:end.

    Нашел свой старый код на паскале. Код был написан сразу после изучение конструкции if и goto. Было это в 10 классе, т.е. где-то лет 10 назад :))

    Программа является реализацией точной копии теста из журнала "МК-бульвар" того времени

    guest, 02 Июля 2009

    Комментарии (26)
  11. Java / Говнокод #2672

    +72.9

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    public class CountUnique {
        //here objects will be stored
        private Object[] variants;
        //temporaly array to store copying variants
        private Object[] temparr;
    
        private int total = 0;
    
        public CountUnique() {}
    
        public boolean test(Object obj) {
            total++;
            boolean hasSame = false;
            if(variants == null) {
                variants = new Object[1];
                variants[0] = obj;
                hasSame = false;
            } else {
                for(int i = 0; i < variants.length; i++) {
                    if(variants[i] == null) {} else {
                        if(variants[i].equals(obj)) {
                            hasSame = true;
                            break;
                        }
                    }
                }
    
                if(hasSame == false) {
                    temparr = variants;
                    variants = new Object[temparr.length+1];
                    for(int i = 0; i < temparr.length; i++) {
                        variants[i] = temparr[i];
                    }
    
                    variants[temparr.length] = obj;
                    temparr = null;
                }
            }
    
            return hasSame;
        }
    
        public int unique() {
            if(variants == null) {
                return 0;
            } else return variants.length;
        }
    
        public int total() {
            return total;
        }
    
        public void free() {
            variants = null;
            temparr = null;
        }
    }

    некий класс для подсчета уникальных обьектов.
    особенно умиляет функция test()

    danilissimus, 25 Февраля 2010

    Комментарии (5)