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

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 – Lecture #4 – Foundation and Attributed Strings

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

Lecture #4 is mostly theory with a tiny demonstration in between.

It starts with an introduction to foundation objects and how to create them using initializers or special class methods. The demo shows how to use introspection to safely use dynamic typing.

Further objects of the foundation framework explained during the lecture are mutable and immutable arrays (as well as enumeration), numbers, values, data objects, dates, sets (ordered, unordered), and dictionaries.

New for iOS 7 is preferredFontForTextStyle for fonts and font descriptors.

The lecture ends with attributed strings …

The code for this lecture is available at github.

The lecture as well as its slides are available via iTunes called “4. Foundation and Attributed Strings”.

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Lecture #3 – Objective-C

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

Lecture #3 is a demonstration of how to solve the previous assignment and adds new features to the Matchismo app by adding additional cards and a card-matching algorithm.

The code for this lecture is available at github.

The lecture as well as its slides (which include a complete walk through of the demo from the lecture) are available via iTunes called “3. Objective-C”.

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail