Skip to content

Commit

Permalink
零.二版範例展示
Browse files Browse the repository at this point in the history
  • Loading branch information
MROS committed Oct 17, 2024
1 parent 4148a74 commit 80d6b1f
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
4 changes: 4 additions & 0 deletions book/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ export default defineConfig({
text: "精五真言生成(四)編譯若語句",
link: "/零.二版/精五真言生成(四)編譯若語句.md",
},
{
text: "階段成果展示",
link: "/零.二版/階段成果展示.md",
},
],
},
{
Expand Down
49 changes: 49 additions & 0 deletions book/零.二版/階段成果展示.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
有了遞迴與決策能力,音界咒已經能計算不少東西了。試寫了幾個有代表性又常見的術。

## 輾轉相除法

```音界
術.輾轉相除(甲、乙)【
若(乙==0)【
歸.甲
歸.輾轉相除(乙、甲%乙)
```

## 冪次

```冪次
術.冪(數、次方)【
若(次方==0)【
歸.1
歸.數*冪(數、次方-1)
```

## 印出費氏數列前十項

```音界
術.費氏數(項)【
若(項<=1)【
歸.1
歸.費氏數(項-2)+費氏數(項-1)
術.打印數列(項)【
若(項>1)【
打印數列(項-1)
曰(費氏數(項))
術.初()【
打印數列(10)
歸.0
```

## 更多範例
更多範例可以參考[音界咒範例幕目錄](https://github.com/MROS/yinjie-lang/tree/611271b2b935f41c720f12191d1432da5d6b4e9d/%E9%9B%B6%E8%99%9F%E7%B7%A8%E8%AD%AF%E5%99%A8/%E7%AF%84%E4%BE%8B)

0 comments on commit 80d6b1f

Please sign in to comment.