1. C# / Говнокод #92

    +31

    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
    public TourResult NextTour()
          {
            TourResult lresult = new TourResult();
            lresult.TourNum = mCurrentTour;
            lresult.IsEnd = false;
            Card.Face[] lCurrFaces = getCurrentTourFace();
            int lMaxFace = 0;
            foreach (Card.Face lFace in lCurrFaces)
            {
              lMaxFace = ((int)lFace) > lMaxFace ? (int)lFace : lMaxFace;
            }
            int lMaxFaceCount = 0;
            int lNotZeroCount = 0;
            foreach (Card.Face lFace in lCurrFaces)
            {
              lMaxFaceCount = (int)lFace == lMaxFace ? lMaxFaceCount + 1 : lMaxFaceCount + 0;
              lNotZeroCount = (int)lFace != 0 ? lNotZeroCount + 1 : lNotZeroCount + 0;
            }
    
            if (lMaxFaceCount > 1)
            {
              mUnknowTour = mUnknowTour > -1 ? mUnknowTour : mCurrentTour;
              mCurrentTour++;
              lresult.Message = "Одинаковые карты, надо разиграть";
              lresult.PlayerIndex = -1;
              lresult.Face = (Face)lMaxFace;
              return lresult;
            }
            int lMaxFaceIndex;
            for (lMaxFaceIndex = 0; lMaxFaceIndex < lCurrFaces.Length; lMaxFaceIndex++)
            {
              if (((int)lCurrFaces[lMaxFaceIndex]) == lMaxFace)
                break;
            }
            if (lNotZeroCount < 2)
            {
              lresult.Message = "победил";
              lresult.PlayerIndex = lMaxFaceIndex;
              lresult.IsEnd = true;
              return lresult;
            }
            int lPlaerCardsCount = mArr[lMaxFaceIndex].Count;
            if (mUnknowTour > -1)
            {
              for (int i = mUnknowTour; i <= mCurrentTour; i++)
              {
                AddCardsToPlayer(i, lMaxFaceIndex);
              }
              mUnknowTour = -1;
            }
            else
            {
              AddCardsToPlayer(mCurrentTour, lMaxFaceIndex);
            }
    
            lresult.Message = "загреб краты";
            for (int i = lPlaerCardsCount; i < mArr[lMaxFaceIndex].Count; i++)
            {
              lresult.Message += string.Format(" {0},", GetCardName(mArr[lMaxFaceIndex][i]));
            }
    
            lresult.PlayerIndex = lMaxFaceIndex;
            mCurrentTour++;
            return lresult;
          }

    Говнокод из карточной игры в пьяницу

    guest, 10 Декабря 2008

    Комментарии (8)
  2. C# / Говнокод #90

    −10.5

    1. 1
    this.SelectedDate = this.SelectedDate;

    Проверяем дату на корректность...

    guest, 10 Декабря 2008

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

    +30

    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
    private static string identifier(string wmiClass, string wmiProperty)
                {
                    string result = "";
                    System.Management.ManagementClass mc =
                new System.Management.ManagementClass(wmiClass);
                    System.Management.ManagementObjectCollection moc = mc.GetInstances();
                    foreach (System.Management.ManagementObject mo in moc)
                    {
                        //Only get the first one
                        if (result == "")
                        {
                            try
                            {
                                result = mo[wmiProperty].ToString();
                                break;
                            }
                            catch
                            {
                            }
                        }
                    }
                    return result;
                }

    guest, 08 Декабря 2008

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

    +16.9

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    bool value;
    if(value.ToString.Length() == 4)
      return true;
    else if(value.ToString.Length() == 5)
      return false;
    
    else
      return !true && !false;

    Проверка условия

    guest, 05 Декабря 2008

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