Current Forum: Homework 5 - Parts 1 and 2 |
Date: Sat Nov 10 2001 9:22 pm |
Author: Abeles, Peter J. <pja@andrew.cmu.edu> |
Subject: Re: 10 lines?? I only needed 3 - That must be some ugly code |
|
|
yes you can use for loops to get rid of the toggle. Depending on your formating style that might not reduce the number of lines. Unless I'm missing some sort of trick/dont fully understand the system (which I think I am) , you count all statements as a line and you dont do anything "ugly" to throw as much inside a line as posible. The most compact thing I can think of is 3 for loops, 3 if, 3 function calls, 1 try/catch. Which under my formating comes out to 11 lines is added to the function.
If someone has some code that wouldnt qualify as an entry into the code obfusication contest that is only 3 lines (including ALL the code you added to the function) could you e-mail me off the list?
- Peter |
|