Clear Filters
Clear Filters

Card game switching Q K J and T from string to numbers and adding the card up

1 view (last 30 days)
Ok so my input comes in with an answer of face value of two card. ie... 'Q2' is a queen and a two... I need to add the cards together but I need to fist change all Q K J T to Q,K,J,T=10 and A=11 then add them.... How would I arrange my if else... I've been playing with string2num and letters2num and I can't seem to get it.
dpb on 16 Feb 2021
Edited: dpb on 17 Feb 2021
>> card='Q';
>> V=strfind(FACES,card)+9
V =
>> card='A';
>> V=strfind(FACES,card)+9
V =
David Hill
David Hill on 17 Feb 2021
Depending on what you are doing, you might want to look at defining card as a class.
classdef card

Sign in to comment.

Answers (0)


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!