Click here to Skip to main content
15,889,863 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: Nesting level: 9001 Pin
Chris Meech31-May-12 8:22
Chris Meech31-May-12 8:22 
GeneralRe: Nesting level: 9001 Pin
harold aptroot31-May-12 9:03
harold aptroot31-May-12 9:03 
GeneralRe: Nesting level: 9001 Pin
PIEBALDconsult31-May-12 9:07
mvePIEBALDconsult31-May-12 9:07 
GeneralRe: Nesting level: 9001 Pin
harold aptroot31-May-12 9:18
harold aptroot31-May-12 9:18 
GeneralRe: Nesting level: 9001 Pin
JackDingler4-Jun-12 7:26
JackDingler4-Jun-12 7:26 
GeneralRe: Nesting level: 9001 Pin
AspDotNetDev31-May-12 10:54
protectorAspDotNetDev31-May-12 10:54 
GeneralRe: Nesting level: 9001 Pin
Sander Rossel1-Jun-12 11:41
professionalSander Rossel1-Jun-12 11:41 
GeneralRe: Nesting level: 9001 Pin
Oscar04-Jun-12 9:30
Oscar04-Jun-12 9:30 
How about something along the lines of:

C#
size = 29;
if(width > 11 || height > 4) size++;
if(width > 13 || height > 5) size++;
if(width > 15 || height > 6) size++;
if(width > 18 || height > 7) size++;
if(width > 19 || height > 8) size++;
if(width > 21 || height > 10) size++;

switch(size) {
  case 29: Spread(width, 15, 16, xpos, ypos); break;
  case 30: Spread(width, 13, 14, xpos, ypos); break;
  case 31: Spread(width, 11, 12, xpos, ypos); break;
  case 32: Spread(width, 9, 10, xpos, ypos); break;
  case 33: Spread(width, 9, 9, xpos, ypos); break;
  case 34: Spread(width, 8, 7, xpos, ypos); break;
  case 35: SpreadCompressed(width, width > 21, height > 10, xpos, ypos); break;
}

GeneralRe: Nesting level: 9001 Pin
harold aptroot4-Jun-12 9:42
harold aptroot4-Jun-12 9:42 
GeneralRe: Nesting level: 9001 Pin
Oscar05-Jun-12 6:41
Oscar05-Jun-12 6:41 
GeneralRe: Nesting level: 9001 Pin
englebart5-Jun-12 6:01
professionalenglebart5-Jun-12 6:01 
GeneralJust go home PinPopular
loctrice31-May-12 5:21
professionalloctrice31-May-12 5:21 
GeneralRe: Just go home PinPopular
ekolis31-May-12 5:44
ekolis31-May-12 5:44 
GeneralRe: Just go home Pin
BobJanova31-May-12 6:01
BobJanova31-May-12 6:01 
GeneralRe: Just go home Pin
loctrice31-May-12 6:17
professionalloctrice31-May-12 6:17 
GeneralRe: Just go home Pin
Chris Meech31-May-12 6:29
Chris Meech31-May-12 6:29 
GeneralRe: Just go home Pin
loctrice31-May-12 6:51
professionalloctrice31-May-12 6:51 
GeneralRe: Just go home Pin
enhzflep31-May-12 6:30
enhzflep31-May-12 6:30 
GeneralRe: Just go home Pin
Paul Conrad31-May-12 10:14
professionalPaul Conrad31-May-12 10:14 
GeneralRe: Just go home Pin
BillW331-Jun-12 3:11
professionalBillW331-Jun-12 3:11 
GeneralRe: Just go home Pin
loctrice1-Jun-12 4:08
professionalloctrice1-Jun-12 4:08 
GeneralRe: Just go home Pin
BillW331-Jun-12 12:52
professionalBillW331-Jun-12 12:52 
GeneralRe: Just go home Pin
Sander Rossel1-Jun-12 11:38
professionalSander Rossel1-Jun-12 11:38 
Jokevar tomorrow = ? PinPopular
Christian Brüggemann29-May-12 3:05
Christian Brüggemann29-May-12 3:05 
GeneralRe: var tomorrow = ? PinPopular
leppie29-May-12 5:40
leppie29-May-12 5:40 

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.