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

cs193p – Assignment #2 Task #2

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

Add a button which will re-deal all of the cards (i.e. start a new game). It should reset the score (and anything else in the UI that makes sense). In a real game, we’d probably want to ask the user if he or she is “sure” before aborting the game in process to re-deal, but for this assignment, you can assume the user always knows what he or she is doing when they hit this button.

Start by dragging out a new button onto your storyboard. Note that the blue font on a green background is not really readable. You might want to change the color of the button text or its background:

cs193p – assignment #2 task #2 - deal button
cs193p – assignment #2 task #2 – deal button

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

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #2 Task #1

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

Follow the detailed instructions in the lecture slides (separate document) to reproduce the latest version of Matchismo we built in lecture (i.e. the one with multiple cards) and run it in the iPhone Simulator. Do not proceed to the next steps unless your card matching game functions as expected and builds without warnings or errors.

Thethe slides provided with lecture #3 contain a detailed walk through for the rest of the first assignment and all the steps described above. Follow those steps and (if you have not finished them already during the lecture) you have completed the first task of the second assignment.

The complete code is available on github.

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #2 Extra Task #3

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

Add another tab for some “settings” in the game.

We will need to access the settings from both card games as well as from the settings view. Therefore we create a new class derived from NSObject with public properties of the “settings” which can be used by all of those controllers:

@interface GameSettings : NSObject
@property (nonatomic) int matchBonus;
@property (nonatomic) int mismatchPenalty;
@property (nonatomic) int flipCost;
@end

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

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

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.

Add third tab to track the user’s scores. It should be clear which scores were playing card match games and which scores were Set card match games.

The tab has already been implemented during lecture #5.

To be able to separate the scores of the different games, it is necessary to another property which can provide this information:

@property (strong, nonatomic) NSString *gameType;

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.

Create appropriate icons for your two tabs. The icons are 30×30 and are pure alpha channels (i.e. they are a “cutout” through which the blue gradient shines through). Search the documentation for more on how to create icons like that and set them.

Create the icons in your favorite graphic program, save them to your project and set them in storyboard:

cs193p - assignment #2 extra task #1
cs193p – assignment #2 extra task #1

The complete code is available on github.

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #2 Task #8

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

Your Set game should also report (mis)matches like Required Task #3 in Assignment 1, but you’ll have to enhance this feature (to use NSAttributedString) to make it work for displaying Set card matches.

In storyboard copy the label from the card-game view to the set-game view and connect it to the set-game view controller. Change it from “plain” to “attributed”.

In updateUI create a new attributed string which derives from the last-flip description. Update this string with the card attributes in the for loop and – at the end – use it for the label text:
Continue reading “cs193p – Assignment #2 Task #8”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail