炸飞机

炸飞机

炸飞机是一种推理游戏,主要通过炸取区格得到的信息“空,伤,沉”来判断对方飞机的摆放位置,最先将对方飞机击沉的人获胜。

    • 中文名:炸飞机
    • 种类:推理游戏
    • 所需工具:10x10的表格、飞机
    • -:代表 空
    • X:代表 伤
    • O:代表 沉

游戏準备

每个人準备两个10x10的表格,一个用来摆放自己的飞机,另一个用来分析对方飞机的摆放位置。将表格的行和列分别标柱上1-10和A-J,双方在开始之前首先确定谁先手(猜拳方式即可),游戏开始后相互只需报出想要攻击的对方坐标,如C6,F3等。

然后是摆放飞机。飞机机身长4区格;机翼5区格,其中心位于机身第二个区格;尾翼3区格其中心位于机身尾端。将3架这样的飞机画在自己的一个表格里,飞机不能出格,飞机之间也不得重複,如图1。

二人彼此的表格互相保密。

游戏过程

画好后,一个人开始炸:报告要炸取的区格的序号(如C4),对方将自己该区格的情况报告给炸方。若那个区格没有飞机,报“空”,若有飞机但不是机头,报“伤”或“中”,若是机头,报“沉”或“死”(反正就是挂掉的意思),报完后轮到自己炸对方= =

在炸的过程中,用自己另一个表格来标记自己已经炸过的区格,根据它分析对方飞机的摆放。游戏最终目的就是炸毁对方所有(三个)飞机的机头。

此游戏很考验分析能力。

可以用符号来代替:

- 代表 空

X 代表 伤

O 代表 沉

Matlab原始码

(喵里叶变换版)

functionplane%PLANEplaysthebombingplanegame.%Ata10x10airportlyingthreeplanes.Trytousetheleastbombs%toblowupallthethreeplanes.%%Theplane'sshapeisdeterminedbythematrixasfellow:%00600%55555%00500%05550%wherenumber6responsestheheadpartofeachplaneand%number5responsesthebody.Onlywhentheheadpartof%theplaneisblowedup,theplanewouldbecompletelydes-%toried.Youwinthegamewhenallthreeplanesareblowed%up.%%Duringthegame,youshallsayaposition(suchas'D4')that%youwishtoblowupandtheMatlabwilltellyoutheresultas%follow:%Miss:Yourbombmissedtheplane..%Hurt:Yourbombexplodedatthebodyofaplane.%Kill:Yourbombexplodedattheheadofaplane.%Domakefulluseoftheseimformationtodeterminethe%locationsoftheplane'sheads.%%Duringthegame,typing'current'tocheckcurrentimformation%youhaveexploredintheboard.Typing'giveup'whenyouare%wishtogiveupandcheckthecorrectanswerandtyping'exit'%toexitthegame.%%Coder:MourierTransform%Cirno'scompleteCodingWorkshop%2013-9-25(Meow>w<~)globalplaneplaneupplaneleftplanedownplanerightplaneboard;plane=[0,0,6,0,05,5,5,5,50,0,5,0,00,5,5,5,0];planeup=plane;planeleft=rot90(plane);planedown=rot90(rot90(plane));planeright=rot90(rot90(rot90(plane)));planeboard=zeros(10);explored=zeros(10);step=0;i=1;while1putplane;putplane;putplane;ifislegal(planeboard)break;elsei=i+1;planeboard=zeros(10);endenddisp('');disp('Thebombingplanegame.');disp('');disp('Typethepositionyouwishtobomb.');disp('Typecurrenttochecktheexploredposition.');disp('Typegiveuptogiveup,checktherightanswerandexitthegame.');disp('Typeexittoexitthegamedirectly.');disp('');while1ifisWin(explored)disp('Congratulations!Youwonthegame.');disp(['Bombsused:',num2str(step),'.']);disp('Yourevaluationis:');ev='AirmanBasic.';ifstep<60ev='Airman.';endifstep<56ev='AirmanFirstClass.';endifstep<52ev='SeniorAirman.';endifstep<49ev='StaffSergeant.';endifstep<46ev='TechnicalSergeant.';endifstep<43ev='FirstSergeant.';endifstep<40ev='MasterSergeant.';endifstep<37ev='SeniorMasterSergeant.';endifstep<34ev='ChiefMasterSergeant.';endifstep<31ev='CommandChiefMasterSergeant.';endifstep<28ev='ChiefMasterSergeantoftheAirForce.';endifstep<26ev='SecondLieutenant.';endifstep<24ev='FirstLieutenant.';endifstep<22ev='Captain.';endifstep<20ev='Major.';endifstep<18ev='LieutenantColonel.';endifstep<16ev='Colonel.';endifstep<14ev='BrigadierGeneral.';endifstep<12ev='MajorGeneral.';endifstep<10ev='LieutenantGeneral.';endifstep<9ev='General.';endifstep<8ev='GeneraloftheAirForce.';endifstep<7ev='Luckyman.';endifstep<4ev='ChineseHacker.'enddisp(ev);return;endin=input('Meow:','s');switchincase'current'disp('Bombsused:');disp(step);disp('Positionexploredasfellow:');disp(explored);disp('0-Hasnotbeenexplored');disp('1-Missed');disp('2-Hurt');disp('3-Killed');case'giveup'disp('Yougaveup.....nowchecktheanswer:');disp(planeboard);return;case'exit'disp('Exitthegame.');return;otherwise[x,y]=trans(in);ifx~=0&&y~=0switchplaneboard(x,y)case0disp('Missed.');explored(x,y)=1;step=step+1;case5disp('Hurttheplane.');explored(x,y)=2;step=step+1;case6disp('Killedtheplane,excellent!');explored(x,y)=3;step=step+1;otherwiseendelsedisp('Illegalcommand...');endendendfunction[x,y]=trans(s)%Positiontransform.x=0;y=0;ifdouble(s(1))>=65&&double(s(1))<=74x=double(s(1))-64;endifdouble(s(1))>=97&&double(s(1))<=106x=double(s(1))-96;endifdouble(s(2))>=49&&double(s(2))<=57y=double(s(2)-48);tryifs(2)=='1'&&s(3)=='0'y=10;endcatchendendfunctionputplaneglobalplaneupplaneleftplanedownplanerightplaneboard;%Putaplane.switchceil(rand*4)case1x=floor(rand*7);y=floor(rand*6);fori=1:4forj=1:5planeboard(x+i,y+j)=planeboard(x+i,y+j)+planeup(i,j);endendcase2x=floor(rand*7);y=floor(rand*6);fori=1:4forj=1:5planeboard(x+i,y+j)=planeboard(x+i,y+j)+planedown(i,j);endendcase3x=floor(rand*6);y=floor(rand*7);fori=1:5forj=1:4planeboard(x+i,y+j)=planeboard(x+i,y+j)+planeleft(i,j);endendcase4x=floor(rand*6);y=floor(rand*7);fori=1:5forj=1:4planeboard(x+i,y+j)=planeboard(x+i,y+j)+planeright(i,j);endendendfunctionx=islegal(board)%Checklegal.siz=size(board);x=1;form=1:siz(1)forn=1:siz(2)ifboard(m,n)>6x=0;break;endendendfunctionx=isWin(board)%Checkwinning.siz=size(board);x=0;tick=0;form=1:siz(1)forn=1:siz(2)ifboard(m,n)==3tick=tick+1;iftick==3x=1;break;endendendend

相关词条

相关搜索

其它词条