Here's my whole program that computes the probability of a straight for a five-card hand. You can modify it or use the techniques for your seven-card hand problem.
The check for the straight where the Ace has the value 13 is performed by comparing the sortedHand to the literal vector (1 9 10 11 12). Since the hand is sorted, that's the only configuration that must be tested for. In the seven card sorted hand, you would have to check for (1 X X 9 10 11 12), where the Xs represent any other card. One way to handle that is
SUBTRACT sortedSevenCardHand (1 0 0 9 10 11 12) aceWild
then count the number of zeros in aceWild as my program does. Since no card has the value zero, those two positions will always result in non-zero after the subtraction and will therefore not be counted.
'Compute probability of a straight:
'A Straight consists of 5 cards with consecutive values with the
'addition that Ace can be high (13) or low (1) as needed
'to complete the sequence.
'Solution uses the fact that if an ascending sequence of consecutive
'numbers is shifted one place and subtracted from the original, then
'the middle numbers will all be one. For example:
' 4 5 6 7 8 - original sequence
' (0) 4 5 6 7 8 shifted sequence
' 4 1 1 1 1 0 difference
'
COPY 100000 repeatCount
COPY 1,13 1,13 1,13 1,13 deck
REPEAT repeatCount
SHUFFLE deck shuffledDeck
TAKE shuffledDeck 1,5 hand
SORT hand sortedHand
COPY 0 sortedHand shiftedSortedHand
SUBTRACT sortedHand shiftedSortedHand diffVector
TAKE diffVector 2,5 diffVectorCenter
COUNT diffVectorCenter = 1 diffVectorSum
IF diffVectorSum = 4 '<--<< for 7-card hand this should test for >=4.
SCORE 1 straightCountScore
END
' Handle special case where ace = 13:
SUBTRACT sortedHand (1 9 10 11 12) aceWild
COUNT aceWild =0 aceWildSum
IF aceWildSum = 5 'we have a match
SCORE 1 straightCountScore
END
END
SUM straightCountScore straightCount
DIVIDE straightCount repeatCount probability
PRINT probability