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
- (void)testEndConditionsDeck { | |
RMSGoFishGame *game = [RMSGoFishGame new]; | |
[game deal]; | |
RMSGoFishPlayer *player1 = [game.players objectAtIndex:(NSUInteger)0]; | |
RMSGoFishPlayer *player2 = [game.players objectAtIndex:(NSUInteger)1]; | |
RMSGoFishPlayer *player3 = [game.players objectAtIndex:(NSUInteger)2]; | |
RMSGoFishPlayer *player4 = [game.players objectAtIndex:(NSUInteger)3]; | |
game.deck.cards = [NSMutableArray new]; | |
[game gameLoop]; | |
STAssertEquals(player1.hand.count, (NSUInteger)5,@"Player 1 played after the game was over!"); |
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
- (void)removeAllSubviewsFrom:(UIView *)view { | |
NSArray *subviews = [view subviews]; | |
for (UIView *subview in subviews) { | |
[subview removeFromSuperview]; | |
} | |
} |
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
CGFloat xOffset = 240 - (((player.hand.count*20)+52)/2); | |
__block CGPoint location = CGPointMake ((CGFloat) xOffset, (CGFloat) 0); | |
[player.hand enumerateObjectsUsingBlock:^(RMSPlayingCard *obj, NSUInteger idx, BOOL *stop) { | |
NSString *rank = obj.rank; | |
NSString *suit = obj.suit; | |
UIImage *cardImage = [UIImage imageNamed:[NSString stringWithFormat:@"%@%@.png", [[suit substringToIndex:1] lowercaseString], [[rank substringToIndex:1] lowercaseString]]]; | |
UIImageView *cardView = [[UIImageView alloc] initWithFrame:CGRectMake(location.x, location.y, cardImage.size.width, cardImage.size.height)]; | |
[cardView setImage:cardImage]; | |
[self.handView addSubview: cardView]; |
NewerOlder