Timeline for Elegant solution for coloring chess tiles
Current License: CC BY-SA 3.0
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Dec 5, 2012 at 22:46 | comment | added | Jim | Perhaps a good example of why elegance isn't always the best solution. ;) | |
| Dec 5, 2012 at 17:56 | comment | added | Amir Afghani | I see. +1 for the answer. | |
| Dec 5, 2012 at 15:10 | comment | added | MSalters | IsSecondRow really should have been named IsEvenRow. It's a rather convoluted way to get the low bit of row: first shift the bits of row 3 positions to the right, then discard all but the LSB of row, then check if the 4th bit of cellnum is set. | |
| Dec 5, 2012 at 6:20 | comment | added | Jim | I don't understand your question. The modulus 16 operation reduces the problem to two rows. The second row follows a different pattern than the first. The if statement only evaluates to true if either it is an even-numbered tile XOR not in the second row. If both are true, it evaluates to false. Review the XOR operator: msdn.microsoft.com/en-us/library/zkacc7k1.aspx | |
| Dec 5, 2012 at 5:55 | comment | added | Amir Afghani | Why do you single out the second row? This should work for all 8 rows | |
| Dec 5, 2012 at 5:48 | history | answered | Jim | CC BY-SA 3.0 |