<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Matlab on 图拉丁CLUB</title><link>https://new.tualatin.club/tags/matlab/</link><description>Recent content in Matlab on 图拉丁CLUB</description><generator>Hugo</generator><language>zh-CN</language><lastBuildDate>Sat, 06 Nov 2021 00:00:00 +0000</lastBuildDate><atom:link href="https://new.tualatin.club/tags/matlab/index.xml" rel="self" type="application/rss+xml"/><item><title>鱿鱼游戏玻璃桥MATLAB脚本</title><link>https://new.tualatin.club/posts/2021-11-06-%E9%B1%BF%E9%B1%BC%E6%B8%B8%E6%88%8F%E7%8E%BB%E7%92%83%E6%A1%A5matlab%E8%84%9A%E6%9C%AC/</link><pubDate>Sat, 06 Nov 2021 00:00:00 +0000</pubDate><guid>https://new.tualatin.club/posts/2021-11-06-%E9%B1%BF%E9%B1%BC%E6%B8%B8%E6%88%8F%E7%8E%BB%E7%92%83%E6%A1%A5matlab%E8%84%9A%E6%9C%AC/</guid><description>&lt;p>网上有python版的，给师妹写了个精简matlab版的。&lt;br>
直接输出生存率，可修改加入遗忘概率曲线。&lt;/p>
&lt;pre tabindex="0">&lt;code>%setting

num_of_gamers=uint8(16);

num_of_glasses=uint8(18);

num_of_rounds=uint32(1000000);

%count

total=uint32(zeros(num_of_gamers,1));

for rounds=1:num_of_rounds

%initialization

bridge=logical(round(rand(num_of_glasses,1)));

step_continue=1;

%game start

for gamer=1:num_of_gamers

for step=step_continue:num_of_glasses

if step_continue&amp;lt;=num_of_glasses

step_continue=step_continue 1;

elseif step_continue==num_of_glasses 1

break

end

if logical(round(rand()))~=bridge(step) %choice

break

end

end

if step_continue==num_of_glasses 1

total(gamer)=total(gamer) 1;

end

end

end

%save(&amp;#34;total.mat&amp;#34;,&amp;#34;total&amp;#34;);

bar(double(total)/double(num_of_rounds)*100);
&lt;/code>&lt;/pre>&lt;p>&lt;img src="1d88224b426f.jpg" alt="鱿鱼游戏玻璃桥MATLAB脚本" loading="lazy" title="鱿鱼游戏玻璃桥MATLAB脚本">
&lt;/p></description></item></channel></rss>