Skip to content

Commit

Permalink
cleanup: till lecture 3 (#11)
Browse files Browse the repository at this point in the history
* fix: course1

* fix: course3

* fix: header pages
  • Loading branch information
peter-jerry-ye authored Apr 1, 2024
1 parent 9958160 commit 993f03a
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 274 deletions.
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

0 comments on commit 993f03a

Please sign in to comment.