cs193p – Assignment #5 Task #2

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

The user-interface should always be giving some indication (e.g. a UIActivityIndicatorView) to the user when the currently displaying user-interface is going to show something when some active thread finishes. The network activity indicator in the status bar is not sufficient for this, but your application should also turn on the networkActivityIndicator whenever it is accessing the network (and only then).

The table view will use the refresh-control feature in the following thus – there is no need to put an extra activity indicator there for now.

Change in both storyboards the background of the scroll views to black (which is a cosmetic change only) … the rest will be done in code to avoid having to duplicate everything for both storyboards.
Continue reading “cs193p – Assignment #5 Task #2”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #5 Task #1

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

Your application must implement all the required tasks from the last assignment (and all the required tasks in this assignment) without doing any Flickr fetching or file system interactions in the main thread. Your user-interface should be responsive to the user at all times (i.e. the main thread should never be blocked).

Flickr is accessed twice. First when the data is loaded to populate the first table. Create a new dispatch queue and load the photos there. As soon is this is done return to the main queue and set the photos property:

- (void)viewDidLoad
{
    [super viewDidLoad];    
    dispatch_queue_t queue = dispatch_queue_create("Flickr Downloader", NULL);
    dispatch_async(queue, ^{
        NSArray *photos = [FlickrFetcher stanfordPhotos];
        dispatch_async(dispatch_get_main_queue(), ^{
            self.photos = photos;
        });
    });
}

Continue reading “cs193p – Assignment #5 Task #1”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs106a – Assignment #5 – Extra Task #3

The complete specification of assignment #5 can be found as part of the stream at iTunes.

Beef up your Yahtzee to the variant called “Triple Yahtzee.”

In this variant, each player manages three simultaneous scorecard columns, as if they were playing for three players at once. The player can assign a roll to any one of their three columns. All entries are scored normally with respect to categories and validity, but the values in the second column are doubled, and the third column values are tripled. The player’s score consists of the sum of all three columns. This would make for a three- dimensional array (an array of players who have any array of columns which are an array of score entries)—pretty tricky! Game play continues for 3*13 rounds, until all players have filled in all entries in all three columns. The player with the highest total score is the winner

The display needs to additional cols with suiting names to be able to hold the additional scores:
Continue reading “cs106a – Assignment #5 – Extra Task #3”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs106a – Assignment #5 – Extra Task #2

The complete specification of assignment #5 can be found as part of the stream at iTunes.

Incorporate the bonus scores for multiple Yahtzees in a game

As long as you have not entered a 0 in the Yahtzee box, the rules of the game give you a bonus chip worth 100 points for each additional Yahtzee you roll during the same game.

Start by a new array as instance variable which indicates if additional Yahtzees are allowed – meaning it was not set to 0 before – and initialize it:
Continue reading “cs106a – Assignment #5 – Extra Task #2”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs106a – Assignment #5 – Extra Task #1

The complete specification of assignment #5 can be found as part of the stream at iTunes.

Add a high score feature

Save the top ten highest scores and names to a file and make it persistent between runs of the program. Read the file when you start and print out the hall of fame. If a player gets a score that preempts one of the early high scores, congratulate them and update the file before you quit so it is recorded for next time.

Add a new method to display the high scores:
Continue reading “cs106a – Assignment #5 – Extra Task #1”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs106a – Assignment #5

The complete specification of assignment #5 can be found as part of the stream at iTunes.

Because this assignment is meant to teach arrays it uses them heavily. Thus create arrays to hold the values of the last roll of dice, to hold the categories which have already been used, and to hold to total and the sub scores. Because they are needed in several methods create them as instance variables. The dice array is filled with each (first) roll thus it can be initialized with the declaration. The others are instancialized and thus reset starting a new game. The array holding the used categories differs from the others as it is two dimensional where the rows represent the player and the columns the selected category.

The game itself consists of a fixed number of rounds which equals the number of scoring categories. In every round each player has a fixed number of rolls where the first one differs slightly from the following as all dice have to be rolled. After a players turn his/her score has to be updated, and at the end of the game the winner has to be selected.
Continue reading “cs106a – Assignment #5”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail