HW03 評分標準

3.1 Bible

兩份測資,內容為 "in the beginning""amen",每題 10 分共 20 分,評分標準如下:

Makefile or compile error -20
Segmentation Fault -10
搜尋結果 count 錯誤或參數錯誤 -5
格式錯誤(例如空格、行格式)-2~5
缺少或多餘的輸出 -2~5
Buffer size 開太小 -5

這一題有非常多同學的輸出格式和補充說明內提供的輸入及輸出範例不同,請各位多加利用助教給的資源ㄛ

3.2 Function Tracer

2.5 pts for each case

case 1
./hw0302 -i tas.h hw0505.c
case 2
./hw0302 -i tas.h --linum -c hw0505.c
case 3
./hw0302 -i tas.h --code hw0505.c
case 4
./hw0302 -f button_set_frame -l hw0505.c
case 5
./hw0302 --help -i tas.h -l -c hw0505.c
case 6
./hw0302 -a -b -c -d -e -f hi hw0505.c
case 7
./hw0302 -i tas.h -l -c hw0505.c empty.c 
case 8
./hw0302 -i tas.h -l -c hw0505.c empty.c mutiple.c

以下是被 tracer 的測試檔案內容,你們可以把檔案放到跟程式同路徑下測試

tas.h
#pragma once #include <stdint.h> #include <stdbool.h> /* Set NES button within fm2 file content by frame range. Parameters: src: The source from fm2 file content. size: src size for pointer. button: Button string to set. (Order doesn't matter) start_frame: Represent start frame to set button. end_frame: Represent end frame to set button. unset: If true, clear button but not delete it. Otherwise, as above description. Examples: Set R and B button from frame 381 to frame 480. $ button_set_frame(src, size, "RB", 381, 480, 0); Note: If the frame range is overflow, please increase the size of src automatically */ void button_set_frame(char ***src, size_t *size, const char *button, const uint64_t start_frame, const uint64_t end_frame, const bool unset); /* Set NES button within fm2 file content by second range. Parameters: src: The source from fm2 file content. size: src size for pointer. button: Button string to set. (Order doesn't matter) start_sec: Represent start second to set button. end_sec: Represent end second to set button. unset: If true, clear button but not delete it. Otherwise, as above description. Examples: Set L, B, and A button from 5.5 seconds to 15.232 seconds. $ button_set_second(src, size, "LBA", 5.5, 15.232, 0); Note: If the second range is overflow, please increase the size of src automatically */ void button_set_second(char ***src, size_t *size, const char *button, const double start_sec, const double end_sec, const bool unset); /* Set subtitle within fm2 file content by specific frame. Parameters: src: The source from fm2 file content. size: src size for pointer. subtitle: Subtitle string to set. frame: Set subtitle at specific frame. Examples: Set "Start Speed Run!!" subtitle string at frame 0. $ button_set_frame(src, size, "Start Speed Run!!", 0); */ void subtitle_set_frame(char ***src, size_t *size, const char *subtitle, const uint64_t frame); /* Set subtitle within fm2 file content by specific second. Parameters: src: The source from fm2 file content. size: src size for pointer. subtitle: Subtitle string to set. second: Set subtitle at specific second. Examples: Set "1-1 clear!!" subtitle string at 55.413 seconds. $ button_set_frame(src, size, "1-1 clear!!", 55.413); */ void subtitle_set_second(char ***src, size_t *size, const char *subtitle, const double second); /* Save fm2 file source Parameters: src: The source from fm2 file content. size: src size for pointer. */ void tas_save(const char** src, const size_t size); /* Set 1-1 map clear step fm2 content to src Parameters: src: The source from fm2 file content. size: src size for pointer. Note: - This function should be implement by the other function. - No matter the origin of src, src will be replaced by demo content. */ void demo(char*** src, size_t *size);
hw0505.c
#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include "tas.h" int main() { char **tas_content = NULL; size_t size = 0; subtitle_set_frame(&tas_content, &size, "Hello from TA!", 1); subtitle_set_second(&tas_content, &size, "There's some examples I want to show you.", 3.5); subtitle_set_frame(&tas_content, &size, "Let's start by press T", 400); button_set_frame(&tas_content, &size, "T", 400, 400, 0); subtitle_set_frame(&tas_content, &size, "Here it's about at frame 600, I will jump(press A) at 700 to 730 frame", 600); button_set_frame(&tas_content, &size, "A", 700, 730, 0); subtitle_set_frame(&tas_content, &size, "And I jump(press A) only at 800", 750); button_set_frame(&tas_content, &size, "A", 800, 800, 0); subtitle_set_frame(&tas_content, &size, "Looks difference right? Jump high or low cause by the duration of pressing the A", 850); subtitle_set_second(&tas_content, &size, "Now it's passing about 20 seconds when you running emulator", 20); subtitle_set_second(&tas_content, &size, "I will running(press R, B) for 1.5 seconds and running/jump for 1 seconds at 30th second.", 25); subtitle_set_second(&tas_content, &size, "Running and Jumping at second 30", 30); button_set_second(&tas_content, &size, "RB", 30, 32.5, 0); button_set_second(&tas_content, &size, "A", 31.5, 32.5, 0); demo(&tas_content, &size); tas_save((const char **)tas_content, size); // tas_read(&tas_content, &size); if (size) free(tas_content); return 0; }
empty.c
#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include "tas.h" int main() { return 0; }
mutiple.c
#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include "tas.h" int main() { char **tas_content = NULL; size_t size = 0; subtitle_set_frame(&tas_content, &size, "Hello from TA!", 1); button_set_frame(&tas_content, &size, "T", 400, 400, 0); /* button_set_frame(&tas_content, &size, "T", 400, 400, 0); subtitle_set_frame(&tas_content, &size, "Hello from TA!", 1); subtitle_set_frame(&tas_content, &size, "Here it's about at frame 600, I will jump(press A) at 700 to 730 frame", 600); button_set_frame(&tas_content, &size, "A", 700, 730, 0); subtitle_set_frame(&tas_content, &size, "And I jump(press A) only at 800", 750); button_set_frame(&tas_content, &size, "A", 800, 800, 0); subtitle_set_frame(&tas_content, &size, "Looks difference right? Jump high or low cause by the duration of pressing the A", 850); */ subtitle_set_frame(&tas_content, &size, "Here it's about at frame 600, I will jump(press A) at 700 to 730 frame", 600); subtitle_set_second(&tas_content, &size, "Running and Jumping at second 30", 30); // button_set_second(&tas_content, &size, "RB", 30, 32.5, 0); // button_set_second(&tas_content, &size, "A", 31.5, 32.5, 0); subtitle_set_frame(&tas_content, &size, "Looks difference right? Jump high or low cause by the duration of pressing the A", 850); subtitle_set_second(&tas_content, &size, "Now it's passing about 20 seconds when you running emulator", 20); button_set_second(&tas_content, &size, "A", 31.5, 32.5, 0); /* subtitle_set_frame(&tas_content, &size, "Hello from TA!", 1); subtitle_set_second(&tas_content, &size, "There's some examples I want to show you.", 3.5); subtitle_set_frame(&tas_content, &size, "Let's start by press T", 400); button_set_frame(&tas_content, &size, "T", 400, 400, 0); subtitle_set_frame(&tas_content, &size, "Hello from TA!", 1); subtitle_set_second(&tas_content, &size, "There's some examples I want to show you.", 3.5); subtitle_set_frame(&tas_content, &size, "Let's start by press T", 400); button_set_frame(&tas_content, &size, "T", 400, 400, 0); subtitle_set_frame(&tas_content, &size, "Hello from TA!", 1); subtitle_set_second(&tas_content, &size, "There's some examples I want to show you.", 3.5); subtitle_set_frame(&tas_content, &size, "Let's start by press T", 400); button_set_frame(&tas_content, &size, "T", 400, 400, 0); */ return 0; }

3.3 Image Steganography

皆使用你們的程式做 write 和 extract。

正常測資 16 pts:

  • ./hw0303 -w maldives.bmp secret.png,./hw0303 -e maldives.bmp extract.png: 4 pts
  • ./hw0303 -w -b 6 maldives.bmp secret.png, ./hw0303 -e -b 6 maldives.bmp extract.png: 4 pts
  • ./hw0303 -w -b 8 maldives.bmp secret.png, ./hw0303 -e -b 8 maldives.bmp extract.png: 4 pts
  • ./hw0303 -w --bits=6 maldives.bmp secret.png, ./hw0303 -e --bits=6 maldives.bmp extract.png: 4 pts

分為 write (2 pts) 及 extract (2 pts):

  • write 怪怪的: - 1 pt

錯誤測資 4 pts:

  • ./hw0303 -w maldives.bmp maldives.bmp: 2 pts
  • ./hw0303 -w -b 0 maldives.bmp secret.png: 1 pts
  • ./hw0303 -w -e maldives.bmp secret.png: 1 pts

若發生 Segmentation Fault,則拿不到分數

secret.pngextract.png:

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

在 b 為 2 的 maldives.bmp:

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

在 b 為 6 的 maldives.bmp:

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

在 b 為 8 的 maldives.bmp:

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

3.4 Game Cheater

2 pts: If you can open the right memory file by the given pid
6 pts: If you can show the character status
6 pts: If you can modify the character status
6 pts: If you can modify the character items

Partial penalty may be applied if something is not functional.

3.5 RGB Line Chart

範例測資線形正確 +3
隱藏測資線形正確 +5
線是連續的 +5
線交叉時顏色正確 +2
線的寬度正確 +3
線有漸層 +2

圖片有些微瑕疵我會忽略,一些比較奇葩的錯誤我會看情況給分

圖片連結: link
執行指令:

./hw0305 -i ./testcase/maldives.bmp -o ./output1.bmp -w 1600 -h 800 -l 5
./hw0305 -i ./testcase/cat.bmp -o ./output2.bmp -w 1600 -h 800 -l 3

答案參考圖片:

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

3.6 Bonus: ncurses

以下是我根據批改作業的經驗總結出的評分標準:

只要是該象限 0 分就是沒有提及

  1. 簡介與安裝 (0.75 - 1)

    • 0.75 分:只有提到安裝步驟,但沒有介紹 ncurse 是什麼及該工具的背景。
  2. 基本設定 (0.75 - 1)

    • 0.75 分:只提到初始化 ncurses 環境,但缺少具體說明和相關函數的使用範例。
  3. 介面設計 (0.75 - 1)

    • 0.75 分:簡要提到如何使用基本函數設計介面,缺少詳細範例。
  4. 互動功能 (0.5 - 1)

    • 0.5 分:提到互動功能的函數,但缺少詳細應用範例。
    • 1 分:詳細說明處理用戶輸入的函數,並有應用範例。
  5. 總結或參考資料 (0.25 - 1)

    • 0.25 分:簡要介紹步驟,缺少參考資料或連結。
    • 0.5 分:有詳細步驟和說明,但缺少參考資料或連結。

每有一份錯誤資訊 -1 分

大家在寫說明時,記得要附上你參考了哪些資訊!
有一些人看起來有使用到 AGI,並且產生了錯誤的內容,請多加 Review 產生的內容是否正確喔