there was an error in the python script which was making the 20x20 case 400x400.  I fixed it, and the program handled 20x20 no problem (0.024 seconds); however, I then tried 50x50 and it worked, but it took 2 minutes, 47 seconds when (if O(n^4)) it should only be on the order of 1 second.  Clearly the code is not as efficient as it should be.
there was an error in the python script which was making the 20x20 case 400x400.  I fixed it, and the program handled 20x20 no problem (0.024 seconds); however, I then tried 50x50 and it worked, but it took 2 minutes, 47 seconds when (if O(n^4)) it should only be on the order of 1 second.  Clearly the code is not as efficient as it should be.