diff --git a/uml/A00celltype.plantuml b/uml/A00celltype.plantuml deleted file mode 100644 index eb93db5c9ee7df43c9033b52d77132bca2a0bb62..0000000000000000000000000000000000000000 --- a/uml/A00celltype.plantuml +++ /dev/null @@ -1,5 +0,0 @@ -@startuml -start -:定义一个deadcell⬜ ,定义一个livecell⬛; -stop -@enduml diff --git a/uml/A00cellxy.plantuml b/uml/A00cellxy.plantuml deleted file mode 100644 index 36092179dcb4f8751f0111d3ca70007e5f262f31..0000000000000000000000000000000000000000 --- a/uml/A00cellxy.plantuml +++ /dev/null @@ -1,12 +0,0 @@ -@startuml -start -split - :定义场景边界长度x,宽度y; -split again - :定义åˆå§‹å˜æ´»ç»†èƒžåæ ‡ä½ç½®; -split again - :定义细胞更新的延时时间; -end split -stop -@enduml - diff --git a/uml/A01_main.plantuml b/uml/A01_main.plantuml new file mode 100644 index 0000000000000000000000000000000000000000..a5240aa60c6b60fe3ffb59092aa4f7772a22ec0d --- /dev/null +++ b/uml/A01_main.plantuml @@ -0,0 +1,22 @@ +@startuml 康å¨ç”Ÿå‘½æ¸¸æˆä¸»å¾ªçŽ¯ä½“ +start +:导入createapply,initapply,print,nextcell,cellxy; +:创建allcellls二维数组; +note right:allcells是æ¯æ¬¡æ¯ä¸ªç»†èƒžçš„状æ€æ•°ç»„ +:定义i; +note right:用于记录刷新次数 +:allcellls接收createapply()函数返回的值; +note right:createapply()是åˆå§‹åŒ–康å¨ç”Ÿå‘½æ¸¸æˆçš„所有细胞 +:init(allcellls); +note right:init()是给康å¨ç”Ÿå‘½æ¸¸æˆåˆå§‹åŒ– +repeat: + :console.clear(); + note right:清除控制å°æ˜¾ç¤º + :print(allcellls); + note right:在控制å°æ‰“å°æ¯ä¸ªç»†èƒžçš„çŠ¶æ€ + :nextcell(allcellls); + note right:æ¼”å˜ä¸‹ä¸€ä¸ªçŠ¶æ€ + :打å°i+=1,为当å‰åˆ·æ–°æ¬¡æ•°; +repeat while(æ¯time循环) +stop +@enduml diff --git a/uml/A01initapply_01.plantuml b/uml/A01initapply_01.plantuml deleted file mode 100644 index 8fc27bec36ec08b5e6fe7e74b55edde8b492f9d8..0000000000000000000000000000000000000000 --- a/uml/A01initapply_01.plantuml +++ /dev/null @@ -1,11 +0,0 @@ -@startuml -start -:接å—åˆå§‹åŒ–ç›®æ ‡åæ ‡äºŒç»´æ•°ç»„; -:创建一个二维数组allcells:Array<Array<string>>; -:ä¼ å…¥createapply(allcells); -note right:渲染整个康å¨ç”Ÿå‘½æ¸¸æˆçš„细胞 -:éåŽ†ç›®æ ‡åæ ‡äºŒç»´æ•°ç»„ï¼Œallcells[i][j]=livecell; -note right:åˆå§‹åŒ–æ´»ç»†èƒžï¼ŒæŠŠç›®æ ‡çš„æ»ç»†èƒžæ›¿æ¢æˆæ´»ç»†èƒž; -:调用change(); -stop -@enduml diff --git a/uml/A01createapply_00.plantuml b/uml/A02_createapply.plantuml similarity index 52% rename from uml/A01createapply_00.plantuml rename to uml/A02_createapply.plantuml index 646a67f7a8a2b06e9646312781a83c0cc7b22dec..3c969366b6c7e9f41465cb65334178440be21b62 100644 --- a/uml/A01createapply_00.plantuml +++ b/uml/A02_createapply.plantuml @@ -1,7 +1,8 @@ -@startuml +@startuml åˆå§‹åŒ–所有细胞为æ»ç»†èƒž start -:ä¼ å…¥åº·å¨ç”Ÿå‘½æ¸¸æˆçš„二维数组; +:创建一个allcells二维数组; :循环给æ¯ä¸ªæ•°ç»„空间åˆå§‹åŒ–; :ç»™æ¯ä¸ªæ•°ç»„ç©ºé—´ä¼ å…¥deadcell(æ»ç»†èƒž); +:return allcells; stop @enduml diff --git a/uml/A02_initapply.plantuml b/uml/A02_initapply.plantuml new file mode 100644 index 0000000000000000000000000000000000000000..cf790dc8a8f32b5a3f73d214308108c00c2c8f44 --- /dev/null +++ b/uml/A02_initapply.plantuml @@ -0,0 +1,11 @@ +@startuml åˆå§‹æ¼”å˜åæ ‡ +start +:接å—allcells二维数组; +:定义celllen获å–åˆå§‹æ¼”å˜åæ ‡ä¸ªæ•°; +while(i < celllen) + :copyallcells[xy.cellinit[i][0]][xy.cellinit[i][1]] = ct.livecell; + note right:åˆå§‹æ¼”å˜åæ ‡çš„ç»†èƒžæ”¹ä¸ºæ´»ç»†èƒž + :i+=1; +endwhile +stop +@enduml diff --git a/uml/A02_nextcell.plantuml b/uml/A02_nextcell.plantuml new file mode 100644 index 0000000000000000000000000000000000000000..152e216c5450c0f637c8bdc2d846ac18da6c0674 --- /dev/null +++ b/uml/A02_nextcell.plantuml @@ -0,0 +1,15 @@ +@startuml 下一æ¥æ¼”å˜ +start +:定义一个cellnum; +:接收二维数组allcells; +:定义一个getallcells二维数组; +:arraytovalue(xy.x, xy.y, allcells, getallcells); +note right:把allcellså€¼ä¼ ç»™getallcells +repeat :é历æ¯ä¸ªç»†èƒž; + :cellnum=countcell(i,j,getallcells); + :rule(i,j,cellnum,getallcells[i][j],allcells) +backward:获å–下一个getallcellsåæ ‡; +repeat while (下一æ¥è½¬å˜) is (yes) not (no) +note right:é历æ¯ä¸ªç»†èƒž +stop +@enduml diff --git a/uml/A01print_01.plantuml b/uml/A02_print.plantuml similarity index 66% rename from uml/A01print_01.plantuml rename to uml/A02_print.plantuml index 9c2190fc4b176f321082dbff30c8bff7ea2723ce..60d245ddcf214881840dfc996bc273c11cf391d8 100644 --- a/uml/A01print_01.plantuml +++ b/uml/A02_print.plantuml @@ -1,8 +1,8 @@ -@startuml +@startuml 输出æ¯ä¸ªç»†èƒžçŠ¶æ€ start :接收二维数组allcells; :定义空å—符串cell; -while(allcells 是å¦å…¨éƒ¨é历) is (no) +while(allcells 是å¦å…¨éƒ¨ä¾¿åˆ©) is (no) :cell拼接æ¯ä¸ªæ•°ç»„(allcells[i][j]); endwhile (yes) :输出å—符串cell; diff --git a/uml/A02countcell.plantuml b/uml/A02countcell.plantuml deleted file mode 100644 index ef229b9e6b89251a60cc692f66f91af37132c9a0..0000000000000000000000000000000000000000 --- a/uml/A02countcell.plantuml +++ /dev/null @@ -1,52 +0,0 @@ -@startuml -start -:导入cellxy.ts -:接收i,j,getallcells数组; -:定义cellnum; -note right:ç”¨äºŽè®°å½•ç»†èƒžå‘¨å›´æ´»ç»†èƒžæ•°é‡ -if(i-1>=0) then (yes) - if(j-1>=0) then (yes) - if(getallcells[i-1][j-1] 是å¦æ´»ç»†èƒž) then (yes) - :cellnum++; - endif - note right:计算细胞左上 - if(getallcells[i-1][j] 是å¦æ´»ç»†èƒž) then (yes) - :cellnum++; - endif - note right:计算细胞æ£ä¸Š - if(getallcells[i][j-1] 是å¦æ´»ç»†èƒž) then (yes) - :cellnum++; - endif - note right:计算细胞æ£å·¦ - elseif (j+1 <xy.y) - if(getallcells[i-1][j+1] 是活细胞) then (yes) - :cellnum++; - endif - note right:计算细胞左下 - if(getallcells[i][j+1] 是活细胞) then (yes) - :cellnum++; - endif - note right:计算细胞æ£ä¸‹ - endif - -elseif(i+1<xy.x) then (yes) - if(j-1>=0) then (yes) - if(getallcells[i+1][j-1] 是å¦æ´»ç»†èƒž) then (yes) - :cellnum++; - endif - note right:计算细胞å³ä¸Š - if(getallcells[i+1][j] 是å¦æ´»ç»†èƒž) then (yes) - :cellnum++; - endif - note right:计算细胞æ£å³ - elseif (j+1 <xy.y) - if(getallcells[i+1][j+1] 是活细胞) then (yes) - :cellnum++; - endif - note right:计算细胞å³ä¸‹ - endif -endif -:return cellnum; -note right:è¿”å›žæ´»ç»†èƒžæ•°é‡ -stop -@enduml diff --git a/uml/A03_arraytovalue.plantuml b/uml/A03_arraytovalue.plantuml new file mode 100644 index 0000000000000000000000000000000000000000..b66e551a0873f8836e450a0e5c992faeb4f7ea83 --- /dev/null +++ b/uml/A03_arraytovalue.plantuml @@ -0,0 +1,13 @@ +@startuml äºŒç»´æ•°ç»„å€¼ä¼ é€’ +start +:接收x,y,arry,getarray; +:i=0; +while(i<x) + :copygetarray[i] = []; + :i+=1; +endwhile +repeat :é历æ¯ä¸ªäºŒç»´æ•°ç»„å…ƒç´ + :copygetarray[i][j] = array[i][j]; +repeat while(i+=1,j+=1) +stop +@enduml diff --git a/uml/A03_countcell.plantuml b/uml/A03_countcell.plantuml new file mode 100644 index 0000000000000000000000000000000000000000..a0cea9721074cda8b8176b12f3ae90d7b432a198 --- /dev/null +++ b/uml/A03_countcell.plantuml @@ -0,0 +1,50 @@ +@startuml è®¡ç®—ç»†èƒžå‘¨å›´æ´»ç»†èƒžæ•°é‡ +start +:导入cellxy.ts +:接收i,j,getallcells数组; +:定义cellnum; +note right:ç”¨äºŽè®°å½•ç»†èƒžå‘¨å›´æ´»ç»†èƒžæ•°é‡ +if(i - 1 >= 0 && j - 1 >= 0) + if(getallcells[i - 1][j - 1] === ct.livecell) + :cellnum+=1; + endif +endif +if(i - 1 >= 0) + if(getallcells[i - 1][j] === ct.livecell) + :cellnum+=1; + endif +endif +if(i - 1 >= 0 && j + 1 < xy.y) + if(getallcells[i - 1][j + 1] === ct.livecell) + :cellnum+=1; + endif +endif +if(j - 1 >= 0) + if(getallcells[i][j - 1] === ct.livecell) + :cellnum+=1; + endif +endif +if(j + 1 < xy.y) + if(getallcells[i][j + 1] === ct.livecell) + :cellnum+=1; + endif +endif +if(i + 1 < xy.x && j - 1 < xy.y) + if(getallcells[i + 1][j - 1] === ct.livecell) + :cellnum+=1; + endif +endif +if(i + 1 < xy.x) + if(getallcells[i + 1][j] === ct.livecell) + :cellnum+=1; + endif +endif +if(i + 1 < xy.x && j + 1 < xy.y) + if(getallcells[i + 1][j + 1] === ct.livecell) + :cellnum; + endif +endif +:return cellnum; +note right:è¿”å›žæ´»ç»†èƒžæ•°é‡ +stop +@enduml diff --git a/uml/A02rule.plantuml b/uml/A03_rule.plantuml similarity index 94% rename from uml/A02rule.plantuml rename to uml/A03_rule.plantuml index a6039bb9b4d4b9f487c45bfa2fc2bf6fb3e24195..42cbc4bd26456491e9303d2b60cf7be506330726 100644 --- a/uml/A02rule.plantuml +++ b/uml/A03_rule.plantuml @@ -1,6 +1,5 @@ -@startuml +@startuml 康å¨ç”Ÿå‘½æ¸¸æˆè§„则,改å˜ç»†èƒžçŠ¶æ€ start -:import * as ct from './celltype'; :接收allcells,getallcellstostr,cellnum,i,j; if(getallcellstostr.equals("deadcell")) then (yes) if(cellnum == 3) then (yes) diff --git a/uml/A03nextcell_02.plantuml b/uml/A03nextcell_02.plantuml deleted file mode 100644 index f5813b5cb045a2e3a74626cdcf5a15b80f31b5f6..0000000000000000000000000000000000000000 --- a/uml/A03nextcell_02.plantuml +++ /dev/null @@ -1,21 +0,0 @@ -@startuml -start -: import * as xy from './cellxy' - import { countcell } from './countcell' - import { rule } from './rule'; -:接收二维数组allcells; -:定义一个getallcells二维数组 -定义一个cellnum; - -:allcells赋值给getallcells; -note right:为了改å˜å½“å‰ç»†èƒžçŠ¶æ€ï¼Œä½†ä¸‹ä¸€æ¥ä¸å½±å“当å‰ç»†èƒžçš„è¯»å– -repeat :é历æ¯ä¸ªç»†èƒž; - :cellnum=countcell(i,j,getallcells); - :rule(i,j,cellnum,getallcells[i][j],allcells); -backward:获å–下一个getallcellsåæ ‡; -repeat while (下一æ¥è½¬å˜) is (yes) not (no) -note right:é历æ¯ä¸ªç»†èƒž -:print(allcells); -note right:打å°å˜åŒ–åŽçš„生命图 -stop -@enduml diff --git a/uml/Amain.plantuml b/uml/Amain.plantuml deleted file mode 100644 index 5f84c7113b01b0f5eb242c45960d2d9126b5cbcb..0000000000000000000000000000000000000000 --- a/uml/Amain.plantuml +++ /dev/null @@ -1,19 +0,0 @@ -@startuml -' allcells = createapply(); -' init(allcells); -' let i = 0; -' setInterval(() => { -' console.clear(); -' print(allcells); -' nextcell(allcells); -' console.log('å·²è¿è¡Œæ—¶é—´:'+(i += 1)); -' }, time); -start -:创建20*20的场景空间,全部渲染为æ»ç»†èƒž; -:定义åˆå§‹å˜æ´»ç»†èƒžçš„åæ ‡; -repeat -:渲染å˜æ´»ç»†èƒž; -:更新细胞的下一æ¥çŠ¶æ€; -repeat while (æ¯éš”一秒更新) -stop -@enduml diff --git a/uml/celltype.plantuml b/uml/celltype.plantuml new file mode 100644 index 0000000000000000000000000000000000000000..22c732f4eb15900ee7087f426c60892632239503 --- /dev/null +++ b/uml/celltype.plantuml @@ -0,0 +1,6 @@ +@startuml 细胞状æ€çš„å‚æ•° +start +:定义livecell为活细胞,livecell = '⬛'; +:定义livecell为æ»ç»†èƒžï¼Œdeadcell = '⬜'; +stop +@enduml diff --git a/uml/cellxy.plantuml b/uml/cellxy.plantuml new file mode 100644 index 0000000000000000000000000000000000000000..c90568c24df740085c6b62fcb379345f760af565 --- /dev/null +++ b/uml/cellxy.plantuml @@ -0,0 +1,7 @@ +@startuml åæ ‡å‚数,åˆå§‹ç»†èƒžåæ ‡ï¼ŒèŒƒå›´åæ ‡ï¼Œåˆ·æ–°æ—¶é—´ +start +:定义cellinit为输入åˆå§‹å‚æ•° +:定义x,y为生命范围 +:定义time为刷新时间 +stop +@enduml