Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup till 3 #11

Merged
merged 3 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion course1/course_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ It is recommended to adopt a **test-driven development** (TDD) workflow, namely,

> Given the two integers `num_bottles` and `num_exchange`, return _the **maximum** number of water bottles you can drink_.

```moonbit
```moonbit no-check
fn num_water_bottles(num_bottles: Int, num_exchange: Int) -> Int {
abort("To be done")
}
Expand Down
12 changes: 3 additions & 9 deletions course1/lec1.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,7 @@ fn num_water_bottles(num_bottles: Int, num_exchange: Int) -> Int {
consume(num_bottles, 0)
}

fn init {
assert(num_water_bottles(9, 3) == 13)
assert(num_water_bottles(15, 4) == 19)
}

fn assert(test: Bool) {
if test.not() {
abort("Test failed")
}
test {
@assertion.assert_eq(num_water_bottles(9, 3), 13)? // 9 + 3 + 1 = 13
@assertion.assert_eq(num_water_bottles(15, 4), 19)?
}
20 changes: 9 additions & 11 deletions course1/lec1.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ style: |
}
---

![bg cover](../pics/course1_front.png)
# 现代编程思想

## 课程介绍 & 程序设计

### 月兔公开课课程组

---

Expand Down Expand Up @@ -106,7 +110,7 @@ $$

> 给你两个整数 `num_bottles` 和 `num_exchange` ,返回你**最多**可以喝到多少瓶水。

```moonbit
```moonbit no-check
fn num_water_bottles(num_bottles: Int, num_exchange: Int) -> Int {
abort("To be done")
}
Expand All @@ -117,15 +121,9 @@ fn num_water_bottles(num_bottles: Int, num_exchange: Int) -> Int {
# 步骤三:写测试案例

```moonbit
fn init {
assert(num_water_bottles(9, 3) == 13) // 9 + 3 + 1 = 13
assert(num_water_bottles(15, 4) == 19)
}

fn assert(test: Bool) {
if test.not() {
abort("Test failed")
}
test {
@assertion.assert_eq(num_water_bottles(9, 3), 13)? // 9 + 3 + 1 = 13
@assertion.assert_eq(num_water_bottles(15, 4), 19)?
}
```

Expand Down
6 changes: 5 additions & 1 deletion course2/lec2.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ paginate: true
backgroundImage: url('../pics/background_moonbit.png')
---

![bg cover](../pics/course2_front.png)
# 现代编程思想

## 月兔开发与月兔中的表达式

### 月兔公开课课程组

---

Expand Down
Loading