calculating the numbers of possibilities that are possible from a vector?
Show older comments
Iam trying to calculate the "Basic blackjack strategy" with help from matlab.
What iam trying to do is taking some number from a vector for example:
A=11;
J=10;
D=10;
K=10;
A=[A A A A 2 2 2 2 3 3 3 3 4 4 4 4 5 5 5 5 6 6 6 6 7 7 7 7 8 8 8 8 9 9 9 9 10 10 10 10 J J J J D D D D K K K K];
A1=A(randi(numel(A))); %takes randomcard 1 from A
A2=A(randi(numel(A))); %takes randomcard 2 from A
A1+A2;
Lets say that A1=10, A2=3. This will give A1+A2=13, now i want to calculate how many possible hands there is to get a hand between(17-21)?
In other words i want to know how many variations of x drawn cards from vector A starting on 13 will give me a hand between 17-21?
Any smart way to make this happen in matlab?
Answers (1)
Matt J
on 13 Nov 2013
0 votes
Hint: the nchoosek() command.
Categories
Find more on Card games in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!