And you can simplify the code with something like this for all of the "grid=" statements new_grid = [[], [0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0], [2,0,2,0],[0,4,0,8],[0,16,0,128],[2,2,2,2], [0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]], [2,0,2,0],[0,4,0,8],[0,16,0,128],[2,2,2,2], [2,2,2,2],[2,2,2,2],[2,2,2,2],[2,2,2,2]] ## etc grid=new_grid[test]
This also assumes that you want grid to be a list, and not a list of lists. -- https://mail.python.org/mailman/listinfo/python-list