其他分享
首页 > 其他分享> > MATLAB版 代码狗屁不通的狗屁不通文章生成器

MATLAB版 代码狗屁不通的狗屁不通文章生成器

作者:互联网

最近在尝试把一些生成器转成matlab版,突然又想起来还有狗屁不通文章生成器这个东西,github上的代码非常简单,原理也只是抽一个1~100的随机数,若是小于5就令起一段,大于等于5但小于20就来句没用的名人名言,大于等于20就来一句废话,将文本连接起来即可,这里使用matlab复刻了一下,并且写了个狗屁不通版放在了最后,使用方式:

bullshxt(‘关注slandarer’,10000)

生成效果会存在result.txt里:
在这里插入图片描述

这种事实对本人来说意义重大,相信对这个世界也是有一定意义的。一般来说,我们一般认为,抓住了问题的关键,其他一切则会迎刃而解。总结的来说,现在,解决关注slandarer的问题,是非常非常重要的。所以,带着这些问题,我们来审视一下关注slandarer。爱迪生在不经意间这样说过,失败也是我需要的,它和成功对我一样有价值。这似乎解答了我的疑惑。

完整代码如下:
逻辑较为简单不在此详解,如果有看不懂的可以参考一下github上的原项目~

function bullshxt(topic,count)
% topic='关注slandarer';
% count=10000;

packet=load('data.mat');
data=packet.data;

before=data.before;
after=data.after;

bosh=data.bosh;
bosh=[bosh;bosh];
[~,randiIndex]=sort(rand(1,length(bosh)));
bosh(randiIndex)=bosh(1:length(bosh));

famous=data.famous;
famous=[famous;famous];
[~,randiIndex]=sort(rand(1,length(famous)));
famous(randiIndex)=famous(1:length(famous));


article='  ';
bi=1;fi=1;
while length(article)<count
    randiNum=randi(100);
    if randiNum<5
        article=[article,'\r\n\r\n  '];   
    elseif randiNum<20
        famousStr=famous{fi};
        famousStr=strrep(famousStr,'a',before{randi(length(before))});
        famousStr=strrep(famousStr,'b',after{randi(length(after))});
        article=[article,famousStr];  
        fi=mod(fi,length(famous))+1;
    else
        boshStr=bosh{bi};
        boshStr=strrep(boshStr,'x',topic);
        article=[article,boshStr];  
        bi=mod(bi,length(bosh))+1;
    end
end
article=[article,'\r\n'];
fprintf(article)

fid=fopen('result.txt', 'wt');
fprintf(fid,article);
fclose(fid);


end

但是

如果仅仅这样就结束并不符合[狗屁不通的代码的题意]

因此

代码还有狗屁不通版:

function XXX(X,XX)
XXXX=...
load(...
char(...
[88,88,88,88,88,46,109,97,116]));
XXXXX=XXXX.XXXXX;XXXXXX=XXXXX.XXXXXX;
XXXXXXX=XXXXX.XXXXXXX;XXXXXXXX=...
XXXXX.XXXXXXXX;XXXXXXXX=[XXXXXXXX;
XXXXXXXX];[~,XXXXXXXXXX]=...
sort(...
rand(...
1,...
length(...
XXXXXXXX)));XXXXXXXX(XXXXXXXXXX)=...
XXXXXXXX(1:length(XXXXXXXX));
XXXXXXXXX=XXXXX.XXXXXXXXX;
XXXXXXXXX=[XXXXXXXXX;XXXXXXXXX];
[~,XXXXXXXXXX]=...
sort(...
rand(...
1,...
length(...
XXXXXXXXX)));XXXXXXXXX(XXXXXXXXXX)=...
XXXXXXXXX(1:length(XXXXXXXXX));XXXXXXXXXXX=...
char([32,32]);XXXXXXXXXXXX=1;XXXXXXXXXXXXX=1;
while length(XXXXXXXXXXX)<XX
XXXXXXXXXXXXXX=randi(100);
if XXXXXXXXXXXXXX<5
XXXXXXXXXXX=...
[XXXXXXXXXXX,...
char([92,114,92,110,92,114,92,110,32,32])];   
elseif XXXXXXXXXXXXXX<20
XXXXXXXXXxx=...
XXXXXXXXX{...
XXXXXXXXXXXXX};
XXXXXXXXXxx=...
strrep(...
XXXXXXXXXxx,...
char(97),...
XXXXXX{...
randi(...
length(XXXXXX))});
XXXXXXXXXxx=...
strrep(...
XXXXXXXXXxx,...
char(98),...
XXXXXXX{...
randi(length(XXXXXXX))});
XXXXXXXXXXX=...
[XXXXXXXXXXX,...
XXXXXXXXXxx];  
XXXXXXXXXXXXX=...
mod(XXXXXXXXXXXXX,...
length(XXXXXXXXX))+1;
else
XXXXXXXXxx=XXXXXXXX{XXXXXXXXXXXX};
XXXXXXXXxx=strrep(XXXXXXXXxx,char(120),X);
XXXXXXXXXXX=[XXXXXXXXXXX,XXXXXXXXxx];  
XXXXXXXXXXXX=mod(XXXXXXXXXXXX,length(XXXXXXXX))+1;
end
end
XXXXXXXXXXX=...
[XXXXXXXXXXX,...
char([92,114,92,110])];
fprintf(XXXXXXXXXXX)
XXXXXXXXXXXXXx=...
fopen(...
char(...
[120,120,120,46,116,120,116]),...
char([119,116]));
fprintf(XXXXXXXXXXXXXx,...
XXXXXXXXXXX);
fclose(XXXXXXXXXXXXXx);
end

看的懂算我输好叭

另:

文章所用素材包(data.mat及XXXXX.mat)在这:
链接:https://pan.baidu.com/s/1uyUTXJVtPCbDQnyyf_CRLA
提取码:mp4f

标签:...,XXXXXXXXX,XXXXXXXX,生成器,famous,length,bosh,MATLAB,狗屁不通
来源: https://blog.csdn.net/slandarer/article/details/118251132