From: "Kroeger Simon (ext)" Date: 2005-08-24T17:59:32+09:00 Subject: Re: [QUIZ] Sodoku Solver (#43) > Ok, here's my latest. My big speedup was figuring out that if I make > a bad guess, I just eliminate that possibility and re-solve. See the > startGuessing method.. hmm ... I use cells with only 2 possibilities left for guessing, so if I guess wrong, at least I know the right guess. (of course only if there are cells with 2 possibilities - but that happens often) If I interpret your guess method right you are doing the same thing. So I do not understand where the speedup comes from. BTW a lot of speed comes from rather minor changes, like changing a_set -= [a_value] to a_set.delete(a_value) this makes a HUGE difference. This is obvious if you take some time to think about it, but it would be realy nice to optimize operators like -= where you have no chance to use the intermediate objects anyway. And I don't know why Set.new(another_set) seems to be faster than another_set.clone I didn't take the time to look into the implementations, yet. Your 'findPairs' looks promissing... I think I will try something similar... > It now solves #30 in 0.194s, and #55 in 0.124 Impressive! > ( I'm not sure which puzzle you called #1) The one posted by David Tran, with only 17 numbers given: +-------+-------+-------+ | _ _ 6 | 9 _ _ | _ 7 _ | | _ _ _ | _ 1 _ | _ _ 2 | | 8 _ _ | _ _ _ | _ _ _ | +-------+-------+-------+ | _ 2 _ | _ _ _ | _ _ 4 | | _ _ _ | _ _ _ | _ _ 1 | | _ _ 5 | _ _ 6 | _ _ _ | +-------+-------+-------+ | _ _ _ | _ _ _ | _ 6 _ | | _ _ _ | _ _ 2 | _ 5 _ | | _ 1 _ | _ 4 3 | _ _ _ | +-------+-------+-------+ cheers Simon