cs193p – Assignment #2 Task #5

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

Your Set game should have 24 cards.

Add 24 custom buttons in storyboard and link them to the cardButtons outlet and flipCard: action method in GameViewController (the parent of SetGameViewController):

cs193p - assignment #2 task #5
cs193p – assignment #2 task #5

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.

Choose reasonable amounts to award the user for successfully finding a set (or incorrectly picking cards which are not a set).

Create three new properties for CardMatchingGame to replace the previously used constants:

@property (nonatomic) int matchBonus;
@property (nonatomic) int mismatchPenalty;
@property (nonatomic) int flipCost;

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

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.

The Set game only needs to allow users to pick sets and get points for doing so (e.g. it does not redeal new cards when sets are found). In other words, it works just like your other card game (except that it is a 3 card (instead of 2 card) match with different kinds of cards).

In this task we create the actual cards and its deck … and hope that everything is ok because we will not able to test it till later (we could add some unit test, but …)

Similar to PlayingCard, add properties to hold the color, symbol, shading and number of symbols, and provide class methods to access its valid values:
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.

Don’t violate any of the Required Tasks from Assignment 1 in the playing card game tab (in other words, don’t break any non-extra-credit features from last week). The only exception is that your playing card game is required to be a 2-card-match-only game this week, so you can remove the switch or segmented control you added for Required Task #5 in Assignment 1. Your Set game is a 3-card matching game.

Start by moving “everything” which is not matching-card specific to common game view controller. Note that all property declarations need to be in the .h file as well as those methods you need to access from your subclasses and from storyboard (e.g. action methods).
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.

Add a tab bar controller to your application. One tab will be the game you built last week in Assignment 1. The other tab will be a new game, Set. Set is still a card game, so a good solution to this assignment will use object-oriented programming techniques to share a lot of code.

Start by creating a new view controller class GameViewController, and another one SetGameViewController which inherits from the first one. Make the first class also the parent class for the CardGameViewController:

#import "GameViewController.h"
@interface CardGameViewController : GameViewController

GameViewController will hold the “common parts” of the to card game view controllers …

The tab bar controller has already been added during lecture #5. Drag out an additional view controller and link it to the new SetGameViewController class.

The complete code is available on github.

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Lecture #5 – View Controller Lifecycle and Multiple MVCs

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

Lecture #5 covers the view-controller life cycle and multiple MVCs and finishes with another demo of the Matchismo card game.

viewDidLoad is a good place to hold setup code – but has not geometry set yet.
viewWillAppear is for geometry-related initialization, lazy execution and late updating.

“A view gets loaded only once, but can appear and disappear a lot.”

viewWillDisAppear is suitable to “remember” and “clean up”.
view{Will,Did}LayoutSubviews is suitable to react to geometry changes.

Autorotation is controlled by shouldAutorotate
Continue reading “cs193p – Lecture #5 – View Controller Lifecycle and Multiple MVCs”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Lecture #4 – Foundation, Attributed Strings

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

Lecture #4 provides more insight into Objective-C and introduction to the Foundation framework.

… more about nil, instantiation, dynamic binding, compile time vs run time, object typing, introspection …

A short demo shows how match: of PlayingCard can be improved by introspection.

The code of Matchismo for this lecture is available at Stanford and on github.

… more about description, copy & mutableCopy, NSArray, enumeration, NSNumber, NSValue, NSData, NSDate, NSSet, NSOrderedSet, NSDictionary, porperty lists, NSUserDefaults, NSRange, colors and fonts, UIColor, UIFont, and NSAttributedString.

The lecture finishes with another demo demonstrating attributed strings.

The code of the Attribute demo for this lecture is available on github.

Slides are available on iTunes …..

The lecture is available at iTunes and is named “4. Foundation, Attributed Strings (January 17, 2013)”.

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail