cs193p – Assignment #3 Task #9

Please note, this blog entry is from a previous course. You might want to check out the current one.

Do something sensible when no more cards are in the deck and the user requests more.

There a various “sensible” solutions, lets just disable the button and gray it out, when there are no cards left in the deck:

- (IBAction)addCardsButtonPressed:(UIButton *)sender {
    ...
    if (self.game.deckIsEmpty) {
        sender.enabled = NO;
        sender.alpha = 0.5;
    }
}

Continue reading “cs193p – Assignment #3 Task #9”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #3 Task #8

Please note, this blog entry is from a previous course. You might want to check out the current one.

Automatically scroll to show any new cards when you add some in the Set game.

After a the data has been reloaded scroll to the last item:

- (IBAction)addCardsButtonPressed:(UIButton *)sender {
    ...    
    [self.cardCollectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:(self.game.numberOfCards - 1) inSection:0]
                                    atScrollPosition:UICollectionViewScrollPositionBottom
                                            animated:YES];
}

The complete code is available on github.

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #3 Task #7

Please note, this blog entry is from a previous course. You might want to check out the current one.

In the Set game (only), the user must always have the option somewhere in the UI of requesting 3 more cards to be dealt at any time if he or she is unable to locate a Set.

In storyboard drag out a new button set its tag to 3, provide a suitable name and link it to an action in the game view controller (or the set-game view controller – either works).

cs193p - assignment #3 tast #7
cs193p – assignment #3 tast #7

Continue reading “cs193p – Assignment #3 Task #7”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #3 Task #6

Please note, this blog entry is from a previous course. You might want to check out the current one.

Set cards must have the “standard” Set look and feel (i.e. 1, 2 or 3 squiggles, diamonds or ovals that are solid, striped or unfilled, and are either green, red or purple). You must draw these using Core Graphics and/or UIBezierPath. You may not use images or attributed strings. Use the PlayingCardView from the in-class demo to draw your Playing Card game cards.

Adjust the drawRect: method of the set-card view to call a new method to draw the symbal (which is actually not really necessary but makes the code a little bit more sructurized):
Continue reading “cs193p – Assignment #3 Task #6”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #3 Task #5

Please note, this blog entry is from a previous course. You might want to check out the current one.

When a Set match is successfully chosen, the cards should be removed from the game (not just blanked out or grayed out, but actually removed from the user-interface and the remaining cards rearranged to use up the space that was freed up in the user- interface).

The card-matching-game model needs a new property to show how many cards are currently available, and a new property to remove a specific card:
Continue reading “cs193p – Assignment #3 Task #5”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #3 Task #4

Please note, this blog entry is from a previous course. You might want to check out the current one.

The user must then be able to choose matches just like in last week’s assignment.

In storyboard add a tap gesture to the collection view and connect it to the flipCard method and done.

… actually … nothing will happen yet. Because the view does not know it has changed. It is necessary to call setNeedsDisplay when one of the properties has changed:
Continue reading “cs193p – Assignment #3 Task #4”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #3 Task #3

Please note, this blog entry is from a previous course. You might want to check out the current one.

For Set, 12 cards should be initially dealt and Set cards should always show what’s on them even if they are technically “face down”. For the Playing Card game deal 22 cards, all face down.

Start by removing the card buttons from the set view controller in storyboard and remove the parts in the set-view-controller class which access the former card buttons – at the same time you can move lots of the public interface of the generic game-view-controller class back to be private … which is mostly cosmetic …

And because there are no card buttons any more set the starting number of cards to 12:
Continue reading “cs193p – Assignment #3 Task #3”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail