91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 204KB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2021-06-17
  • 語言: Matlab
  • 標簽: 未分類??

資源簡介

matlab開發-ConnectFour。著名的“連接四”游戲。

資源截圖

代碼片段和文件信息

function?dummy?=?connect4()
%?This?file?performs?the?famous?game?of?Connect?FOUR
%?The?rules?of?the?Game?are:
%?Two?players?may?participate
%?The?board?is?shown?in?the?figure?window
%?Every?player?has?his?own?tile?colour
%?Every?player?drops?his?tile?in?his?turn?by?Clicking?on?the?desired?Column?
%?The?two?players?go?on?trying?to?connect?Four?tiles?of?one?Colour
%?Horizontally?Vertically?or?in?any?diagonal
%?The?player?who?manages?to?do?so?first?in?his?own?Colour
%?IS?THE?WINNER

%?Programmed?by:?Mina?Ayman?(mina_ayman@yahoo.com)
%?Using?MATLAB?R12?on?14/11/2003
%?Enjoy?Your?Play?!!!

%?Getting?the?tiles?for?the?play
tile?=?imread(‘btile.bmp‘);
p1t?=?imread(‘p1.bmp‘);
p2t?=?imread(‘p2.bmp‘);
wint?=?imread(‘win.bmp‘);

%?Getting?the?board?for?the?play
board?=?[tile?tile?tile?tile?tile?tile?tile;
????tile?tile?tile?tile?tile?tile?tile;
????tile?tile?tile?tile?tile?tile?tile;
????tile?tile?tile?tile?tile?tile?tile;
????tile?tile?tile?tile?tile?tile?tile;
????tile?tile?tile?tile?tile?tile?tile];

%?Sound?Generator?for?the?winner
[winyz]?=?wavread(‘winner.wav‘);
winning?=?[win;?win;?win;?win];

%?Sound?Generator?for?the?hit?sound
[hitbc]?=?wavread(‘hit3.wav‘);

%?Sound?Generator?for?the?drop?tile?sound
[tdropbbcc]?=?wavread(‘boing.wav‘);


%?Initialization?of?the?players
fprintf(‘\n\t\t\t?Welcome?to?The?Game?Of?CONNECT?FOUR‘)

st?=?‘Your?Turn!?‘;
con?=?‘Congratulations!?‘;
wins?=?‘?Wins‘;

%?Player?1
fprintf(‘\n?Entering?the?Name?of?Player?(1)‘)
player1?=?input(‘\nYour?Name?is?:?‘‘s‘);

fprintf(‘\n?Welcome?%s‘player1)
fprintf(‘\n?You?will?get?the?Red?Tile‘)
id1?=?[st?player1];
con1?=?[con?player1?wins];

%?Player?2
fprintf(‘\n\n\n?Entering?the?Name?of?Player?(2)‘)
player2?=?input(‘\nYour?Name?is?:?‘‘s‘);

fprintf(‘\n?Welcome?%s‘player2)
fprintf(‘\n?You?will?get?the?Yellow?Tile‘)
id2?=?[st?player2];
con2?=?[con?player2?wins];

fprintf(‘\n\n\n?Now?Let‘‘s?Begin?Our?Game‘)?
fprintf(‘\n?Press?(Enter)?when?READY‘)
pause;

%?Plotting?the?board
u?=?figure;
set(gcf‘Color‘[0?0.7?0])
imshow(board)

%?Introduction
p?=?title(‘**Welcome?to?CONNECT?FOUR**‘);
set(p‘Color‘[0.8?0?0.8])
set(p‘FontWeight‘‘bold‘)
set(p‘FontSize‘19)
pause(4);
%?Displaying?Rules?of?the?game
set(p‘Color‘[0.5?0?0.5])
set(p‘String‘‘Drop?Your?Tile?in?Your?Turn!!!‘)
set(p‘FontSize‘18)
pause(3);
set(p‘String‘‘With?a?Right?Click?on?the?Column‘)
pause(3);
set(p‘String‘‘Where?You?Want?to?Drop?Your?Tile‘)
pause(4);

game?=?zeros(67);

%?The?Beginning?of?the?Play
for?n?=?1?:?22
????p1x?=?0;????
????a?=?title(id1);
????set(a‘FontSize‘18)
????set(a‘FontWeight‘‘bold‘)
????set(a‘Color‘‘r‘)
????pause(1.2);
????
????%?Get?the?play?of?Player?1
????while(p1x?==?0);
????????[c1r1pp1]?=?impixel(board);
????????p1y?=?ceil(c1(1)/50);
????????col1?=?game(:p1y);
????????if?(all(col1)?==?0)
????????????p1x?=?max(find(col1?==?0));
????????????game(p1xp1y)?=?11;
????????

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????5964??1992-09-07?00:00??connect4\HIT3.WAV
?????文件??????196708??1994-05-02?12:00??connect4\winner.wav
?????文件????????7656??2003-11-10?19:34??connect4\btile.bmp
?????文件????????7656??2003-11-10?19:37??connect4\p2.bmp
?????文件????????7656??2003-11-10?19:38??connect4\p1.bmp
?????文件????????7656??2003-11-10?19:39??connect4\win.bmp
?????文件???????76996??2003-11-16?12:57??connect4\connect4.m
?????文件????????7812??1994-04-26?14:00??connect4\BOING.WAV
?????目錄???????????0??2003-11-08?19:56??connect4\

評論

共有 條評論