Created
May 29, 2012 21:32
-
-
Save graingert/2830859 to your computer and use it in GitHub Desktop.
Finding a communications tree 4
This file contains hidden or 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
| doF() | |
| if waitB is 0 and no unlabelled pins | |
| send B to Parent //Tell parent we’re done | |
| else | |
| send F down next unlabelled pin //Move onto the next child pin | |
| label pin Child | |
| waitB++ //Now we have to wait for yet another pin to finish | |
| return | |
| CASE F: //Only accept parenthood if we haven’t already got a parent | |
| if no Parent pin labelled //we should not have child pins either here. | |
| label incoming pin Parent | |
| waitB=0 | |
| doF() | |
| else | |
| label incoming pin Unused //We already have a parent GTFO | |
| send X to incoming pin | |
| return | |
| CASE B: | |
| waitB-- | |
| doF() | |
| return | |
| CASE X: | |
| label incoming port Unused | |
| waitB-- | |
| doF() | |
| return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment