Pete's Log: it's 4:20 am...
Entry #878, (Coding, Hacking, & CS stuff)(posted when I was 22 years old.)
it's 4:20 am, do you know where your horn section is?
I did some research on saturday night, and apparently 420 is not a police code for anything related to marijuana anywhere. But I found various other entertaining possible explanations for how the 420 term came into use...
After 20 minutes of trying to fall asleep, I am struck out of the blue with a revelation: "use brute force, you fool!" ... So I've been playing with wr94's problem e for a few days now. I actually started laying out some code for it today. The basic problem is solving mastermind. You're given a series of guesses and what the corresponding hint was, and are then supposed to say what the number is or if it can be determined. So I've been working up a nice solving sort of approach, and I think I may or may not have been able to reduce this into a working solution. But this is foolish, and I don't know why I never thought of the alternative. So in this particular case, we've four positions, each of which can be 0-9. So there's only 10^4 possible combinations. So anything O(n) on the number of combinations will easily run in a few seconds of CPU time. We're told that the number of guesses given us will be less than 10, so to cycle through 10 guesses for each combination and see if it is a possible solution is trivial. Why didn't I think of this long ago? I've no clue.
But in thinking about this problem, I did some research on the whole mastermind thing online. Turns out that it is proven that (some particular permutation of) mastermind can always be solved in five guesses or less. And Knuth himself actually wrote some paper about an algorithm that would solve mastermind in six guesses or less, but with a lower average number of guesses than the algorithm that had the five guess worst case. Fun stuff. I don't think I've actually played mastermind since before moving to the US...
oh, and no, I did not finish comp arch...