Monday, April 7, 2014

Personal Reflection #4

 I found the last activity today really fun and challenging. However, at the same time it was fairly frustrating, since I was only using a guess and test method. While I did end up solving the grid, I thought it would be fun to come up with a computer program that did the same thing. The algorithm is not as creative as I would like it to be (I'll have to improve it when I have time), but basically it runs through every possible combination of having 1-9 in the spaces. While it is going through, it only keeps answers that make all of the math for the rows and columns true, and from there it only keeps the answers (in this case, only the 1) where 1-9 are only used once. The actual writing of the code did take me a little bit of time (about as much as it did to solve it on paper) but when I actually run it, it only takes the computer 3 seconds, so it is quite an improvement :)

If anyone knows java/ is interested in seeing it, here is a link.
http://justpaste.it/f0k0

No comments:

Post a Comment