# HW03 補充說明
:::info
作業發出後,任何更新將會寫於此
3.3 (10/20) 更改函式名稱
3.2 (10/24) 範例angle 從-1更改為1
```
initialize(-1, -1, -M_PI);
print(); //position: (-1.00,-1.00), angle: 1.00
```
3.2 (10/28) 範例程式
:::
## 3.1 Circle Functions
- 本題可以引入外部的 header file
- 本題精度為 `double`,所有的運算過程與結果也會在 `double` 範圍內。
- 在 `set_radius()` 時,如果第一次設定為合法的 `r`,但第二次設定不合法。請回傳 `-1` 並使用最後一次合法的 `r`。
- PI 值如果只設定 `3.14` 會不符合精度為 `double`的條件,誤差會很大哦!
- 若要求回傳 `negative number`,則任意負數皆可。
- `inner_regular_polygon_area` 是計算圓心的內切正 n 邊形面積
- `outer_regular_polygon_area` 是計算圓心的外切正 n 邊形面積
- `double get_circle_area( double x );` 改為 ` double get_tangent_area( double x );`
## 3.2 Control Game Character
- print() 請四捨五入到小數點後兩位
- turnclock() 和 counterturnclock() 旋轉單位為 $\pi$
- 本題精度一樣為 `double`,所有的運算過程與結果也會在 `double` 範圍內。
- initialize 要能夠支援多次 initialize,如下
```c=
int main() {
initialize(0, 0, 0);
print(); //position: (0.00,0.00), angle: 0.00
initialize(1, 1, M_PI);
print(); //position: (1.00,1.00), angle: 1.00
initialize(-1, -1, -M_PI);
print(); //position: (-1.00,-1.00), angle: 1.00
}
```
- 範例程式
```c=
#include "mycontrol.h"
int main() {
initialize(0, 0, 0);
counterclock_turn(M_PI /3);
forward(3);
print(); // position: (1.50,2.60), angle: 0.33
clock_turn(M_PI / 3);
forward(3);
print(); // position: (4.50,2.60), angle: 0.00
return 0;
}
```
## 3.3 Binary Form
- 記得題目要求輸入為 signed 32-bit integer,其餘當作錯誤輸入做例外處理
- feature function 請命名為 BinaryForm(),方便辨識
- 請用二補數表示
- 題目上的需求和定義範圍應該蠻清楚了,一樣,輸出的時候請跟範例的格式相同
## 3.4 Tower of Hanoi
> 此題沒有語法限制,所以請盡可能寫出漂亮優雅的程式
請注意:此題需要有兩個執行檔:`hw0304-1` 與 `hw0304-2`。
- `hw0304-1` 為**遞迴 (recursive)**
- `hw0304-2` 為**迭代 (iterative)**
你需要在 Makefile 中包含兩種 library 與執行檔,例如:
```makefile
all:
gcc -c -o hw0304-1.o hw0304-1.c
gcc -c -o hw0304-2.o hw0304-2.c
gcc -o hw0304-1 hw0304.c hw0304-1.o
gcc -o hw0304-2 hw0304.c hw0304-2.o
```
一個我認為不錯的依賴關係圖:

> **The Hint**
> In the realm of ancient towers, Hanoi stands tall,
Three rods, many disks, a challenge for all.
Recursion's embrace, the heart of the game,
Yet loops, too, can earn iterative fame.
>
> For the recursive path, the hint's quite clear,
Move the topmost, then bring the rest near.
Base case to ponder: just one disk in play,
Else split and conquer, the recursive way.
>
> To tackle with loops, think of binary might,
Each disk a bit, toggling left and right.
Increment a counter, and based on its bits,
Move disks, small to large, as logic permits.
>
> Behold these hints, in poetic disguise,
May they light your path, as stars in the skies.
> [name=GPT-4V]
## 3.5 How to roll your dice SE (Simple Edition)?
再次重申,不能使用範例上的骰子表示方式。
如果你不知道要用什麼形式表示骰子,下面的範例給你參考:
```
(\_/) (\_/) (\_/)
(•_•) (•_•) (•_•)
/>87> /> 4> /> 1>
```
也可以把數字加上黃色讓使用更方便,如果想到更酷的表示方式助教會更開心!
## 3.6 Bonus: diff and patch
## 3.7 Bonus: Plagiarism Detection