Znn3bq.jpeg
²é¿´: 1307  |  »Ø¸´: 3

chrislan625

гæ (СÓÐÃûÆø)

[ÇóÖú] Çó´óÉñ½ÌMATLAB ÉúÃüÓÎÏ·´úÂëÔõôд

ÀÏʦ½ÐÎÒÃÇ×Ôѧ ÉϿξÍҪд³öÒ»¸öÉúÃüÓÎÏ·µÄ´úÂë ¿´²»Ì«¶® ÒÔÏÂÊÇÀÏʦ¸øµÄÌáʾ

Skeleton program
function game_of_life( nx, ny, nstep )
%GAME_OF_LIFE Implements the Conway game of life
%   This function implements the Conway game of life in which beings are
%   generated and destroyed in a manner meant to represent evolution. They
%   are destroyed when they have too few or two many neighbours, and are
%   generated at a location with the right number of neighbours.
%
%   Input parameters
%   nx    The number of squares along the x-direction
%   ny    The number of squares along the y-direction
%   nstep The number of iterations in the game
%
%   Output parameters
%   None
%
%
%   Define some constants
delay = 0.1; % The time between images in seconds
dx = [-1,  0,  1, -1,  1, -1,  0,  1];
dy = [ 1,  1,  1,  0,  0, -1, -1, -1];
%
%   Initialise the grid
world = zeros(nx+2, ny+2); % Extra sites around the edge fixed to zero

[Add code here]

%
%   Display the world
imagesc(world);
pause(delay);
%
%   Step through all the moves
for i = 1:nstep
    %
    %   Count the number of neighbours for each site

[Add code here]

    %
    %   Update the world

[Add code here]

    %
    %   Display the world
    imagesc(world);
    pause(delay);
end

end
»Ø¸´´ËÂ¥

» ²ÂÄãϲ»¶

» ±¾Ö÷ÌâÏà¹Ø¼ÛÖµÌùÍÆ¼ö£¬¶ÔÄúͬÑùÓаïÖú:

ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

chrislan625

гæ (СÓÐÃûÆø)

1.        Consider the following starting configuration: a world made of 5x5 squares, with 3 creatures in a horizontal line (XXX) at the centre. How many creatures are alive after 5 steps?
2.        Consider the following starting configuration: a world made of 7x7 squares, with 5 creatures in a horizontal line (XXXXX) at the centre. How many creatures are alive after 5 steps?

ÕâÊÇÕâ¸ö³ÌÐòÒª½â¾öµÄÎÊÌâ
2Â¥2013-11-11 05:42:48
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

libralibra

ÖÁ×ðľ³æ (ÖøÃûдÊÖ)

æôÆï½«¾ü

¡¾´ð°¸¡¿Ó¦Öú»ØÌû

¸Ðл²ÎÓ룬ӦÖúÖ¸Êý +1
xzhdty: лл²ÎÓë 2013-11-12 10:27:22
²»Í¬ÉúÃüÓÎÏ·µÄ¹æÔò¿ÉÒÔ²»Í¬,Ò»°ã¶¼ÊÇÁÚÓòСÓÚ2»òÕß´óÓÚ3,»îcell»áËÀµô.ÁÚÓòµÈÓÚ3,ËÀcell¿ÉÒԳɻî.Èç¹ûÊÇÕâ¸ö¹æÔò,5*5run5´ÎºÍ7*7run5´ÎµÄ½á¹ûÈçÏÂͼ.×Ô¼ºÊýһϾÍÐÐ.

5*5run5´Î
Çó´óÉñ½ÌMATLAB ÉúÃüÓÎÏ·´úÂëÔõôд

7*7run5´Î
Çó´óÉñ½ÌMATLAB ÉúÃüÓÎÏ·´úÂëÔõôд-1
matlab/VB/python/c++/Javaд³ÌÐòÇë·¢QQÓʼþ:790404545@qq.com
3Â¥2013-11-11 21:15:04
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

chrislan625

гæ (СÓÐÃûÆø)

ÒýÓûØÌû:
3Â¥: Originally posted by libralibra at 2013-11-11 21:15:04
²»Í¬ÉúÃüÓÎÏ·µÄ¹æÔò¿ÉÒÔ²»Í¬,Ò»°ã¶¼ÊÇÁÚÓòСÓÚ2»òÕß´óÓÚ3,»îcell»áËÀµô.ÁÚÓòµÈÓÚ3,ËÀcell¿ÉÒԳɻî.Èç¹ûÊÇÕâ¸ö¹æÔò,5*5run5´ÎºÍ7*7run5´ÎµÄ½á¹ûÈçÏÂͼ.×Ô¼ºÊýһϾÍÐÐ.

5*5run5´Î


7*7run5´Î
...

´óÉñÇó½Ì~ ÎÒÃÇÒ»µã»ù´¡ÖªÊ¶¶¼Ã»½Ì¹ý°¡
4Â¥2013-11-15 09:24:29
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû
Ïà¹Ø°æ¿éÌø×ª ÎÒÒª¶©ÔÄÂ¥Ö÷ chrislan625 µÄÖ÷Ìâ¸üÐÂ
×î¾ßÈËÆøÈÈÌûÍÆ¼ö [²é¿´È«²¿] ×÷Õß »Ø/¿´ ×îºó·¢±í
[¿¼ÑÐ] 2±¾£¬³õÊÔ303£¬0860Çóµ÷¼Á +5 floriea 2026-04-12 7/350 2026-04-12 15:19 by 1005715100
[¿¼ÑÐ] ²ÄÁϹ¤³Ì281»¹Óе÷¼Á»ú»áÂð +27 xaw. 2026-04-11 28/1400 2026-04-12 15:14 by ÊÍ·ÅÌìÐÔ
[¿¼ÑÐ] ÉúÎïѧ308Çóµ÷¼Á +4 ÏàÐűػá¹ââÍòÕ 2026-04-11 4/200 2026-04-12 11:48 by babysonlkd
[¿¼ÑÐ] 0854µ÷¼Á +8 ³¤¹­°Á 2026-04-11 9/450 2026-04-11 21:44 by À¶ÔÆË¼Óê
[¿¼ÑÐ] Çóµ÷¼Á +6 СÄô°®Ñ§Ï° 2026-04-11 9/450 2026-04-11 21:20 by À¶ÔÆË¼Óê
[¿¼ÑÐ] 22408 352·ÖÇóµ÷¼Á +4 ŬÁ¦µÄÏÄÄ© 2026-04-09 4/200 2026-04-11 10:42 by maddjdld
[¿¼ÑÐ] 085404 293Çóµ÷¼Á +9 ÓÂÔ¶¿â°®314 2026-04-06 10/500 2026-04-11 10:36 by ×ÏêØ×ÏÆå
[¿¼ÑÐ] 22408 327·ÖÇóµ÷¼Á +4 ÔÏ·çkon 2026-04-10 4/200 2026-04-11 09:51 by Öí»á·É
[¿¼ÑÐ] 289 ·Ö105500ҩѧר˶Çóµ÷¼Á(ÕÒBÇøÑ§Ð£) +6 °×ÔÆ123456789 2026-04-09 8/400 2026-04-10 21:13 by zhouxiaoyu
[¿¼ÑÐ] »·¾³×¨Ë¶µ÷¼Á +16 »á˵»°µÄÖâ×Ó 2026-04-06 16/800 2026-04-10 10:30 by asy1wn
[¿¼ÑÐ] Çൺ¿Æ¼¼´óѧ²ÄÁÏѧԺ£¬»·¾³Ñ§Ôºµ÷¼Á²¹Â¼4ÔÂ10ÈÕÒÔǰ¶¼¿ÉÒÔ +3 1Çà¿Æ´ó¡£ 2026-04-09 5/250 2026-04-10 09:58 by ôæôæÒ»ÊéÉú
[¿¼ÑÐ] ±¾¿ÆÎ÷¹¤´ó 0856 324Çóµ÷¼Á +10 wysyjs25 2026-04-09 11/550 2026-04-10 08:37 by 5268321
[¿¼ÑÐ] 0703»¯Ñ§Çóµ÷¼Á +21 ²»ÖªÃûµÄСئ 2026-04-08 21/1050 2026-04-09 18:55 by l_paradox
[¿¼ÑÐ] 085600²ÄÁÏÓ뻯¹¤301·ÖÇóµ÷¼ÁԺУ +33 ´ÌÍ´jk 2026-04-06 34/1700 2026-04-09 18:31 by hy861222
[¿¼ÑÐ] 085600²ÄÁÏÓ뻯¹¤×¨Ë¶329 Çóµ÷¼Á +24 ¶îcc 2026-04-06 25/1250 2026-04-09 16:01 by wp06
[¿¼ÑÐ] 274Çóµ÷¼Á +5 ɽ°¢Âû 2026-04-07 5/250 2026-04-09 15:28 by 18828373951
[¿¼ÑÐ] ¿¼ÑÐÇóµ÷¼Á +4 ö©??? 2026-04-08 4/200 2026-04-08 21:44 by ÍÁľ˶ʿÕÐÉú
[¿¼ÑÐ] 304Çóµ÷¼Á +16 c297914 2026-04-05 17/850 2026-04-08 13:00 by grayjzr
[¿¼ÑÐ] 287·ÖÇóµ÷¼Á ÓÐרÀû¹ú½±Ò»Ö¾Ô¸¹þ¹¤´ó085406 +6 °×Ò׳½ 2026-04-06 7/350 2026-04-06 22:46 by 875465
[¿¼ÑÐ] 085405Èí¼þ¹¤³Ì301·ÖÇóµ÷¼Á£¬×¨Ë¶¿É¿çרҵ£¬ËÄÁù¼¶Òѹý +3 ¾²¾²ÏëÏë 2026-04-05 3/150 2026-04-06 15:23 by nepu_uu
ÐÅÏ¢Ìáʾ
ÇëÌî´¦ÀíÒâ¼û