Click here to Skip to main content
15,894,907 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: More on string comparison Pin
musefan25-Feb-11 6:00
musefan25-Feb-11 6:00 
GeneralRe: More on string comparison Pin
oggenok6425-Feb-11 21:30
oggenok6425-Feb-11 21:30 
GeneralRe: More on string comparison [modified] Pin
musefan28-Feb-11 23:56
musefan28-Feb-11 23:56 
GeneralComparing objects? SIMPLE! Pin
TorstenH.24-Feb-11 3:32
TorstenH.24-Feb-11 3:32 
GeneralRe: Comparing objects? SIMPLE! Pin
_Erik_24-Feb-11 5:41
_Erik_24-Feb-11 5:41 
GeneralHow not to string a date Pin
PIEBALDconsult24-Feb-11 2:18
mvePIEBALDconsult24-Feb-11 2:18 
GeneralRe: How not to string a date Pin
musefan25-Feb-11 2:51
musefan25-Feb-11 2:51 
Ranti asked to explain this code, but i think i prefer a mental hospital . not a single description about what he done Pin
kdgupta8723-Feb-11 10:54
kdgupta8723-Feb-11 10:54 
void show()
       {
           int man=5;
       string action = string.Empty;
           for (int j = 1; j < indx-1;j++ )
           {
               for (int k = 1; k < indy-1; k++)
               {
                   Console.Write(arr[j,k]+ " ");
                   int q = Math.Abs(arr[j - 1, k - 1] - arr[j, k]);
                   int w = Math.Abs(arr[j - 1, k] - arr[j, k]);
                   int e = Math.Abs(arr[j -1, k +1] - arr[j, k]);
                   int a = Math.Abs(arr[j , k - 1] - arr[j, k]);
                   int d = Math.Abs(arr[j, k + 1] - arr[j, k]);
                   int z = Math.Abs(arr[j + 1, k - 1] - arr[j, k]);
                   int x = Math.Abs(arr[j + 1, k ] - arr[j, k]);
                   int c = Math.Abs(arr[j + 1, k +1] - arr[j, k]);
                   if (q < man && w < man && e < man && a < man && d < man && z < man && x < man && c < man)
                   {
                       action = string.Empty;
                   }
                   else {//q=w=e
                       if (arr[j - 1, k - 1] == arr[j - 1, k] && arr[j - 1, k] == arr[j + 1, k + 1]) {
                           //q=w=e=a=d
                           if (arr[j - 1, k] == arr[j, k - 1] && arr[j, k - 1] == arr[j - 1, k])
                           {
                               //q=w=e=a=d=z=x
                               if (arr[j - 1, k] == arr[j + 1, k - 1] && arr[j, k - 1] == arr[j + 1, k])
                               {
                                   action = "c";
                               }
                               else
                               { // q=w=e=a=d=z
                                   if (arr[j - 1, k] == arr[j + 1, k - 1])
                                   {
                                       //x=c
                                       if (arr[j + 1, k] == arr[j + 1, k + 1]) { action = "xc"; }
                                       else//x!=c
                                       { action = "x"; }
                                   }

                                   else
                                   { //q=w=e=a=d!=z
                                       if (arr[j + 1, k - 1] == arr[j + 1, k + 1])
                                       { //x=c
                                           if (arr[j + 1, k] == arr[j + 1, k + 1]) { action = "zxc"; }
                                           else//x!=c
                                           { action = "zx"; }
                                       }
                                       else//x!=c
                                       { action = "z"; }
                                   }
                               }

                           }
                           else//q=w=e!a!d
                           {
                               //a=d
                               if (arr[j, k + 1] == arr[j, k - 1] )
                               { //a=d=x=c=z
                                   if (arr[j, k + 1] == arr[j + 1, k - 1] && arr[j, k - 1] == arr[j + 1, k] && arr[j, k - 1] == arr[j + 1, k+1])
                                   {
                                       action = "adzxc";
                                   }
                                   else
                                   {
                                       if (arr[j, k + 1] == arr[j + 1, k - 1] && arr[j, k - 1] == arr[j + 1, k])
                                       {
                                           action = "adzx";
                                       }
                                       else
                                       {
                                           if (arr[j, k + 1] == arr[j + 1, k - 1])
                                           {
                                               action = "adz";
                                           }
                                           else
                                           { action="adx"}

                                       }
                                   }
                               }
                               else{//.
                               }
                           }

this "else if" goes for another 5 pages
Mad | :mad: Mad | :mad: Mad | :mad: not a single comentUnsure | :~ Unsure | :~ Unsure | :~
GeneralRe: i asked to explain this code, but i think i prefer a mental hospital . not a single description about what he done Pin
AspDotNetDev23-Feb-11 11:02
protectorAspDotNetDev23-Feb-11 11:02 
GeneralRe: i asked to explain this code, but i think i prefer a mental hospital . not a single description about what he done Pin
kdgupta8723-Feb-11 11:30
kdgupta8723-Feb-11 11:30 
GeneralRe: i asked to explain this code, but i think i prefer a mental hospital . not a single description about what he done Pin
Chris Meech24-Feb-11 5:16
Chris Meech24-Feb-11 5:16 
GeneralRe: i asked to explain this code, but i think i prefer a mental hospital . not a single description about what he done Pin
Asday4-Mar-11 0:21
Asday4-Mar-11 0:21 
GeneralRe: i asked to explain this code, but i think i prefer a mental hospital . not a single description about what he done Pin
RobCroll23-Feb-11 16:35
RobCroll23-Feb-11 16:35 
GeneralRe: i asked to explain this code, but i think i prefer a mental hospital . not a single description about what he done Pin
kdgupta8723-Feb-11 19:00
kdgupta8723-Feb-11 19:00 
GeneralRe: i asked to explain this code, but i think i prefer a mental hospital . not a single description about what he done Pin
_Erik_24-Feb-11 5:28
_Erik_24-Feb-11 5:28 
GeneralRe: i asked to explain this code, but i think i prefer a mental hospital . not a single description about what he done Pin
phil.o24-Feb-11 5:43
professionalphil.o24-Feb-11 5:43 
GeneralRe: i asked to explain this code, but i think i prefer a mental hospital . not a single description about what he done Pin
Keith.Badeau24-Feb-11 5:49
Keith.Badeau24-Feb-11 5:49 
GeneralRe: i asked to explain this code, but i think i prefer a mental hospital . not a single description about what he done Pin
TorstenH.24-Feb-11 20:55
TorstenH.24-Feb-11 20:55 
GeneralRe: i asked to explain this code, but i think i prefer a mental hospital . not a single description about what he done Pin
BillW3314-Mar-11 3:09
professionalBillW3314-Mar-11 3:09 
GeneralWhen professionals don't think PinPopular
OriginalGriff17-Feb-11 23:57
mveOriginalGriff17-Feb-11 23:57 
GeneralRe: When professionals don't think Pin
Luc Pattyn18-Feb-11 0:47
sitebuilderLuc Pattyn18-Feb-11 0:47 
GeneralRe: When professionals don't think Pin
Bernhard Hiller18-Feb-11 4:07
Bernhard Hiller18-Feb-11 4:07 
GeneralRe: When professionals don't think Pin
Chris Meech18-Feb-11 5:00
Chris Meech18-Feb-11 5:00 
GeneralRe: When professionals don't think Pin
OriginalGriff18-Feb-11 5:41
mveOriginalGriff18-Feb-11 5:41 
GeneralRe: When professionals don't think Pin
Momony22-Feb-11 3:59
Momony22-Feb-11 3:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.