Last active
December 17, 2015 01:59
-
-
Save alistra/5532506 to your computer and use it in GitHub Desktop.
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
NSMutableArray *operations = [NSMutableArray array]; | |
[self.puppets.copy enumerateObjectsUsingBlock:^(AnswerKeyPuppet *checkedPuppet, | |
NSUInteger idx, | |
BOOL *stop) { | |
[self.puppets.copy enumerateObjectsUsingBlock:^(AnswerKeyPuppet *puppet, | |
NSUInteger idx2, | |
BOOL *stop2) { | |
[operations addObject:[NSBlockOperation blockOperationWithBlock:^{ | |
if (idx2 >= idx) { | |
*stop2 = YES; | |
return; | |
} | |
if ([puppet isEqual:checkedPuppet]) { | |
return; | |
} | |
if ([checkedPuppet isCollidingWith:puppet]) { | |
[self.collisions addObject:checkedPuppet]; | |
[self.collisions addObject:puppet]; | |
} | |
}]]; | |
}]; | |
}]; | |
for(NSOperation *o in operations) { | |
[self.checkQueue addOperation:o]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment