Hi, i'm beginner in objective c, i'm creating a card game for iPhone and I've a problem with a function: I create a deck of cards, shuffle it and now I need to split the deck in 4 hands (for the 4 players)
Here is my function :
-(void) split(int i1, int i2, int i3)
{
NSMutableArray *list1;
NSMutableArray *list2;
NSMutableArray *list3;
NSMutableArray *list4;
int a =0;
for(int i =0;i<i1;i++){
list1 [i]=cards[a];
a++;
}
for(int i =0;i<i1;i++){
list2 [i]=cards[a];
a++;
}
for(int i =0;i<i1;i++){
list3 [i]=cards[a];
a++;
}
for(int i =0;i<i1;i++){
list4 [i]=cards[a];
a++;
}
for(int i =i1;i<i1+i2;i++){
list1 [i]=cards[a];
a++;
}
for(int i =i1;i<i1+i2;i++){
list2 [i]=cards[a];
a++;
}
for(int i =i1;i<i1+i2;i++){
list3 [i]=cards[a];
a++;
}
for(int i =i1;i<i1+i2;i++){
list4 [i]=cards[a];
a++;
}
for(int i =i1+i2;i<i1+i2=i3;i++){
list1 [i]=cards[a];
a++;
}
for(int i =i1+i2;i<i1+i2=i3;i++){
list2 [i]=cards[a];
a++;
}
for(int i =i1+i2;i<i1+i2=i3;i++){
list3 [i]=cards[a];
a++;
}
for(int i =i1+i2;i<i1+i2=i3;i++){
list4 [i]=cards[a];
a++;
}
}
I think I didn't declare it well Can someone tell me if you have an idea? (I know this problem is easy for you guys but right now I'm blocked)
thanks