Post

Replies

Boosts

Views

Activity

Reply to For loop question
It isn’t a standard poker game so it isn’t relevant to figure out why. I need a dynamic way for the loop to go “deeper” be joker. I have the exact functionality you have and it works perfectly. But I have to have a function for each number of jokers, that seems like a hack. So one joker in the card array only can be 52 possibilities. An array with two jokers can be 52 * 52 and so on. Your array, like mine, isn’t dynamic in its depth of nested loops. If I have to use our current methods I have to say if one joker then do this function. If three jokers then do this one. There should be a way to create a single loop whose depth is determined by the number of jokers.
Feb ’20
Reply to For loop question
The cards can be the same. If I have three jokers they can be all A’s of spades if they want to be because there are multiple decks in play. So you need to calculate every possible combination for the jokers to see what the best possible hand could be.
Feb ’20
Reply to Count max consecutive integers in array
This cards array is an array of card objects with values of as follows:2,3,4,10,11The result for bestseq is 10,11NSInteger maxSeqLength = 1; NSInteger bestSeqLength = 1; NSMutableArray *maxSeq = [NSMutableArray new]; NSMutableArray *bestSeq = [NSMutableArray new]; // cycle for(NSInteger i = 0; i < cards.count - 1; i++){ NSLog(@"i: %ld ", (long)i); // vars Card *thisCard = [cards objectAtIndex:i]; Card *nextCard = [cards objectAtIndex:i+1]; // check if((nextCard.value - thisCard.value) == 1){ // set maxSeqLength += 1; [maxSeq addObject:thisCard]; [maxSeq addObject:nextCard]; // check if(maxSeqLength > bestSeqLength){ // set bestSeqLength = maxSeqLength; bestSeq = maxSeq; } } else{ // set maxSeqLength = 1; [maxSeq removeAllObjects]; } }
Jan ’20