Another small addition to the code.
While adding jump labels, as mentioned in the previous post, the jump label should not be adjacent to a node as jumps should not happen from one node directly to the other but along segments of a branch. To ensure this doesn't happen:
No need to post the entire code again.
A couple of additional comments:
1. Quite a lot of rules have been fabricated and messages printed, but no exceptions have been generated. This will be left for later.
2. Can different sheets of the same spreadsheet be used maybe for larger circuits? Worth looking into.
While adding jump labels, as mentioned in the previous post, the jump label should not be adjacent to a node as jumps should not happen from one node directly to the other but along segments of a branch. To ensure this doesn't happen:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Check if a jump is not next to a node. | |
for c1 in range(len(node_list)): | |
for jump_check_dir in node_iter_rule[c1].keys(): | |
if (jump_check_dir=="up"): | |
if (len(conn_matrix[node_list[c1][0]-1][node_list[c1][1]])>3): | |
if (conn_matrix[node_list[c1][0]-1][node_list[c1][1]].lower()[0:4]=="jump"): | |
print "Error. Jump can't be next to a node. Check jump at row %d column %d." %(node_list[c1][0]-1, node_list[c1][1]) | |
if (jump_check_dir=="down"): | |
if (len(conn_matrix[node_list[c1][0]+1][node_list[c1][1]])>3): | |
if (conn_matrix[node_list[c1][0]+1][node_list[c1][1]].lower()[0:4]=="jump"): | |
print "Error. Jump can't be next to a node. Check jump at row %d column %d." %(node_list[c1][0]+1, node_list[c1][1]) | |
if (jump_check_dir=="left"): | |
if (len(conn_matrix[node_list[c1][0]][node_list[c1][1]-1])>3): | |
if (conn_matrix[node_list[c1][0]][node_list[c1][1]-1].lower()[0:4]=="jump"): | |
print "Error. Jump can't be next to a node. Check jump at row %d column %d." %(node_list[c1][0], node_list[c1][1]-1) | |
if (jump_check_dir=="right"): | |
if (len(conn_matrix[node_list[c1][0]][node_list[c1][1]+1])>3): | |
if (conn_matrix[node_list[c1][0]][node_list[c1][1]+1].lower()[0:4]=="jump"): | |
print "Error. Jump can't be next to a node. Check jump at row %d column %d." %(node_list[c1][0], node_list[c1][1]+1) |
No need to post the entire code again.
A couple of additional comments:
1. Quite a lot of rules have been fabricated and messages printed, but no exceptions have been generated. This will be left for later.
2. Can different sheets of the same spreadsheet be used maybe for larger circuits? Worth looking into.
No comments:
Post a Comment