I'm taking waaaayyy more classes than I normally do this semester and just haven't had the time to play with objective c and make it my own, this all still feels very foreign to me and I'm having a lot of trouble doing something that I know should be fairly simple.
But basically what i have is a 6 piece mosaic puzzle that the pieces go back to the same place when the puzzle is restarted. I'm trying to swap the origin of each piece with that of another piece in a random way every time the puzzle is restarted. So I'm trying to randomize the CGRect values assigned to NSValue objects in an array, declared as such:
@synthesize topLeft;
@synthesize topMiddle;
@synthesize topRight;
@synthesize bottomLeft;
@synthesize bottomMiddle;
@synthesize bottomRight;
@synthesize scoreLabel;
topLeftRectOrigin=[NSValue valueWithCGRect: topLeft.frame];
topMiddleRectOrigin=[NSValue valueWithCGRect: topMiddle.frame];
topRightRectOrigin=[NSValue valueWithCGRect: topRight.frame];
bottomLeftRectOrigin=[NSValue valueWithCGRect: bottomLeft.frame];
bottomMiddleRectOrigin=[NSValue valueWithCGRect: bottomMiddle.frame];
bottomRightRectOrigin=[NSValue valueWithCGRect: bottomRight.frame];
puzzlePieces=[[NSMutableArray alloc]initWithObjects:topLeft, topMiddle, topRight, bottomLeft, bottomMiddle, bottomRight, nil];
puzzleOrigins=[[NSMutableArray alloc]initWithObjects:topLeftRectOrigin, topMiddleRectOrigin, topRightRectOrigin, bottomLeftRectOrigin, bottomMiddleRectOrigin, bottomRightRectOrigin, nil];
topLeftRectGrid=CGRectMake(145, 95, 30, 30);
topMiddleRectGrid=CGRectMake(235, 95, 30, 30);
topRightRectGrid=CGRectMake(325, 95, 30, 30);
bottomLeftRectGrid=CGRectMake(145, 185, 30, 30);
bottomMiddleRectGrid=CGRectMake(235, 185, 30, 30);
bottomRightRectGrid=CGRectMake(325, 185, 30, 30);
I'm really having trouble getting my brain around this, can you guys recommend how I should go about doing this? Much thanks for the help.