# HW05 補充說明 :::info 12/6 updated: add example hw0502.c code 12/7 updated: p3 新增額外說明 12/7 updated: p3 精准度說明 ::: ## 5.1 Statistics - 此題不需要做 printf 或是 scanf。 - 若有非法輸入,回傳 -1。若正常輸入,回傳 0。 - Variance 使用 Population Variance,也就是除以 N ## 5.2 Gaussian Elimination :::info (實際測試程式將會有很大的不同,請多加測試) :::spoiler 參考程式 ```clike= #include "myge.h" #include <stdio.h> #include <stdlib.h> int main() { int32_t n = 3; // Flatten the matrix into a single array int32_t A[] = { 1, 1, 1, 1, 2, 4, 1, 3, 9 }; int32_t y[] = {6, 17, 34}; int32_t *x = NULL; int32_t x_answer[] = {1, 2, 3}; int32_t result = gaussian_elimination(n, A, y, &x); if (result == 1) { printf("The solution is:\n"); for (int32_t i = 0; i < n; ++i) { printf("x[%d] = %d\n", i, x[i]); } printf("example solution:\n"); for (int32_t i = 0; i < n; ++i) { printf("x[%d] = %d\n", i, x_answer[i]); } } else { printf("Wrong Answer. Result should be 1.\n"); } if (x != NULL) free(x); return 0; } ``` ::: ## 5.3 Sphere - 亂輸出東西我會以 0 分計算(你們不應在未要求輸出的 func 內 printf 任何東西) - 請確保小數點後兩位是正確的(意即,13.999 不必回傳 14.00 ,回傳13.999即可) - 輸入導致無法正常計算,或者是數學式在三維空間不成球體或平面的,請回傳 -1 - 輸入該平面與球體存在於三維空間,但不存在其交叉面積,請回傳 0 ## 5.4 TLV - number 以 uint64_t 解讀 ## 5.5 TAS Editor - 題目相關檔案在老師網站上有[連結](https://drive.google.com/drive/folders/1k5jh0vcBF2YkCCDbKPIIIwmABoMIXdy1?usp=sharing) - **tas.h** 只需要實作相關功能就好,不需要去做生成 fm2 檔案的動作 - 這題其實了解背後原理後可以很快解決,你們可以先把 **example.fm2** 帶入 **FCEUX** 去跑跑看,也順便了解一下 **NES** 搖桿按鈕的對應功能,你們會比較有些 Sense - 我先猜你們最後才寫這題,怕之後的 TA Hour 時間太晚,所以如果有太多人有疑問的話,我12/6(三)會到現場給大家問,當然也歡迎來炸信箱 - 題目有更正錯誤的敘述了,大家可以重新下載 [HW05.pdf](https://drive.google.com/file/d/1X8nfw5xhvEOjvxCWtp-uDlBebc2H4VeF/view),[tas.h](https://drive.google.com/drive/folders/1k5jh0vcBF2YkCCDbKPIIIwmABoMIXdy1) 錯誤敘述也已更正 :::spoiler 原檔案應更新敘述內容 - 題目敘述中: - **Fig5.1** 應改為 **Fig5.3** - **Fig5.2** 應改為 **Fig5.4** - button_set_frame function 錯誤敘述改正 - 原敘述的 Examples 中: After passing the function of src will be: {0, 8, 130, 80, 210, 210, 255, 210 ..... 210} size of array: 480 - 應改為: After passing the function of src will be: {0, 8, 130, 80, 210, 210, 255, 80 ..... 80} size of array: 481 - button_unset_frame function 錯誤敘述改正 - 原敘述的 Examples 中: Unset 2 value (B button) from frame 1 to frame 100. $ button_unset_frame(src, size , 2, 1, 6); - 應改為: Unset 2 value (B button) from frame 1 to frame 100. $ button_unset_frame(src, size , 2, 1, 100); - **decode.c** 與 **decode.h** 是主要給主程式(也就是hw0505.c)去調用並生成 fm2 檔案,所以在 Makefile 裡也要 link decode 相關檔案 ::: ## 5.6 # HW05 補充說明 :::info 12/6 updated: add example hw0502.c code 12/7 updated: p3 新增額外說明 12/7 updated: p3 精准度說明 ::: ## 5.1 Statistics ## 5.2 Gaussian Elimination ::: ## 5.3 Sphere ## 5.4 TLV ## 5.5 TAS Editor ## 5.6 Bonus: What is Wrong?