From: Christer Nilsson Date: 2005-12-31T01:20:29+09:00 Subject: conciseness v. clarity (was Re: Sudoku) Craig Demyanovich wrote: > The variable names are horrible. Yes, you are correct. This is puzzle code, not production code. So part of this is being puzzled! :-) Joke aside, I considered using better variable names instead of a,b,c and d, but did not find good candidates. Let me explain: a, c = row.divmod(3) # row in 0..8 b, d = col.divmod(3) # col in 0..8 Maybe a=rowMajor, c=rowMinor, b=colMajor and d=colMinor would be more helpful. Fixing rowMajor and colMajor gives a 3x3 block: s[rowMajor][colMajor][x][y], x in 0..2, y in 0..2 Fixing rowMajor and rowMinor gives a row s[rowMajor][x][rowMinor][y] Fixing colMajor and colMinor gives a column s[x][colMajor][y][colMinor] I hope this clarifies the code. Christer -- Posted via http://www.ruby-forum.com/.