📄 simplepoker.m
字号:
% This program plays a simplified poker gameclearcards=['ten';'ace';'que';'jac';'kin'];% Convert the cards to numerical values:cvals=text2int1(cards)%% p=300649;% generate a random exponent k with gcd(k,p-1)=1k=khide(p);% Shuffle and hide the cardsshufvals=shuffle(cvals,k,p)% Now reveal the cardsreveal(shufvals,k,p)% Now the advise functionadvise(shufvals,p)% To see that the ace was the only quadratic non-residue modulo p% we do the following test:powermod(cvals,(p-1)/2,p)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -