Bronze Solution


Here is my solution to the Bronze/random color thing:

[code]-(void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event
if (motion == UIEventSubtypeMotionShake) {
NSMutableArray *deColores = [[NSMutableArray alloc] init];
[deColores addObject:[UIColor purpleColor]];
[deColores addObject:[UIColor blueColor]];
[deColores addObject:[UIColor greenColor]];
[deColores addObject:[UIColor orangeColor]];
[deColores addObject:[UIColor redColor]];
[deColores addObject:[UIColor cyanColor]];

    int daNum = [deColores count];
    int randNum = [self getRandomNumber:0 to:daNum - 1];
    NSLog(@"Device started shaking");
    NSLog(@"%i", daNum);
    NSLog(@"%i", randNum);
    [self setCircleColor:deColores[randNum]];

As this is my first foray into an independent solution in Objective C, I am very interested in comments regarding the viability of the code. This code seems to be much less complicated than the other solutions I saw, so now I’m worried that maybe I’m missing the point and doing it all wrong…

Please let me know what you think.

PS Full disclosure: the function getRandomNumber was taken from