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

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

    +71

    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
    public int getLifeWidth() {
    		return cells == null ? 0 : cells.length;
    	}
    
    	public int getLifeHeight() {
    		return cells == null || cells.length == 0 || cells[0] == null ? 0 : cells[0].length;
    	}
    
    	private int _getLifeWidth() {
    		return cells.length;
    	}
    
    	private int _getLifeHeight() {
    		return cells[0].length;
    	}

    есть ли мне оправдание? ))

    Lure Of Chaos, 09 Апреля 2012

    Комментарии (15)
  3. C# / Говнокод #9865

    +122

    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
    switch (count)
    {
    	case 2:
    		return Tuple.Create(col[1]);
    	case 3:
    		return Tuple.Create(col[1], col[2]);
    	case 4:
    		return Tuple.Create(col[1], col[2], col[3]);
    	case 5:
    		return Tuple.Create(col[1], col[2], col[3], col[4]);
    	case 6:
    		return Tuple.Create(col[1], col[2], col[3], col[4], col[5], col[6]);
    	case 8:
    		return Tuple.Create(col[1], col[2], col[3], col[4], col[5], col[6], col[7]);
    	case 9:
    		return Tuple.Create(col[1], col[2], col[3], col[4], col[5], col[6], col[7], col[7]);
    	case 10:
    		return Tuple.Create(col[1], col[2], col[3], col[4], col[5], col[6], col[7], Tuple.Create(col[8]));
    	case 11:
    		return Tuple.Create(col[1], col[2], col[3], col[4], col[5], col[6], col[7], Tuple.Create(col[8], col[9]));
    	case 12:
    		return Tuple.Create(col[1], col[2], col[3], col[4], col[5], col[6], col[7], Tuple.Create(col[8], col[9], col[10]));
    	case 13:
    		return Tuple.Create(col[1], col[2], col[3], col[4], col[5], col[6], col[7], Tuple.Create(col[8], col[9], col[10], col[11]));
    	case 14:
    		return Tuple.Create(col[1], col[2], col[3], col[4], col[5], col[6], col[7], Tuple.Create(col[8], col[9], col[10], col[11], col[12]));
    	default:
    		throw new ArgumentOutOfRangeException("count", count, "Can't convert array to tuple.");
    }

    a553r7fa1L3d, 05 Апреля 2012

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

    +67

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    ...
                                /*}*/
                            /*}*/
                        /*}*/
                    /*}*/
                /*}*/
            /*}*/
        /*}*/
    /*}*/
    }

    Скачал, посмотрел, офигел:D

    asgard2080, 04 Апреля 2012

    Комментарии (15)
  5. PHP / Говнокод #9833

    +156

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    Запиши эти слова в файл (например, words.txt или slova.txt) и прочитай его с помощью функции fgetcsv().
    <?php
    $x=fopen("slova.txt","r");
    $y=fgetcsv($x,filesize($x),' ');
    foreach($y as $line)
    {
        echo $line;
    };    
    ?>

    Разбиение строки на отдельные слова с сайта hashcode.ru

    Int, 01 Апреля 2012

    Комментарии (15)
  6. Си / Говнокод #9767

    +134

    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
    зависающие маллок )))
    
    void * __cdecl malloc(size_t size)
    {
    	// No fail malloc!
    	void *pMem;
    	do {
    		pMem=HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,size);
    		if(pMem==NULL) Sleep(2000);
    	} while(pMem==NULL);
    
    	return pMem;
    }
    
    void * __cdecl operator new( unsigned int cb )
    {
    	// No fail new!
    	void *pMem;
    	do {
    		pMem=HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,cb);
    		if(pMem==NULL) Sleep(2000);
    	} while(pMem==NULL);
    
    	return pMem;
    }
    
    
    что хотел аффтар ? !!! аццкий сотона
    
    int GetCfgBool(char *cfgstr,const char *key)
    {
    	return GetCfgNum(cfgstr,key)?TRUE:FALSE;
    }
    
    аффтар застрелись !!!
    
    char *GetCfgStr(char *cfgstr,const char *key)
    {
    	char *str=cfgstr;
    	
    	// Skip past name of options list
    	while(*str!='\0') str++;
    	str++;
    	// Walk through options
    	while(*str!='\0') {
    		int nLen;
    		if(*str=='B') {
    			nLen=1;
    			str+=2;
    			if(strncmp(str,key,strlen(key))==0) break;
    		} else if(*str=='S') {
    			str+=2;
    			nLen=atoi(str);
    			while(*str!=']') str++;
    			str+=2;
    			if(strncmp(str,key,strlen(key))==0) break;
    		} else if(*str=='N') {
    			str+=2;
    			char *pb;
    			pb=str;
    			while(*str!=',') str++;
    			nLen=(DWORD)str-(DWORD)pb;
    			str++;
    			pb=str;
    			while(*str!=']') str++;
    			int nLen2=(DWORD)str-(DWORD)pb;
    			if(nLen2>nLen) nLen=nLen2;
    			str+=2;
    			if(strncmp(str,key,strlen(key))==0) break;
    		}
    		while(*str!='=') str++;
    		str++;
    		str+=(nLen+1);
    	}
    	if(*str!='\0') {
    		while(*str!='=') str++;
    		return str+1;
    	}
    	
    	return NULL;
    }
    
    
    исходники BO2K гениально !!!)) 
    и как не стыдно ЭТО распространять 
    http://www.bo2k.com/

    63F45EF45RB65R6VR, 26 Марта 2012

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

    +116

    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
    97. 97
    98. 98
    99. 99
    int min = 32000;
    int max = 0;
    int mind = 0;
    int i;
    int j;
    double t;
    double f;
    int p = 0;
    double[] x = new double[4];
    double[] k = new double[4];          //массив для К
    double[,] s = { { 2, 4, 5, 1, 0, 0, 0 }, { 1, 8, 6, 0, 1, 0, 0 }, { 7, 4, 5, 0, 0, 1, 0 }, { 4, 6, 7, 0, 0, 0, 1 } };
    double[,] a = { { 2, 4, 5, 1, 0, 0, 0 }, { 1, 8, 6, 0, 1, 0, 0 }, { 7, 4, 5, 0, 0, 1, 0 }, { 4, 6, 7, 0, 0, 0, 1 } };
    double[] b = { 120, 280, 240, 360 };
    double[] c = { 10, 14, 12, 0, 0, 0, 0 };
    double[] r = new double[7];
    double[,] s1 = new double[4, 7];
    for ( i = 0; i < 4; i++)
    {
        for (j = 0; j < 7; j++)
            Console.Write(a[i, j] + "\t");
        Console.WriteLine("\n");
     
    }
    for (j = 0; j < 4; j++)
        Console.Write(b[j] + "\t");
    Console.WriteLine();
     
    for (j = 0; j < 7; j++)
        Console.Write(c[j] + "\t");
    Console.WriteLine();
    Console.WriteLine();
      //первая итерация         
        for (i = 0; i < 4; i++)
        {
            for (j = 0; j < 7; j++)
            {
    if (a[i, j] != 0)
        s[i, j] = b[i] / a[i, j];
     
    Console.Write(s[i, j] + "\t");
            }
            Console.WriteLine();
        }
        for (j = 0; j < 7; j++)
        {
            for (i = 0; i < 4; i++)
            {
    if (s[i, j] < min)
        min = Convert.ToInt32(s[i, j]);
     
     
     
            }
            r[j] = min * c[j];
            Console.Write(r[j] + "\t");
     
        }
        Console.WriteLine();
        for (j = 0; j < 7; j++)
        {
            if (r[j] > max)
            {
    max = Convert.ToInt32(r[j]);
    p = j;
     
     
     
            }
     
        }
        for (i = 0; i < 4; i++)
        {
            for (j = 0; j < 7; j++)
            {
    k[i] = a[i, p];
            }
        }
        min = 32000;
     
        for (i = 0; i < 4; i++)
        {
            if (s[i, p] < min)
            {
    min = Convert.ToInt32(s[i, p]);
    mind = i;
     
            }
            Console.WriteLine();
     
     
        }
        t = a[mind, p];
        for (i = 0; i < 4; i++)
        {
            for (j = 0; j < 7; j++)
            {
    s[i, j] = a[i, j];
            }
        }

    Полная версия: http://pastebin.com/p36MWPXR
    Этот код был выложен на одном из форумов с просьбой объяснить "Что делает приложенный код".
    Посмотрев строчек 50 из почти 300, понял, что мои нервы дороже этого говнокода.
    Форматирование практически полностью сохранено.
    Был один интересный пост к этой теме: "могу ошибаться, но по-моему - позорит автора", согласен с мнением автора этого поста.

    FutureCome, 24 Марта 2012

    Комментарии (15)
  8. PHP / Говнокод #9700

    +152

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    $mem = c("memo1")->text;
     $count =count($mem);
     for($i=0;$i<$count;$i++)
     {
     list($mai[$i], $pass[$i]) = explode(":", $mem[$i]);
     // чекаешь на валид как уже надо if( $mail[$i] == true and $pass[$i] == true) {code}
     }

    http://community.develstudio.ru/showthread.php/4745-Как-достать-текст-до-знака-quot-quot-и-после-знака-quot-quot-(делаю-чекер)

    andrey35159, 17 Марта 2012

    Комментарии (15)
  9. C# / Говнокод #9675

    +110

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    // Loop through the list of passwords and try them until one works
    for (; passwordcounter < passwords.Length; passwordcounter++) 
    { 
         //shit goes here 
    }

    ...another one.

    fr0mrus, 14 Марта 2012

    Комментарии (15)
  10. C++ / Говнокод #9573

    +1009

    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
    #define STRING_REF char*
    #define STRING_ARRAY_REF char**
    #define STRING_ARRAY_ARRAY_REF char***
    
    #define INT_ARRAY_REF int*
    #define INT_ARRAY_ARRAY_REF int**
    #define INT_ARRAY_3D_REF int***
    #define INT_ARRAY_4D_REF int****
    
    #define BYTE_ARRAY_REF signed char*
    #define BYTE_ARRAY_ARRAY_REF signed char**
    #define BYTE_ARRAY_3D_REF signed char***
    
    #define UNSIGNED_BYTE_ARRAY_REF unsigned char*
    #define UNSIGNED_BYTE_ARRAY_ARRAY_REF unsigned char**
    #define UNSIGNED_BYTE_ARRAY_3D_REF unsigned char***
    
    #define SHORT_ARRAY_REF short*
    #define SHORT_ARRAY_ARRAY_REF short**
    #define SHORT_ARRAY_3D_REF short***
    #define SHORT_ARRAY_4D_REF short****
    #define SHORT_ARRAY_5D_REF short*****

    Без комментариев

    BlaZe, 29 Февраля 2012

    Комментарии (15)
  11. C# / Говнокод #9541

    +964

    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
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace ConsoleApplication7
    {
    
        class Program
        {
            static void Main(string[] args)
            {
            op: int b, c, d, e;
                c = 0;
                e = 1;
                Console.WriteLine("a - посчитать сумму");
                Console.WriteLine("b - посчитать произведение");
                Console.Write("вариант=");
                string p = Console.ReadLine();
                if (p == "a")
                {
                ok: Console.Write("С какого числа считаем:"); d = Convert.ToInt32(Console.ReadLine());
                    if (d == 0) goto op;
                    else
                    {
                        Console.Write("Число до которого считаем:"); b = Convert.ToInt32(Console.ReadLine());
                        for (int a = d; a <= b; a++)
                        {
                            c = c + a;
                            Console.WriteLine(c);
                        }
                        Console.WriteLine("Сумма цифр от " + d + " до " + b + " = " + c);
                        Console.ReadLine();
                        goto ok;
                    }
                }
                if (p == "b")
                {
                ol: Console.Write("С какого числа считаем:"); d = Convert.ToInt32(Console.ReadLine());
                    if (d == 0) goto op;
                    else
                    {
                        Console.Write("Число до которого считаем:"); b = Convert.ToInt32(Console.ReadLine());
                        for (int a = d; a <= b; a++)
                        {
                            e = e * a;
                            Console.WriteLine(e);
                        }
                        Console.WriteLine("Произведение чисел от " + d + " до " + b + " = " + e);
                        Console.ReadLine();
                        goto ol;
                    }
                }
                else goto op;
            }
        }
    }

    Нашёл на одном форуме

    high-five, 25 Февраля 2012

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