cs193p – Assignment #2 Extra Task #2

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

Change the image on the back of the cards (i.e. something other than a Stanford logo). Also, set the application and launch image icons for Matchismo. Try to get the resolutions right for each application icon and launch image. Let your creativity run wild when it comes to designing an icon!

Using your favorite graphic program, create two new images for the front and the back of the card, and export each of them in two formats 40×60 and 80×120. Visit your image assets and drag in the new images:

cs193p – assignment #2 extra task #2 - card front
cs193p – assignment #2 extra task #2 – card front
cs193p – assignment #2 extra task #2 - card back
cs193p – assignment #2 extra task #2 – card back


Continue reading “cs193p – Assignment #2 Extra Task #2”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #2 Extra Task #1

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

Add a UISlider to your UI which travels through the history of the results of the currently-being-played game’s card choices and display it to the user (moving the slider will modify the contents of the text label you created for Required Task 5 to show its state over the course of the game). When you are displaying past results, you probably want the text label to be grayed out or some such (take a look at the UIView method alpha and note that UISlider inherits from UIView) so it’s clear that it’s “the past.” And every time a new choice happens, you probably want to “jump to the present” in the slider. Implementing this extra credit item will require you to familiarize yourself with UISlider’s API and to add a data structure to your Controller to keep track of the history. It can be implemented in fewer than a dozen lines of code.

The history of previous card flips has nothing to do with the model, thus we a will add this feature in the view control. First create an array property to hold the history and use lazy instantiation:

@property (strong, nonatomic) NSMutableArray *flipHistory;
...
- (NSMutableArray *)flipHistory
{
    if (!_flipHistory) {
        _flipHistory = [NSMutableArray array];
    }
    return _flipHistory;
}

Continue reading “cs193p – Assignment #2 Extra Task #1”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #2 Task #7

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

Do not change the method signature of any public method we went over in lecture. It is fine to change private method signatures (though you should not need to) or to add public and/or private methods.

… done

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #2 Task #6

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

Change the UI of your game to have 30 cards instead of 12. See Hints about the size of cards.

Change the size of the cards – instead of using the “hint” you can also use the size inspector to set the size directly. Adjust the positions of the cards and add new lines of cards using copy and paste. Don’t forget to wire all new cards to the card-buttons array of the view controller:

cs193p – assignment #2 task #6 - 30 cards
cs193p – assignment #2 task #6 – 30 cards

The complete code is available on github.

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #2 Task #5

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

Add a text label somewhere which desribes the results of the last consideration by the CardMatchingGame of a card choice by the user. Examples: “Matched J♥ J♠ for 4 points.” or “6♦ J♣ don’t match! 2 point penalty!” or “8♦” if only one card is chosen or even blank if no cards are chosen. Do not violate MVC by building UI in your Model. “UI” is anything you are going to present to the user. This must work properly in either mode of Required Task 3.

Lets muse a little bit about what to put where … How the actual text look like, e.g. you could use another language, or other wording, or even if you want to separated the card descriptions by spaces or commas, has nothing to do with the game but with the presentation and should be part of the view. However after you have matched cards, the view itself does not know which cards have been selected last, and cannot even derive that information from the model. It also does not know anything about a penalty or bonus. This information needs to be provided by the model.
Continue reading “cs193p – Assignment #2 Task #5”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #2 Task #4

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

Disable the game play mode control (i.e. the UISwitch or UISegmentedControl from Required Task 3) when a game starts (i.e. when the first flip of a game happens) and re-enable it when a re-deal happens (i.e. the Deal button is pressed).

Disable the control when a card is touched, and re-enable it again when hitting the deal button:

- (IBAction)touchDealButton:(UIButton *)sender {
    self.modeSelector.enabled = YES;
    ...
}

- (IBAction)touchCardButton:(UIButton *)sender
{
    self.modeSelector.enabled = NO;
    ...
}

The complete code is available on github.

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #2 Task #3

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

Drag out a switch (UISwitch) or a segmented control (UISegmentedControl) into your View somewhere which controls whether the game matches two cards at a time or three cards at a time (i.e. it sets “2-card-match mode” vs. “3-card-match mode”). Give the user appropriate points depending on how difficult the match is to accomplish. In 3-card-match mode, it should be possible to get some (although a significantly lesser amount of) points for picking 3 cards of which only 2 match in some way. In that case, all 3 cards should be taken out of the game (even though only 2 match). In 3-card-match mode, choosing only 2 cards is never a match.

Start by dragging out a segmented control element onto your story board and change its tint in order to make it more visible:

cs193p – assignment #2 task #3 - mode selector
cs193p – assignment #2 task #3 – mode selector

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

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail