필터 지우기
필터 지우기

How to change 10 cards to jack queen and king

조회 수: 1 (최근 30일)
James Keiser
James Keiser 2021년 6월 16일
댓글: David Hill 2021년 6월 16일
I am making a blackjack game that involves 2 decks. I need to assign the number one cards to Ace's and the 10's to jacks, queens and kings.
my code:
%Making the deck of cards
cardValues = [1:13, 1:13, 1:13, 1:13,1:13, 1:13, 1:13, 1:13];
cardValues(cardValues>10) = 10;
if cardValues >= 10
cardValues = 10;
end
deck = [cardValues];
deck=deck(randperm(length(deck))); %this shuffles the cards
  댓글 수: 1
David Hill
David Hill 2021년 6월 16일
There are lots of file exchange examples. My blackjack game: https://www.mathworks.com/matlabcentral/fileexchange/71349-blackjack-gui
I use a classdef fo define my playingDeck.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Card games에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by