Hey everybody, I am trying to write a very simple blackjack code where the player either hits 21 and wins, or busts and loses. So far i have this,
function card = dealcard;%This program will allow someone to draw a card at random from a full deckand see what that card would be. you can go through the whole deckpersistent dec; %persistent makes it so matlab stores this variableif length(dec)<53dec=[1:52]; %one deck of cardsdec=dec(randperm(length(dec))); %this shuffles the cardsend;card=dec(end);
I do not know how to define the cards as being an ace, 2,3,…queen, and king. If anyone could help me with this that would be great. Thank you.