|Think about Loose Coupling|
Re^2: Golf: Movie style code cracker.by BrowserUk (Pope)
|on Sep 15, 2008 at 02:19 UTC||Need Help??|
Does this mean that the implementation must actually choose C before displaying it digit by digit? Or would it (theoretically) be okay if the digits were chosen as they are being displayed (i.e. the second digit is not known to the program before the first has been shown)?
As my own attempt uses on the latter approach, I have to say it is acceptable. Others are free to disagree and discount my attempt. Here is how I justify it. Istarted out with this to fulfill the 'spec':
I then started golfing and here are the steps I went through:
At the transition from step 2 to step 3, I notice that I had these 3 pieces of code:
Which is equivalent to $tmp = val; $target = other value; $target = $tmp.
Eliminating the temporary value and intermediate steps is the essence of golf, so I conclude that step 3 above is logically equivalent to step 2. Others may wish they had thought of it...or condemn it as a step too far?
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.