From c22abb2e2c15fae2d5f6494e617b3f9179bac5e0 Mon Sep 17 00:00:00 2001 From: AnHaechan Date: Tue, 22 Aug 2023 09:15:54 +0000 Subject: [PATCH 01/17] Update info on safe exam browser, ChatGPT --- README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a3a5e2c..3752b2a 100644 --- a/README.md +++ b/README.md @@ -146,8 +146,11 @@ Make sure you're capable of using the following development tools: - Your physical apperance is required. If online participation is **absolutely necessary**, we'll use Zoom. -- You'll bring your own laptop. (You can also borrow one from School of Computing Admin Team.) - We will use surveillance tools such as [Safe Exam Browser](https://safeexambrowser.org/) to monitor your laptop. +- You should bring your own laptop. (You can also borrow one from School of Computing Admin Team.) + +- We will use [Safe Exam Browser](https://safeexambrowser.org/) to prevent cheatings. + - You should have your laptop configured with Safe Exam Browser before the exam. + - TBA: Details will be announced later. ### Attendance (?%) @@ -180,7 +183,7 @@ Make sure you're capable of using the following development tools: - Ask questions on course materials and assignments in [this repository's issue tracker](https://github.com/kaist-cp/cs220/issues). + Don't send emails to the instructor or TAs for course materials and assignments. - + Before asking a question, search for it in Google and Stack Overflow. + + Before asking a question, ask it to [ChatGPT](https://chat.openai.com/). Or search for it in Google and Stack Overflow. + Describe your question in as much detail as possible. It should include the following things: * Environment (OS, gcc, g++ version, and any other related program information). * Command(s) that you used and the result. Any logs should be formatted in code. Refer to [this](https://guides.github.com/features/mastering-markdown/). @@ -188,6 +191,7 @@ Make sure you're capable of using the following development tools: * Googling result. Search before asking, and share the keyword used for searching and what you've learned from it. + Give a proper title to your issue. + Read [this](https://github.com/kaist-cp/cs220#communication) for more instructions. + + Questions will be answered within 2 days mostly. + I'm requiring you to ask questions online first for two reasons. First, clearly writing a question is the first step to reaching an answer. Second, you can benefit from the questions and answers of other students. From f64b0461535089de0f5c64799409e31b8e5a4dd4 Mon Sep 17 00:00:00 2001 From: AnHaechan Date: Fri, 25 Aug 2023 04:39:12 +0000 Subject: [PATCH 02/17] why3: newline --- assets/why3/assignment05/binary_search.mlw | 2 +- assets/why3/assignment05/max.mlw | 2 +- assets/why3/assignment05/pascal.mlw | 2 +- assets/why3/exercises/ex1_eucl_div.mlw | 2 +- assets/why3/exercises/ex2_fact.mlw | 2 +- assets/why3/exercises/ex3_two_way.mlw | 2 +- assets/why3/exercises/solutions/ex1_eucl_div_sol.mlw | 2 +- assets/why3/exercises/solutions/ex2_fact_sol.mlw | 2 +- assets/why3/exercises/solutions/ex3_two_way_sol.mlw | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/assets/why3/assignment05/binary_search.mlw b/assets/why3/assignment05/binary_search.mlw index 17cd0c9..92fb42d 100644 --- a/assets/why3/assignment05/binary_search.mlw +++ b/assets/why3/assignment05/binary_search.mlw @@ -20,4 +20,4 @@ module BinarySearch (* IMPORTANT: DON'T MODIFY THE ABOVE LINES *) 0 (* TODO *) -end \ No newline at end of file +end diff --git a/assets/why3/assignment05/max.mlw b/assets/why3/assignment05/max.mlw index 49c168e..b0b858b 100644 --- a/assets/why3/assignment05/max.mlw +++ b/assets/why3/assignment05/max.mlw @@ -26,4 +26,4 @@ module Max done; max -end \ No newline at end of file +end diff --git a/assets/why3/assignment05/pascal.mlw b/assets/why3/assignment05/pascal.mlw index c3cd28f..bf1f02a 100644 --- a/assets/why3/assignment05/pascal.mlw +++ b/assets/why3/assignment05/pascal.mlw @@ -38,4 +38,4 @@ module Pascal done; row -end \ No newline at end of file +end diff --git a/assets/why3/exercises/ex1_eucl_div.mlw b/assets/why3/exercises/ex1_eucl_div.mlw index 24fa3af..c4aaf20 100644 --- a/assets/why3/exercises/ex1_eucl_div.mlw +++ b/assets/why3/exercises/ex1_eucl_div.mlw @@ -26,4 +26,4 @@ module Division done; q -end \ No newline at end of file +end diff --git a/assets/why3/exercises/ex2_fact.mlw b/assets/why3/exercises/ex2_fact.mlw index bef4c59..adad25e 100644 --- a/assets/why3/exercises/ex2_fact.mlw +++ b/assets/why3/exercises/ex2_fact.mlw @@ -46,4 +46,4 @@ module FactLoop done; r -end \ No newline at end of file +end diff --git a/assets/why3/exercises/ex3_two_way.mlw b/assets/why3/exercises/ex3_two_way.mlw index 836722e..24705bd 100644 --- a/assets/why3/exercises/ex3_two_way.mlw +++ b/assets/why3/exercises/ex3_two_way.mlw @@ -48,4 +48,4 @@ module TwoWaySort end done -end \ No newline at end of file +end diff --git a/assets/why3/exercises/solutions/ex1_eucl_div_sol.mlw b/assets/why3/exercises/solutions/ex1_eucl_div_sol.mlw index f8580e7..7a28ad7 100644 --- a/assets/why3/exercises/solutions/ex1_eucl_div_sol.mlw +++ b/assets/why3/exercises/solutions/ex1_eucl_div_sol.mlw @@ -27,4 +27,4 @@ module Division done; q -end \ No newline at end of file +end diff --git a/assets/why3/exercises/solutions/ex2_fact_sol.mlw b/assets/why3/exercises/solutions/ex2_fact_sol.mlw index cfd514b..d5d6322 100644 --- a/assets/why3/exercises/solutions/ex2_fact_sol.mlw +++ b/assets/why3/exercises/solutions/ex2_fact_sol.mlw @@ -34,4 +34,4 @@ module FactLoop done; r -end \ No newline at end of file +end diff --git a/assets/why3/exercises/solutions/ex3_two_way_sol.mlw b/assets/why3/exercises/solutions/ex3_two_way_sol.mlw index 72a6bb7..3286ab5 100644 --- a/assets/why3/exercises/solutions/ex3_two_way_sol.mlw +++ b/assets/why3/exercises/solutions/ex3_two_way_sol.mlw @@ -46,4 +46,4 @@ module TwoWaySort end done -end \ No newline at end of file +end From 176d0df5d28e0fb120da6462251007bfd35c525e Mon Sep 17 00:00:00 2001 From: woojin Date: Fri, 25 Aug 2023 23:43:40 +0900 Subject: [PATCH 03/17] cargo doc --- src/assignments/assignment11/graph.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/assignments/assignment11/graph.rs b/src/assignments/assignment11/graph.rs index 7c3ca6f..7f8f823 100644 --- a/src/assignments/assignment11/graph.rs +++ b/src/assignments/assignment11/graph.rs @@ -90,7 +90,7 @@ impl SubGraph { } /// Returns true iff the subgraph contains a cycle. Nodes that do not belong to this subgraph - /// are ignored. See https://en.wikipedia.org/wiki/Cycle_(graph_theory) for an algorithm. + /// are ignored. See for an algorithm. pub fn detect_cycle(&self) -> bool { todo!() } From 6858e18da235db057f70f92988d7aa63803fbb0c Mon Sep 17 00:00:00 2001 From: woojin Date: Sat, 26 Aug 2023 00:30:22 +0900 Subject: [PATCH 04/17] grade scripts --- scripts/grade-01.sh | 33 ------ scripts/grade-02.sh | 33 ------ scripts/grade-03.sh | 33 ------ scripts/grade-04.sh | 33 ------ scripts/grade-06.sh | 33 ------ scripts/grade-07.sh | 33 ------ scripts/grade-08.sh | 33 ------ scripts/grade-09.sh | 33 ------ scripts/grade-10.sh | 33 ------ scripts/grade-11.sh | 33 ------ scripts/grade-12.sh | 33 ------ scripts/grade-13.sh | 33 ------ scripts/grade-utils.sh | 18 +-- scripts/grade.sh | 105 ++++++++++++++++++ src/assignments/assignment01/mod.rs | 4 +- .../assignment01/small_exercises.rs | 4 +- src/assignments/assignment02/mod.rs | 4 +- src/assignments/assignment03/mod.rs | 4 +- src/assignments/assignment04/mod.rs | 4 +- src/assignments/assignment06/mod.rs | 4 +- src/assignments/assignment07/mod.rs | 4 +- src/assignments/assignment08/mod.rs | 4 +- src/assignments/assignment09/mod.rs | 4 +- src/assignments/assignment10/mod.rs | 4 +- src/assignments/assignment11/mod.rs | 4 +- src/assignments/assignment12/mod.rs | 4 +- src/assignments/assignment13/mod.rs | 4 +- 27 files changed, 141 insertions(+), 430 deletions(-) delete mode 100755 scripts/grade-01.sh delete mode 100755 scripts/grade-02.sh delete mode 100755 scripts/grade-03.sh delete mode 100755 scripts/grade-04.sh delete mode 100755 scripts/grade-06.sh delete mode 100755 scripts/grade-07.sh delete mode 100755 scripts/grade-08.sh delete mode 100755 scripts/grade-09.sh delete mode 100755 scripts/grade-10.sh delete mode 100755 scripts/grade-11.sh delete mode 100755 scripts/grade-12.sh delete mode 100755 scripts/grade-13.sh create mode 100755 scripts/grade.sh diff --git a/scripts/grade-01.sh b/scripts/grade-01.sh deleted file mode 100755 index 4add88a..0000000 --- a/scripts/grade-01.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -uo pipefail -IFS=$'\n\t' - -# Imports library. -BASEDIR=$(dirname "$0") -source $BASEDIR/grade-utils.sh - -RUNNERS=( - "cargo" - "cargo --release" - "cargo_asan" - "cargo_asan --release" - "cargo_tsan" - "cargo_tsan --release" -) - -# Lints. -run_linters || exit 1 - -# Executes test for each runner. -for RUNNER in "${RUNNERS[@]}"; do - echo "Running with $RUNNER..." - - TESTS=("--lib assignment01") - if [ $(run_tests) -ne 0 ]; then - exit 1 - fi -done - -exit 0 diff --git a/scripts/grade-02.sh b/scripts/grade-02.sh deleted file mode 100755 index 2d50a5c..0000000 --- a/scripts/grade-02.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -uo pipefail -IFS=$'\n\t' - -# Imports library. -BASEDIR=$(dirname "$0") -source $BASEDIR/grade-utils.sh - -RUNNERS=( - "cargo" - "cargo --release" - "cargo_asan" - "cargo_asan --release" - "cargo_tsan" - "cargo_tsan --release" -) - -# Lints. -run_linters || exit 1 - -# Executes test for each runner. -for RUNNER in "${RUNNERS[@]}"; do - echo "Running with $RUNNER..." - - TESTS=("--lib assignment02") - if [ $(run_tests) -ne 0 ]; then - exit 1 - fi -done - -exit 0 diff --git a/scripts/grade-03.sh b/scripts/grade-03.sh deleted file mode 100755 index 4e9f47e..0000000 --- a/scripts/grade-03.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -uo pipefail -IFS=$'\n\t' - -# Imports library. -BASEDIR=$(dirname "$0") -source $BASEDIR/grade-utils.sh - -RUNNERS=( - "cargo" - "cargo --release" - "cargo_asan" - "cargo_asan --release" - "cargo_tsan" - "cargo_tsan --release" -) - -# Lints. -run_linters || exit 1 - -# Executes test for each runner. -for RUNNER in "${RUNNERS[@]}"; do - echo "Running with $RUNNER..." - - TESTS=("--lib assignment03") - if [ $(run_tests) -ne 0 ]; then - exit 1 - fi -done - -exit 0 diff --git a/scripts/grade-04.sh b/scripts/grade-04.sh deleted file mode 100755 index 2f0fdc7..0000000 --- a/scripts/grade-04.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -uo pipefail -IFS=$'\n\t' - -# Imports library. -BASEDIR=$(dirname "$0") -source $BASEDIR/grade-utils.sh - -RUNNERS=( - "cargo" - "cargo --release" - "cargo_asan" - "cargo_asan --release" - "cargo_tsan" - "cargo_tsan --release" -) - -# Lints. -run_linters || exit 1 - -# Executes test for each runner. -for RUNNER in "${RUNNERS[@]}"; do - echo "Running with $RUNNER..." - - TESTS=("--lib assignment04") - if [ $(run_tests) -ne 0 ]; then - exit 1 - fi -done - -exit 0 diff --git a/scripts/grade-06.sh b/scripts/grade-06.sh deleted file mode 100755 index bd89d59..0000000 --- a/scripts/grade-06.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -uo pipefail -IFS=$'\n\t' - -# Imports library. -BASEDIR=$(dirname "$0") -source $BASEDIR/grade-utils.sh - -RUNNERS=( - "cargo" - "cargo --release" - "cargo_asan" - "cargo_asan --release" - "cargo_tsan" - "cargo_tsan --release" -) - -# Lints. -run_linters || exit 1 - -# Executes test for each runner. -for RUNNER in "${RUNNERS[@]}"; do - echo "Running with $RUNNER..." - - TESTS=("--lib assignment06") - if [ $(run_tests) -ne 0 ]; then - exit 1 - fi -done - -exit 0 diff --git a/scripts/grade-07.sh b/scripts/grade-07.sh deleted file mode 100755 index 766286d..0000000 --- a/scripts/grade-07.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -uo pipefail -IFS=$'\n\t' - -# Imports library. -BASEDIR=$(dirname "$0") -source $BASEDIR/grade-utils.sh - -RUNNERS=( - "cargo" - "cargo --release" - "cargo_asan" - "cargo_asan --release" - "cargo_tsan" - "cargo_tsan --release" -) - -# Lints. -run_linters || exit 1 - -# Executes test for each runner. -for RUNNER in "${RUNNERS[@]}"; do - echo "Running with $RUNNER..." - - TESTS=("--lib assignment07") - if [ $(run_tests) -ne 0 ]; then - exit 1 - fi -done - -exit 0 diff --git a/scripts/grade-08.sh b/scripts/grade-08.sh deleted file mode 100755 index 815f90d..0000000 --- a/scripts/grade-08.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -uo pipefail -IFS=$'\n\t' - -# Imports library. -BASEDIR=$(dirname "$0") -source $BASEDIR/grade-utils.sh - -RUNNERS=( - "cargo" - "cargo --release" - "cargo_asan" - "cargo_asan --release" - "cargo_tsan" - "cargo_tsan --release" -) - -# Lints. -run_linters || exit 1 - -# Executes test for each runner. -for RUNNER in "${RUNNERS[@]}"; do - echo "Running with $RUNNER..." - - TESTS=("--lib assignment08") - if [ $(run_tests) -ne 0 ]; then - exit 1 - fi -done - -exit 0 diff --git a/scripts/grade-09.sh b/scripts/grade-09.sh deleted file mode 100755 index fc449ea..0000000 --- a/scripts/grade-09.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -uo pipefail -IFS=$'\n\t' - -# Imports library. -BASEDIR=$(dirname "$0") -source $BASEDIR/grade-utils.sh - -RUNNERS=( - "cargo" - "cargo --release" - "cargo_asan" - "cargo_asan --release" - "cargo_tsan" - "cargo_tsan --release" -) - -# Lints. -run_linters || exit 1 - -# Executes test for each runner. -for RUNNER in "${RUNNERS[@]}"; do - echo "Running with $RUNNER..." - - TESTS=("--lib assignment09") - if [ $(run_tests) -ne 0 ]; then - exit 1 - fi -done - -exit 0 diff --git a/scripts/grade-10.sh b/scripts/grade-10.sh deleted file mode 100755 index 87897bb..0000000 --- a/scripts/grade-10.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -uo pipefail -IFS=$'\n\t' - -# Imports library. -BASEDIR=$(dirname "$0") -source $BASEDIR/grade-utils.sh - -RUNNERS=( - "cargo" - "cargo --release" - "cargo_asan" - "cargo_asan --release" - "cargo_tsan" - "cargo_tsan --release" -) - -# Lints. -run_linters || exit 1 - -# Executes test for each runner. -for RUNNER in "${RUNNERS[@]}"; do - echo "Running with $RUNNER..." - - TESTS=("--lib assignment10") - if [ $(run_tests) -ne 0 ]; then - exit 1 - fi -done - -exit 0 diff --git a/scripts/grade-11.sh b/scripts/grade-11.sh deleted file mode 100755 index 34fb51a..0000000 --- a/scripts/grade-11.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -uo pipefail -IFS=$'\n\t' - -# Imports library. -BASEDIR=$(dirname "$0") -source $BASEDIR/grade-utils.sh - -RUNNERS=( - "cargo" - "cargo --release" - "cargo_asan" - "cargo_asan --release" - "cargo_tsan" - "cargo_tsan --release" -) - -# Lints. -run_linters || exit 1 - -# Executes test for each runner. -for RUNNER in "${RUNNERS[@]}"; do - echo "Running with $RUNNER..." - - TESTS=("--lib assignment11") - if [ $(run_tests) -ne 0 ]; then - exit 1 - fi -done - -exit 0 diff --git a/scripts/grade-12.sh b/scripts/grade-12.sh deleted file mode 100755 index 3c1609e..0000000 --- a/scripts/grade-12.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -uo pipefail -IFS=$'\n\t' - -# Imports library. -BASEDIR=$(dirname "$0") -source $BASEDIR/grade-utils.sh - -RUNNERS=( - "cargo" - "cargo --release" - "cargo_asan" - "cargo_asan --release" - "cargo_tsan" - "cargo_tsan --release" -) - -# Lints. -run_linters || exit 1 - -# Executes test for each runner. -for RUNNER in "${RUNNERS[@]}"; do - echo "Running with $RUNNER..." - - TESTS=("--lib assignment12") - if [ $(run_tests) -ne 0 ]; then - exit 1 - fi -done - -exit 0 diff --git a/scripts/grade-13.sh b/scripts/grade-13.sh deleted file mode 100755 index c490775..0000000 --- a/scripts/grade-13.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -uo pipefail -IFS=$'\n\t' - -# Imports library. -BASEDIR=$(dirname "$0") -source $BASEDIR/grade-utils.sh - -RUNNERS=( - "cargo" - "cargo --release" - "cargo_asan" - "cargo_asan --release" - "cargo_tsan" - "cargo_tsan --release" -) - -# Lints. -run_linters || exit 1 - -# Executes test for each runner. -for RUNNER in "${RUNNERS[@]}"; do - echo "Running with $RUNNER..." - - TESTS=("--lib assignment13") - if [ $(run_tests) -ne 0 ]; then - exit 1 - fi -done - -exit 0 diff --git a/scripts/grade-utils.sh b/scripts/grade-utils.sh index 8244ee5..5ac48fa 100755 --- a/scripts/grade-utils.sh +++ b/scripts/grade-utils.sh @@ -76,17 +76,19 @@ _run_tests_with() { exit 1 fi - local FAILED=0 - for TEST in "${TESTS[@]}"; do - local TEST_CMD="$CARGO test $* $TEST" - timeout ${TIMEOUT:-20s} bash -c "$TEST_CMD 2>/dev/null" 1>&2 + local PASSED=0 + # local NUM_TESTS=$(echo $TESTS | wc -w) + for TEST in ${TESTS[@]}; do + local TEST_CMD="$CARGO test $* --lib -- $TEST" + timeout ${TIMEOUT:-20s} bash -c "$TEST_CMD 2> /dev/null" 1>&2 case $? in - 0) ;; - 124) echo_err "Test timed out: $TEST_CMD"; FAILED=$((FAILED + 1));; - *) echo_err "Test failed: $TEST_CMD"; FAILED=$((FAILED + 1));; + 0) PASSED=$((PASSED + 1));; + 124) echo_err "Test timed out: $TEST_CMD";; + *) echo_err "Test failed: $TEST_CMD";; esac done - echo $FAILED + + echo $PASSED } # example: run_tests diff --git a/scripts/grade.sh b/scripts/grade.sh new file mode 100755 index 0000000..eacee07 --- /dev/null +++ b/scripts/grade.sh @@ -0,0 +1,105 @@ +#!/usr/bin/env bash + +set -e +set -uo pipefail +IFS=$'\n\t' + +# Imports library. +BASEDIR=$(dirname "$0") +source $BASEDIR/grade-utils.sh + +RUNNER="cargo" + +# Lints. +run_linters || exit 1 + +# Executes test for each runner. +echo "Running with $RUNNER..." + +TEST_NAME=$(printf "TEST%02d" $1) +case $TEST_NAME in + TEST01) + TESTS=( + "assignments::assignment01::small_exercises_grade::test" + ) + ;; + TEST02) + TESTS=( + "assignments::assignment02::small_exercises_grade::test" + "assignments::assignment02::vec_and_mat_grade::test" + ) + ;; + TEST03) + TESTS=( + "assignments::assignment03::custom_operators_grade::test" + "assignments::assignment03::parse_shell_grade::test" + "assignments::assignment03::small_exercises_grade::test" + ) + ;; + TEST04) + TESTS=( + "assignments::assignment04::grade::test" + ) + ;; + TEST06) + TESTS=( + "assignments::assignment06::semiring_grade::test" + "assignments::assignment06::symbolic_differentiation_grade::test" + ) + ;; + TEST07) + TESTS=( + "assignments::assignment07::generator_grade::test" + "assignments::assignment07::my_itertools_grade::test" + "assignments::assignment07::small_exercises_grade::test" + "assignments::assignment07::transform_grade::test" + ) + ;; + TEST08) + TESTS=( + "assignments::assignment08::church_grade::test" + "assignments::assignment08::small_exercises_grade::test" + ) + ;; + TEST09) + TESTS=( + "assignments::assignment09::bigint_grade::test" + "assignments::assignment09::small_exercises_grade::test" + ) + ;; + TEST10) + TESTS=( + "assignments::assignment10::labyrinth_grade::test" + "assignments::assignment10::small_exercises_grade::test" + ) + ;; + TEST11) + TESTS=( + "assignments::assignment11::graph_grade::test_graph" + "assignments::assignment11::linked_list_grade::test_linked_list" + "assignments::assignment11::mock_storage_grade::test_mock_storage" + "assignments::assignment11::tv_room_grade::test_tv_room" + ) + ;; + TEST12) + TESTS=( + "assignments::assignment12::card_grade" + "assignments::assignment12::demux_grade::test_demux" + "assignments::assignment12::funnel_grade::test_funnel" + "assignments::assignment12::small_exercises_grade::test_pingpong" + ) + ;; + TEST13) + TESTS=( + "assignments::assignment13::small_exercises_grade::test" + ) + ;; + *) + echo_err "Invalid test name: $TEST_NAME" + exit 1 + ;; +esac + +# Runs tests. +SCORE=$(run_tests) +echo Your score: $SCORE diff --git a/src/assignments/assignment01/mod.rs b/src/assignments/assignment01/mod.rs index dfcc07f..6db0c9c 100644 --- a/src/assignments/assignment01/mod.rs +++ b/src/assignments/assignment01/mod.rs @@ -3,8 +3,8 @@ //! The primary goal of this assignment is bringing up SSH, VSCode, and all the other necessary tools to develop Rust programs. //! Please make sure you're comfortable with developing Rust programs before moving on to the next assignments. //! -//! You should fill out the `todo!()` placeholders in such a way that `/scripts/grade-01.sh` works fine. -//! See `assigment01/small_exercises_grade.rs` and `/scripts/grade-01.sh` for the test script. +//! You should fill out the `todo!()` placeholders in such a way that `/scripts/grade.sh 1` works fine. +//! See `assigment01/small_exercises_grade.rs` and `/scripts/grade.sh 1` for the test script. pub mod small_exercises; mod small_exercises_grade; diff --git a/src/assignments/assignment01/small_exercises.rs b/src/assignments/assignment01/small_exercises.rs index a85884d..eaa5358 100644 --- a/src/assignments/assignment01/small_exercises.rs +++ b/src/assignments/assignment01/small_exercises.rs @@ -1,8 +1,8 @@ //! Assignment 1: Preparing Rust Development Environment. //! Welcome to the CS220 course! //! -//! You should fill out `add()` and `sub()` function bodies in such a way that `/scripts/grade-01.sh` works fine. -//! See `small_problems_grade.rs` and `/scripts/grade-01.sh` for the test script. +//! You should fill out `add()` and `sub()` function bodies in such a way that `/scripts/grade.sh 1` works fine. +//! See `small_problems_grade.rs` and `/scripts/grade.sh 1` for the test script. //! //! Hint: diff --git a/src/assignments/assignment02/mod.rs b/src/assignments/assignment02/mod.rs index 282c04c..cceadfd 100644 --- a/src/assignments/assignment02/mod.rs +++ b/src/assignments/assignment02/mod.rs @@ -3,8 +3,8 @@ //! The primary goal of this assignment is to re-learn the common programming concepts in Rust, especially those in the Rust Book chapters 3 and 5. //! Please make sure you're comfortable with the concepts to proceed on to the next assignments. //! -//! You should fill out the `todo!()` placeholders in such a way that `/scripts/grade-02.sh` works fine. -//! See `assigment02/*_grade.rs` and `/scripts/grade-02.sh` for the test script. +//! You should fill out the `todo!()` placeholders in such a way that `/scripts/grade.sh 2` works fine. +//! See `assigment02/*_grade.rs` and `/scripts/grade.sh 2` for the test script. pub mod small_exercises; mod small_exercises_grade; diff --git a/src/assignments/assignment03/mod.rs b/src/assignments/assignment03/mod.rs index 1c950e0..59b0201 100644 --- a/src/assignments/assignment03/mod.rs +++ b/src/assignments/assignment03/mod.rs @@ -1,7 +1,7 @@ //! Assignment 3: Mastering common programming concepts (2/2) //! -//! You should fill out the `todo!()` placeholders in such a way that `/scripts/grade-03.sh` works fine. -//! See `assignment03/*_grade.rs` and `/scripts/grade-03.sh` for the test script. +//! You should fill out the `todo!()` placeholders in such a way that `/scripts/grade.sh 3` works fine. +//! See `assignment03/*_grade.rs` and `/scripts/grade.sh 3` for the test script. pub mod small_exercises; mod small_exercises_grade; diff --git a/src/assignments/assignment04/mod.rs b/src/assignments/assignment04/mod.rs index ceb0a8c..29a218e 100644 --- a/src/assignments/assignment04/mod.rs +++ b/src/assignments/assignment04/mod.rs @@ -11,8 +11,8 @@ //! //! For calculator, just reading `syntax.rs` would suffice for you to understand what to do. //! -//! You should fill out the `todo!()` placeholders in such a way that `/scripts/grade-04.sh` works fine. -//! See `assignment04/grade.rs` and `/scripts/grade-04.sh` for the test script. +//! You should fill out the `todo!()` placeholders in such a way that `/scripts/grade.sh 4` works fine. +//! See `assignment04/grade.rs` and `/scripts/grade.sh 4` for the test script. //! Run `/scripts/prepare-submissions.sh` and submit `/target/assignment04.zip` to . pub mod context; diff --git a/src/assignments/assignment06/mod.rs b/src/assignments/assignment06/mod.rs index 8727bc1..fc94881 100644 --- a/src/assignments/assignment06/mod.rs +++ b/src/assignments/assignment06/mod.rs @@ -2,8 +2,8 @@ //! //! The primary goal of this assignment is to understand generics, traits, and lifetimes. //! -//! You should fill out the `todo!()` placeholders in such a way that `/scripts/grade-06.sh` works fine. -//! See `assignment06/*_grade.rs` and `/scripts/grade-06.sh` for the test script. +//! You should fill out the `todo!()` placeholders in such a way that `/scripts/grade.sh 6` works fine. +//! See `assignment06/*_grade.rs` and `/scripts/grade.sh 6` for the test script. pub mod semiring; pub mod symbolic_differentiation; diff --git a/src/assignments/assignment07/mod.rs b/src/assignments/assignment07/mod.rs index 0dbfcd7..9cde5ba 100644 --- a/src/assignments/assignment07/mod.rs +++ b/src/assignments/assignment07/mod.rs @@ -2,8 +2,8 @@ //! //! The primary goal of this assignment is to understand generics, traits, and lifetimes. //! -//! You should fill out the `todo!()` placeholders in such a way that `/scripts/grade-07.sh` works fine. -//! See `assignment07/*_grade.rs` and `/scripts/grade-07.sh` for the test script. +//! You should fill out the `todo!()` placeholders in such a way that `/scripts/grade.sh 7` works fine. +//! See `assignment07/*_grade.rs` and `/scripts/grade.sh 7` for the test script. pub mod generator; pub mod my_itertools; diff --git a/src/assignments/assignment08/mod.rs b/src/assignments/assignment08/mod.rs index 4125a1a..e784788 100644 --- a/src/assignments/assignment08/mod.rs +++ b/src/assignments/assignment08/mod.rs @@ -2,8 +2,8 @@ //! //! The primary goal of this assignment is to get used to first-class functions. //! -//! You should fill out the `todo!()` placeholders in such a way that `/scripts/grade-08.sh` works fine. -//! See `assignment08/*_grade.rs` and `/scripts/grade-08.sh` for the test script. +//! You should fill out the `todo!()` placeholders in such a way that `/scripts/grade.sh 8` works fine. +//! See `assignment08/*_grade.rs` and `/scripts/grade.sh 8` for the test script. pub mod church; pub mod small_exercises; diff --git a/src/assignments/assignment09/mod.rs b/src/assignments/assignment09/mod.rs index 9fa8940..68c8e61 100644 --- a/src/assignments/assignment09/mod.rs +++ b/src/assignments/assignment09/mod.rs @@ -2,8 +2,8 @@ //! //! The primary goal of this assignment is to get used to iterators. //! -//! You should fill out the `todo!()` placeholders in such a way that `/scripts/grade-09.sh` works fine. -//! See `assignment09/*_grade.rs` and `/scripts/grade-09.sh` for the test script. +//! You should fill out the `todo!()` placeholders in such a way that `/scripts/grade.sh 9` works fine. +//! See `assignment09/*_grade.rs` and `/scripts/grade.sh 9` for the test script. pub mod bigint; pub mod matmul; diff --git a/src/assignments/assignment10/mod.rs b/src/assignments/assignment10/mod.rs index 7fc988f..18073b0 100644 --- a/src/assignments/assignment10/mod.rs +++ b/src/assignments/assignment10/mod.rs @@ -1,8 +1,8 @@ //! Assignment 10: Iterators (2/2). //! The primary goal of this assignment is to get used to iterators. //! -//! You should fill out the `todo!()` placeholders in such a way that `/scripts/grade-10.sh` works fine. -//! See `assignment10/*_grade.rs` and `/scripts/grade-10.sh` for the test script. +//! You should fill out the `todo!()` placeholders in such a way that `/scripts/grade.sh 10` works fine. +//! See `assignment10/*_grade.rs` and `/scripts/grade.sh 10` for the test script. pub mod labyrinth; pub mod small_exercises; diff --git a/src/assignments/assignment11/mod.rs b/src/assignments/assignment11/mod.rs index 1802da6..32bc143 100644 --- a/src/assignments/assignment11/mod.rs +++ b/src/assignments/assignment11/mod.rs @@ -1,7 +1,7 @@ //! Assignment 11: Familiarizing with smart pointers. //! -//! You should fill out `todo!()` placeholders in such a way that `/scripts/grade-11.sh` works fine. -//! See `assignment11/*_grade.rs` and `/scripts/grade-11.sh` for the test script. +//! You should fill out `todo!()` placeholders in such a way that `/scripts/grade.sh 11` works fine. +//! See `assignment11/*_grade.rs` and `/scripts/grade.sh 11` for the test script. //! Run `/scripts/prepare-submissions.sh` and submit `/target/assignment11.zip` to . pub mod graph; diff --git a/src/assignments/assignment12/mod.rs b/src/assignments/assignment12/mod.rs index 3dd2a96..3fad125 100644 --- a/src/assignments/assignment12/mod.rs +++ b/src/assignments/assignment12/mod.rs @@ -2,8 +2,8 @@ //! //! The primary goal of this assignment is to get used to concurrency. //! -//! You should fill out the `todo!()` placeholders in such a way that `/scripts/grade-12.sh` works fine. -//! See `assignment12/*_grade.rs` and `/scripts/grade-12.sh` for the test script. +//! You should fill out the `todo!()` placeholders in such a way that `/scripts/grade.sh 12` works fine. +//! See `assignment12/*_grade.rs` and `/scripts/grade.sh 12` for the test script. pub mod card; pub mod demux; diff --git a/src/assignments/assignment13/mod.rs b/src/assignments/assignment13/mod.rs index 3ea15d4..67fe8d0 100644 --- a/src/assignments/assignment13/mod.rs +++ b/src/assignments/assignment13/mod.rs @@ -3,8 +3,8 @@ //! The primary goal of this assignment is to get used to data parallelism. //! //! Refer to your solution for assignment 09. You will implement the parallelized version of assignment 09. -//! You should fill out the `todo!()` placeholders in such a way that `/scripts/grade-13.sh` works fine. -//! See `assignment13/small_exercises_grade.rs` and `/scripts/grade-13.sh` for the test script. +//! You should fill out the `todo!()` placeholders in such a way that `/scripts/grade.sh 13` works fine. +//! See `assignment13/small_exercises_grade.rs` and `/scripts/grade.sh 13` for the test script. pub mod small_exercises; mod small_exercises_grade; From 5d685bc8dec4d63706cf7c9378e7d4268a74bd36 Mon Sep 17 00:00:00 2001 From: "jungin.rhee" Date: Sat, 26 Aug 2023 09:59:28 +0000 Subject: [PATCH 05/17] cargo doc --- src/assignments/assignment06/symbolic_differentiation.rs | 2 +- src/assignments/assignment09/bigint.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/assignments/assignment06/symbolic_differentiation.rs b/src/assignments/assignment06/symbolic_differentiation.rs index 2269d13..f46c5fc 100644 --- a/src/assignments/assignment06/symbolic_differentiation.rs +++ b/src/assignments/assignment06/symbolic_differentiation.rs @@ -6,7 +6,7 @@ use std::ops::*; /// Rational number represented by two isize, numerator and denominator. /// /// Each Rational number should be normalized so that `demoninator` is nonnegative and `numerator` and `demoninator` are coprime. -/// See [`normalize`] for examples. As a corner case, 0 is represented by Rational { numerator: 0, demoninator: 0 }. +/// See `normalize` for examples. As a corner case, 0 is represented by Rational { numerator: 0, demoninator: 0 }. /// /// For "natural use", Rational also overloads standard arithmetic operations, i.e, `+`, `-`, `*`, `/`. /// diff --git a/src/assignments/assignment09/bigint.rs b/src/assignments/assignment09/bigint.rs index 33a96e5..b1a1f51 100644 --- a/src/assignments/assignment09/bigint.rs +++ b/src/assignments/assignment09/bigint.rs @@ -11,7 +11,7 @@ use std::{iter::zip, ops::*}; /// For example, the vector `vec![44,345,3]` represents the integer /// `44 * (2^32)^2 + 345 * (2^32) + 3`, /// and the vector `vec![u32::MAX - 5, u32::MAX - 7]` represents the integer -/// `- (5 * 2^32 + 8) +/// `- (5 * 2^32 + 8)` /// /// You will implement the `Add` and `Sub` trait for this type. /// From 15b8c714dc2df108638e52a3cde7bdff5d3103ce Mon Sep 17 00:00:00 2001 From: woojin Date: Sun, 27 Aug 2023 09:39:31 +0900 Subject: [PATCH 06/17] mmodify readme, check arguments --- README.md | 12 ++++++++++++ scripts/grade.sh | 11 ++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 917cea3..0a28e14 100644 --- a/README.md +++ b/README.md @@ -138,6 +138,18 @@ Make sure that you're capable of using the following development tools: - We'll announce **all** assignments before the semester begins. - Submit your solution to . - Read the documentation at . +- We provide grading scripts for each assignment. Before submission, you can check your grade with your machine. + - Grading scripts are located at `scripts/` directory. + - You can run the grading script with the following command: + ```bash + $ `scripts/grade.sh ` + ``` + - For example, + - If you want to grade `assignment9`, run the following command: + ```bash + $ cd scripts + $ ./grade.sh 9 + ``` - You're **allowed** to use ChatGPT or other LLMs. Instead, you'll solve more problems than previous semesters. diff --git a/scripts/grade.sh b/scripts/grade.sh index eacee07..e0d8be5 100755 --- a/scripts/grade.sh +++ b/scripts/grade.sh @@ -16,6 +16,14 @@ run_linters || exit 1 # Executes test for each runner. echo "Running with $RUNNER..." +if [ $# != 1 ] + then + echo "===============================" + echo "Invalid number. $# arguments given." + echo "Usage: ./grade.sh " + echo "Example: ./grade.sh 1" + exit 1 +fi TEST_NAME=$(printf "TEST%02d" $1) case $TEST_NAME in TEST01) @@ -102,4 +110,5 @@ esac # Runs tests. SCORE=$(run_tests) -echo Your score: $SCORE +NUM_TESTS=${#TESTS[@]} +echo Your score: ${SCORE}/${NUM_TESTS} From b70b423aba99e953475d4933c8894bfb6e42d7ab Mon Sep 17 00:00:00 2001 From: AnHaechan Date: Sun, 27 Aug 2023 05:52:51 +0000 Subject: [PATCH 07/17] grading script small fix --- README.md | 11 ++++------- scripts/grade.sh | 9 +++++---- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 0a28e14..60ac907 100644 --- a/README.md +++ b/README.md @@ -138,17 +138,14 @@ Make sure that you're capable of using the following development tools: - We'll announce **all** assignments before the semester begins. - Submit your solution to . - Read the documentation at . -- We provide grading scripts for each assignment. Before submission, you can check your grade with your machine. - - Grading scripts are located at `scripts/` directory. +- You can check your grade of each assignment by running the grading script. - You can run the grading script with the following command: ```bash - $ `scripts/grade.sh ` + $ ./scripts/grade.sh ``` - - For example, - - If you want to grade `assignment9`, run the following command: + - E.g. To grade `assignment09`, run the following command: ```bash - $ cd scripts - $ ./grade.sh 9 + $ ./scripts/grade.sh 9 ``` - You're **allowed** to use ChatGPT or other LLMs. Instead, you'll solve more problems than previous semesters. diff --git a/scripts/grade.sh b/scripts/grade.sh index e0d8be5..6ef01ba 100755 --- a/scripts/grade.sh +++ b/scripts/grade.sh @@ -19,9 +19,9 @@ echo "Running with $RUNNER..." if [ $# != 1 ] then echo "===============================" - echo "Invalid number. $# arguments given." - echo "Usage: ./grade.sh " - echo "Example: ./grade.sh 1" + echo "Invalid argument." + echo "Usage: './grade.sh '" + echo "Example: './grade.sh 1' to grade assignment01" exit 1 fi TEST_NAME=$(printf "TEST%02d" $1) @@ -103,7 +103,8 @@ case $TEST_NAME in ) ;; *) - echo_err "Invalid test name: $TEST_NAME" + echo_err "Invalid assignment number: $1" + echo_err "Assignment number should be within 1 to 12." exit 1 ;; esac From be591903775f510bb18375849c2697bbe6e7975d Mon Sep 17 00:00:00 2001 From: "woojin.lee" Date: Mon, 28 Aug 2023 15:28:52 +0900 Subject: [PATCH 08/17] add assignment template --- .../ISSUE_TEMPLATE/assignment_question.yml | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/assignment_question.yml diff --git a/.github/ISSUE_TEMPLATE/assignment_question.yml b/.github/ISSUE_TEMPLATE/assignment_question.yml new file mode 100644 index 0000000..c66846f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/assignment_question.yml @@ -0,0 +1,81 @@ +name: Question about Assignment +description: Ask questions about assignment in this format. +title: '[Assignment #] (SUMMARIZE YOUR QUESTION AS CLEARLY AS POSSIBLE)' +labels: + - question +assignees: + - woojinnn + - jirheee + - AnHaechan +body: + - type: markdown + attributes: + value: | + # Please read the followings before asking a question: + - When you're asking a question, please make sure, + - You clarify your questions as clear as possible. + - If possible, please make it a yes/no question. + - If possible, please summarize your question in one sentence at the beginning of an issue. + - If you're asking a question on concepts, + - You read the corresponding sections of the slide. + - You searched for the concepts using search engines and Wikipedia. + - If you're asking a question on Rust programming, + - You searched for error messages or any relevant logs using search engines. + - Your problem is reproducible in the provided server. Please describe how others can reproduce your problem. + - You paste code, if any, in text with [syntax hightlight](https://docs.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks). No images. + - You paste code, if any, that is minimized as much as possible. Your code should be immediately relevant to your question. + - type: markdown + attributes: + value: | + # 1. Related Issue + - type: input + attributes: + label: >- + Please search to see if a related issue already exists. If so, give me + the links. If there are multiple issues, please write them all. + placeholder: 'https://github.com/kaist-cp/cs220/issues/' + validations: + required: false + - type: markdown + attributes: + value: | + # 2. Interaction with LLM + - type: input + attributes: + label: Shared link that can prove your interaction with a LLM. + description: >- + For instance, if you used ChatGPT, you can upload link like + [this](https://help.openai.com/en/articles/7925741-chatgpt-shared-links-faq). + placeholder: 'https://chat.openai.com/share/' + validations: + required: true + - type: markdown + attributes: + value: | + # 3. Googling + - type: input + attributes: + label: Query + description: What did you serach for? + validations: + required: true + - type: input + attributes: + label: Link + description: Share the link that looks the most relavant to your situation. + placeholder: >- + https://stackoverflow.blog/2020/01/20/what-is-rust-and-why-is-it-so-popular/ + validations: + required: true + - type: markdown + attributes: + value: | + # 4. Your question + - type: textarea + attributes: + label: Your question here + description: 'Also tell us, what did you expect to happen?' + placeholder: YOUR QUESTION HERE + render: markdown + validations: + required: true From b25366fd8eeb854d8c99966aafc6148255079f4b Mon Sep 17 00:00:00 2001 From: "woojin.lee" Date: Mon, 28 Aug 2023 15:48:01 +0900 Subject: [PATCH 09/17] apply comments WIP Polish --- .../ISSUE_TEMPLATE/assignment_question.yml | 38 ++++++++++--------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/assignment_question.yml b/.github/ISSUE_TEMPLATE/assignment_question.yml index c66846f..8eb65fd 100644 --- a/.github/ISSUE_TEMPLATE/assignment_question.yml +++ b/.github/ISSUE_TEMPLATE/assignment_question.yml @@ -30,7 +30,8 @@ body: # 1. Related Issue - type: input attributes: - label: >- + label: Related Issue + description: >- Please search to see if a related issue already exists. If so, give me the links. If there are multiple issues, please write them all. placeholder: 'https://github.com/kaist-cp/cs220/issues/' @@ -39,32 +40,33 @@ body: - type: markdown attributes: value: | - # 2. Interaction with LLM - - type: input + # 2. Googling Result + - type: textarea attributes: - label: Shared link that can prove your interaction with a LLM. + label: Googling Result description: >- - For instance, if you used ChatGPT, you can upload link like - [this](https://help.openai.com/en/articles/7925741-chatgpt-shared-links-faq). - placeholder: 'https://chat.openai.com/share/' + Share the link that looks relavant to your situation. Multiple links are + welcomed. + placeholder: >- + https://stackoverflow.blog/2020/01/20/what-is-rust-and-why-is-it-so-popular/ validations: required: true - type: markdown attributes: value: | - # 3. Googling + # 3. ChatGPT Result - type: input attributes: - label: Query - description: What did you serach for? - validations: - required: true - - type: input - attributes: - label: Link - description: Share the link that looks the most relavant to your situation. - placeholder: >- - https://stackoverflow.blog/2020/01/20/what-is-rust-and-why-is-it-so-popular/ + label: ChatGPT Result + description: >- + Before writing this issue, you should have asked ChatGPT. We want to see + how you used ChatGPT for troubleshooting your problem. You can upload + link like + [this](https://help.openai.com/en/articles/7925741-chatgpt-shared-links-faq). + It should contain the history of, including but not limited to, your + problem statement, the answer from ChatGPT, and your follow-up + questions. There should be at least 3 turns of conversation. + placeholder: 'https://chat.openai.com/share/' validations: required: true - type: markdown From 2b19548cb06ba7c78e823383b38f5ce1f14979ec Mon Sep 17 00:00:00 2001 From: woojin Date: Mon, 28 Aug 2023 16:43:22 +0900 Subject: [PATCH 10/17] edit submit.sh file --- README.md | 17 +++++++++++++---- scripts/prepare-submissions.sh | 10 ---------- scripts/submit.sh | 22 ++++++++++++++++++++++ 3 files changed, 35 insertions(+), 14 deletions(-) delete mode 100755 scripts/prepare-submissions.sh create mode 100755 scripts/submit.sh diff --git a/README.md b/README.md index 60ac907..53371fd 100644 --- a/README.md +++ b/README.md @@ -137,16 +137,25 @@ Make sure that you're capable of using the following development tools: - We'll announce **all** assignments before the semester begins. - Submit your solution to . +- **How to submit your assignment:** + - To submit your solution, you should run `submit.sh` in `scripts` directory. In other words, you should run the following command: + ```bash + # Run this command at the root directory of this repository. + $ ./scripts/submit.sh + + # E.g. To submit `assignment09`, run the following command: + $ ./scripts/submit.sh 9 + ``` + - After running the command above, in the `target` directory, you can find a `assignment.zip` file (`assignment09.zip` for example). Submit this file to . - Read the documentation at . - You can check your grade of each assignment by running the grading script. - You can run the grading script with the following command: ```bash $ ./scripts/grade.sh + + # E.g. To grade `assignment09`, run the following command: + $ ./scripts/grade.sh 9 ``` - - E.g. To grade `assignment09`, run the following command: - ```bash - $ ./scripts/grade.sh 9 - ``` - You're **allowed** to use ChatGPT or other LLMs. Instead, you'll solve more problems than previous semesters. diff --git a/scripts/prepare-submissions.sh b/scripts/prepare-submissions.sh deleted file mode 100755 index 35ee7ac..0000000 --- a/scripts/prepare-submissions.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -set -e - -BASEDIR=$(dirname "$0")/.. - -mkdir -p $BASEDIR/target - -zip -rj $BASEDIR/target/assignment04.zip src/assignments/assignment04 -zip -rj $BASEDIR/target/assignment11.zip src/assignments/assignment11 diff --git a/scripts/submit.sh b/scripts/submit.sh new file mode 100755 index 0000000..4dc272c --- /dev/null +++ b/scripts/submit.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +set -e + +if [ $# != 1 ] + then + echo "===============================" + echo "Invalid argument." + echo "Usage: './submit.sh '" + echo "Example: './submit.sh 1' to grade assignment01" + exit 1 +fi + +BASEDIR=$(dirname "$0")/.. +mkdir -p $BASEDIR/target + +ZIP_FILE=$(printf "$BASEDIR/target/assignment%02d.zip" $1) +SRC_PATH=$(printf "$BASEDIR/src/assignments/assignment%02d" $1) + +echo $ZIP_FILE +echo $SRC_PATH +zip -rj $ZIP_FILE $SRC_PATH From ae4556d0875a7d5c0682ffd75f481a1327813337 Mon Sep 17 00:00:00 2001 From: woojin Date: Mon, 28 Aug 2023 17:03:23 +0900 Subject: [PATCH 11/17] modify submission file --- README.md | 11 ++++------- scripts/submit.sh | 26 +++++++++++--------------- src/assignments/assignment01/mod.rs | 7 +++++++ src/assignments/assignment02/mod.rs | 7 +++++++ src/assignments/assignment03/mod.rs | 7 +++++++ src/assignments/assignment04/mod.rs | 7 +++++++ src/assignments/assignment06/mod.rs | 7 +++++++ src/assignments/assignment07/mod.rs | 7 +++++++ src/assignments/assignment08/mod.rs | 7 +++++++ src/assignments/assignment09/mod.rs | 7 +++++++ src/assignments/assignment10/mod.rs | 7 +++++++ src/assignments/assignment11/mod.rs | 7 +++++++ src/assignments/assignment12/mod.rs | 7 +++++++ src/assignments/assignment13/mod.rs | 7 +++++++ 14 files changed, 99 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 53371fd..e0f9601 100644 --- a/README.md +++ b/README.md @@ -139,13 +139,10 @@ Make sure that you're capable of using the following development tools: - Submit your solution to . - **How to submit your assignment:** - To submit your solution, you should run `submit.sh` in `scripts` directory. In other words, you should run the following command: - ```bash - # Run this command at the root directory of this repository. - $ ./scripts/submit.sh - - # E.g. To submit `assignment09`, run the following command: - $ ./scripts/submit.sh 9 - ``` + ```bash + # Run this command at the root directory of this repository. + $ ./scripts/submit.sh + ``` - After running the command above, in the `target` directory, you can find a `assignment.zip` file (`assignment09.zip` for example). Submit this file to . - Read the documentation at . - You can check your grade of each assignment by running the grading script. diff --git a/scripts/submit.sh b/scripts/submit.sh index 4dc272c..b7c7b49 100755 --- a/scripts/submit.sh +++ b/scripts/submit.sh @@ -2,21 +2,17 @@ set -e -if [ $# != 1 ] - then - echo "===============================" - echo "Invalid argument." - echo "Usage: './submit.sh '" - echo "Example: './submit.sh 1' to grade assignment01" - exit 1 -fi - BASEDIR=$(dirname "$0")/.. + mkdir -p $BASEDIR/target -ZIP_FILE=$(printf "$BASEDIR/target/assignment%02d.zip" $1) -SRC_PATH=$(printf "$BASEDIR/src/assignments/assignment%02d" $1) - -echo $ZIP_FILE -echo $SRC_PATH -zip -rj $ZIP_FILE $SRC_PATH +for i in {01..13} ; do + if [ $i -eq 5 ] + then + continue + fi + if [ -f $BASEDIR/target/assignment$i.zip ]; then + rm $BASEDIR/target/assignment$i.zip + fi + zip -rj $BASEDIR/target/assignment$i.zip $BASEDIR/src/assignments/assignment$i +done diff --git a/src/assignments/assignment01/mod.rs b/src/assignments/assignment01/mod.rs index 6db0c9c..034f208 100644 --- a/src/assignments/assignment01/mod.rs +++ b/src/assignments/assignment01/mod.rs @@ -5,6 +5,13 @@ //! //! You should fill out the `todo!()` placeholders in such a way that `/scripts/grade.sh 1` works fine. //! See `assigment01/small_exercises_grade.rs` and `/scripts/grade.sh 1` for the test script. +//! +//! To submit, run +//! ```bash +//! # At the cs220 home directory, +//! ./scripts/submit.sh +//! ``` +//! and submit the generated `assignment01.zip` file in `target` directory. pub mod small_exercises; mod small_exercises_grade; diff --git a/src/assignments/assignment02/mod.rs b/src/assignments/assignment02/mod.rs index cceadfd..df4deb5 100644 --- a/src/assignments/assignment02/mod.rs +++ b/src/assignments/assignment02/mod.rs @@ -5,6 +5,13 @@ //! //! You should fill out the `todo!()` placeholders in such a way that `/scripts/grade.sh 2` works fine. //! See `assigment02/*_grade.rs` and `/scripts/grade.sh 2` for the test script. +//! +//! To submit, run +//! ```bash +//! # At the cs220 home directory, +//! ./scripts/submit.sh +//! ``` +//! and submit the generated `assignment02.zip` file in `target` directory. pub mod small_exercises; mod small_exercises_grade; diff --git a/src/assignments/assignment03/mod.rs b/src/assignments/assignment03/mod.rs index 59b0201..8128e3e 100644 --- a/src/assignments/assignment03/mod.rs +++ b/src/assignments/assignment03/mod.rs @@ -2,6 +2,13 @@ //! //! You should fill out the `todo!()` placeholders in such a way that `/scripts/grade.sh 3` works fine. //! See `assignment03/*_grade.rs` and `/scripts/grade.sh 3` for the test script. +//! +//! To submit, run +//! ```bash +//! # At the cs220 home directory, +//! ./scripts/submit.sh +//! ``` +//! and submit the generated `assignment03.zip` file in `target` directory. pub mod small_exercises; mod small_exercises_grade; diff --git a/src/assignments/assignment04/mod.rs b/src/assignments/assignment04/mod.rs index 29a218e..a1857d2 100644 --- a/src/assignments/assignment04/mod.rs +++ b/src/assignments/assignment04/mod.rs @@ -14,6 +14,13 @@ //! You should fill out the `todo!()` placeholders in such a way that `/scripts/grade.sh 4` works fine. //! See `assignment04/grade.rs` and `/scripts/grade.sh 4` for the test script. //! Run `/scripts/prepare-submissions.sh` and submit `/target/assignment04.zip` to . +//! +//! To submit, run +//! ```bash +//! # At the cs220 home directory, +//! ./scripts/submit.sh +//! ``` +//! and submit the generated `assignment04.zip` file in `target` directory. pub mod context; mod grade; diff --git a/src/assignments/assignment06/mod.rs b/src/assignments/assignment06/mod.rs index fc94881..9d1f959 100644 --- a/src/assignments/assignment06/mod.rs +++ b/src/assignments/assignment06/mod.rs @@ -4,6 +4,13 @@ //! //! You should fill out the `todo!()` placeholders in such a way that `/scripts/grade.sh 6` works fine. //! See `assignment06/*_grade.rs` and `/scripts/grade.sh 6` for the test script. +//! +//! To submit, run +//! ```bash +//! # At the cs220 home directory, +//! ./scripts/submit.sh +//! ``` +//! and submit the generated `assignment06.zip` file in `target` directory. pub mod semiring; pub mod symbolic_differentiation; diff --git a/src/assignments/assignment07/mod.rs b/src/assignments/assignment07/mod.rs index 9cde5ba..19f264e 100644 --- a/src/assignments/assignment07/mod.rs +++ b/src/assignments/assignment07/mod.rs @@ -4,6 +4,13 @@ //! //! You should fill out the `todo!()` placeholders in such a way that `/scripts/grade.sh 7` works fine. //! See `assignment07/*_grade.rs` and `/scripts/grade.sh 7` for the test script. +//! +//! To submit, run +//! ```bash +//! # At the cs220 home directory, +//! ./scripts/submit.sh +//! ``` +//! and submit the generated `assignment07.zip` file in `target` directory. pub mod generator; pub mod my_itertools; diff --git a/src/assignments/assignment08/mod.rs b/src/assignments/assignment08/mod.rs index e784788..909844f 100644 --- a/src/assignments/assignment08/mod.rs +++ b/src/assignments/assignment08/mod.rs @@ -4,6 +4,13 @@ //! //! You should fill out the `todo!()` placeholders in such a way that `/scripts/grade.sh 8` works fine. //! See `assignment08/*_grade.rs` and `/scripts/grade.sh 8` for the test script. +//! +//! To submit, run +//! ```bash +//! # At the cs220 home directory, +//! ./scripts/submit.sh +//! ``` +//! and submit the generated `assignment08.zip` file in `target` directory. pub mod church; pub mod small_exercises; diff --git a/src/assignments/assignment09/mod.rs b/src/assignments/assignment09/mod.rs index 68c8e61..a805834 100644 --- a/src/assignments/assignment09/mod.rs +++ b/src/assignments/assignment09/mod.rs @@ -4,6 +4,13 @@ //! //! You should fill out the `todo!()` placeholders in such a way that `/scripts/grade.sh 9` works fine. //! See `assignment09/*_grade.rs` and `/scripts/grade.sh 9` for the test script. +//! +//! To submit, run +//! ```bash +//! # At the cs220 home directory, +//! ./scripts/submit.sh +//! ``` +//! and submit the generated `assignment09.zip` file in `target` directory. pub mod bigint; pub mod matmul; diff --git a/src/assignments/assignment10/mod.rs b/src/assignments/assignment10/mod.rs index 18073b0..c7bc775 100644 --- a/src/assignments/assignment10/mod.rs +++ b/src/assignments/assignment10/mod.rs @@ -3,6 +3,13 @@ //! //! You should fill out the `todo!()` placeholders in such a way that `/scripts/grade.sh 10` works fine. //! See `assignment10/*_grade.rs` and `/scripts/grade.sh 10` for the test script. +//! +//! To submit, run +//! ```bash +//! # At the cs220 home directory, +//! ./scripts/submit.sh +//! ``` +//! and submit the generated `assignment10.zip` file in `target` directory. pub mod labyrinth; pub mod small_exercises; diff --git a/src/assignments/assignment11/mod.rs b/src/assignments/assignment11/mod.rs index 32bc143..5976ef6 100644 --- a/src/assignments/assignment11/mod.rs +++ b/src/assignments/assignment11/mod.rs @@ -3,6 +3,13 @@ //! You should fill out `todo!()` placeholders in such a way that `/scripts/grade.sh 11` works fine. //! See `assignment11/*_grade.rs` and `/scripts/grade.sh 11` for the test script. //! Run `/scripts/prepare-submissions.sh` and submit `/target/assignment11.zip` to . +//! +//! To submit, run +//! ```bash +//! # At the cs220 home directory, +//! ./scripts/submit.sh +//! ``` +//! and submit the generated `assignment11.zip` file in `target` directory. pub mod graph; pub mod linked_list; diff --git a/src/assignments/assignment12/mod.rs b/src/assignments/assignment12/mod.rs index 3fad125..0c623e0 100644 --- a/src/assignments/assignment12/mod.rs +++ b/src/assignments/assignment12/mod.rs @@ -4,6 +4,13 @@ //! //! You should fill out the `todo!()` placeholders in such a way that `/scripts/grade.sh 12` works fine. //! See `assignment12/*_grade.rs` and `/scripts/grade.sh 12` for the test script. +//! +//! To submit, run +//! ```bash +//! # At the cs220 home directory, +//! ./scripts/submit.sh +//! ``` +//! and submit the generated `assignment12.zip` file in `target` directory. pub mod card; pub mod demux; diff --git a/src/assignments/assignment13/mod.rs b/src/assignments/assignment13/mod.rs index 67fe8d0..e0eac42 100644 --- a/src/assignments/assignment13/mod.rs +++ b/src/assignments/assignment13/mod.rs @@ -5,6 +5,13 @@ //! Refer to your solution for assignment 09. You will implement the parallelized version of assignment 09. //! You should fill out the `todo!()` placeholders in such a way that `/scripts/grade.sh 13` works fine. //! See `assignment13/small_exercises_grade.rs` and `/scripts/grade.sh 13` for the test script. +//! +//! To submit, run +//! ```bash +//! # At the cs220 home directory, +//! ./scripts/submit.sh +//! ``` +//! and submit the generated `assignment13.zip` file in `target` directory. pub mod small_exercises; mod small_exercises_grade; From 1e079091754752141146b2ea1ffb5242ff69e1db Mon Sep 17 00:00:00 2001 From: AnHaechan Date: Tue, 29 Aug 2023 02:43:16 +0000 Subject: [PATCH 12/17] submission script for why3 assignment --- scripts/submit.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/submit.sh b/scripts/submit.sh index b7c7b49..4a50fb1 100755 --- a/scripts/submit.sh +++ b/scripts/submit.sh @@ -9,6 +9,10 @@ mkdir -p $BASEDIR/target for i in {01..13} ; do if [ $i -eq 5 ] then + if [ -f $BASEDIR/target/assignment05.zip ]; then + rm $BASEDIR/target/assignment05.zip + fi + zip -rj $BASEDIR/target/assignment05.zip $BASEDIR/assets/why3/assignment05 continue fi if [ -f $BASEDIR/target/assignment$i.zip ]; then From be4fc57edbe7526d35513572a95027deeba311cb Mon Sep 17 00:00:00 2001 From: AnHaechan Date: Tue, 29 Aug 2023 05:28:35 +0000 Subject: [PATCH 13/17] why3 assignment: readme --- assets/why3/assignment05/README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 assets/why3/assignment05/README.md diff --git a/assets/why3/assignment05/README.md b/assets/why3/assignment05/README.md new file mode 100644 index 0000000..245b94f --- /dev/null +++ b/assets/why3/assignment05/README.md @@ -0,0 +1,15 @@ +# Assignment 5: Program correctness and logic + +* The primary goal of this assignment is to grasp basic concepts about proving a program's correctness with deductive reasoning. + +* You should fill in `TODO`s in three files: `max.mlw`, `binary_search.mlw`, `pascal.mlw`. + +* You may use [Why3 in your browser](https://why3.lri.fr/try/). + * Clicking `Verify` button at the top will open a panel on the right side. + * For each task in the panel (e.g. `loop invariant preservation`), you can right-click it and run the prover. + * Fill in `TODO`s until the prover can verify all tasks, notified with green check-marks. + +* To submit your solution, run `./scripts/submit.sh` and submit `assignment05.zip` in the `target` directory to gg. + +* More on Why3: +* Why3 standard library: From e5b80e73652de0ef51dd11ecad9c728aea05037f Mon Sep 17 00:00:00 2001 From: AnHaechan Date: Tue, 29 Aug 2023 07:29:56 +0000 Subject: [PATCH 14/17] why3 assignment: add one-line comment, fixed max spec --- assets/why3/assignment05/max.mlw | 32 ++++++++++++++++++----------- assets/why3/assignment05/pascal.mlw | 6 ++++-- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/assets/why3/assignment05/max.mlw b/assets/why3/assignment05/max.mlw index b0b858b..ff04fa9 100644 --- a/assets/why3/assignment05/max.mlw +++ b/assets/why3/assignment05/max.mlw @@ -1,9 +1,14 @@ (* Max - Given an array `a` of natural numbers with length `n`, - return the maximum element of the array. + Given an array `a` of integers with length `n` greater than `0`, + return `max_idx`, the index of the maximum element of that array. - You should stengthen the loop invariant. + E.g. `max_idx [5, 12, 34, 10] 4` will return `2` + E.g. `max_idx [4, 3, 2] 3` will return `0` + E.g. `max_idx [1, 2, 3, 4] 4` will return `3` + + Prove the below program indeed follows the given specification, + by giving an appropriate invariant. *) module Max @@ -12,18 +17,21 @@ module Max use ref.Ref use array.Array - let max (a: array int) (n: int) : (max: int) + let max_idx (a: array int) (n: int) : (max_idx: int) + requires { length a > 0 } requires { n = length a } - requires { forall i. 0 <= i < n -> a[i] >= 0 } - ensures { forall i. 0 <= i < n -> a[i] <= max } - ensures { exists i. 0 <= i < n -> a[i] = max } - = let ref max = 0 in - for i = 0 to n - 1 do + ensures { 0 <= max_idx <= n-1 } + ensures { forall i. 0 <= i <= n-1 -> a[i] <= a[max_idx] } + = + let ref max_idx = 0 in + for i = 0 to n-1 do + invariant { 0 <= max_idx <= n-1 } (* IMPORTANT: DON'T MODIFY THE ABOVE LINES *) - invariant { true (* TODO: Replace `true` with your solution *) } + invariant { true (* TODO: Replace `true` with your solution. Your solution MUST be a single line, at line number 30. DON'T add another line of codes. *) } (* IMPORTANT: DON'T MODIFY THE BELOW LINES *) - if max < a[i] then max <- a[i]; + if a[max_idx] < a[i] then max_idx <- i; done; - max + max_idx end + diff --git a/assets/why3/assignment05/pascal.mlw b/assets/why3/assignment05/pascal.mlw index bf1f02a..4601099 100644 --- a/assets/why3/assignment05/pascal.mlw +++ b/assets/why3/assignment05/pascal.mlw @@ -10,13 +10,15 @@ module Pascal use ref.Ref use array.Array + (* The mathematical combination, defined recursively. *) let rec function comb (n k: int) : int requires { 0 <= k <= n } variant { n } ensures { result >= 1 } = if k = 0 || k = n then 1 else comb (n-1) k + comb (n-1) (k-1) - (* Insert appropriate invariants so that Why3 can verify this function. *) + (* Computes the Pascal's triangle and returns the `n`th row of it. *) + (* Insert an appropriate invariant so that Why3 can verify this function. *) (* You SHOULD understand the Pascal's triangle first to find good invariants. *) let chooses (n : int) : array int requires { n > 0 } @@ -30,7 +32,7 @@ module Pascal let new_row = Array.make (r+1) 1 in for c = 1 to r-1 do (* IMPORTANT: DON'T MODIFY THE ABOVE LINES *) - invariant { true (* TODO: Replace `true` with your solution *) } + invariant { true (* TODO: Replace `true` with your solution. Your solution MUST be a single line, at line number 35. DON'T add another lines. *) } (* IMPORTANT: DON'T MODIFY THE BELOW LINES *) new_row[c] <- row[c-1] + row[c] done; From 390e2d696330612b9629206c501846b51da68a7b Mon Sep 17 00:00:00 2001 From: AnHaechan Date: Tue, 29 Aug 2023 07:48:00 +0000 Subject: [PATCH 15/17] why3 assignment: partial score --- assets/why3/assignment05/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/assets/why3/assignment05/README.md b/assets/why3/assignment05/README.md index 245b94f..77a4db3 100644 --- a/assets/why3/assignment05/README.md +++ b/assets/why3/assignment05/README.md @@ -3,6 +3,8 @@ * The primary goal of this assignment is to grasp basic concepts about proving a program's correctness with deductive reasoning. * You should fill in `TODO`s in three files: `max.mlw`, `binary_search.mlw`, `pascal.mlw`. + * You will get PARTIAL SCOREs for each of those three files. + * E.g. If `max.mlw` and `binary_search.mlw` get passed, 2 out of 3 points will be given. * You may use [Why3 in your browser](https://why3.lri.fr/try/). * Clicking `Verify` button at the top will open a panel on the right side. From 02b72ecf783c96b4887f4408636f352c922eb5e7 Mon Sep 17 00:00:00 2001 From: Jeehoon Kang Date: Tue, 29 Aug 2023 14:50:37 +0900 Subject: [PATCH 16/17] Explain SSO --- README.md | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index e0f9601..7d77b9b 100644 --- a/README.md +++ b/README.md @@ -95,28 +95,29 @@ Make sure that you're capable of using the following development tools: - We recommend you to read [this page](https://cp.kaist.ac.kr/helpdesk#technical-expertise) that describes how to study Rust. - `cargo doc --open` on your local will show you the documentation for each homework. -- [Visual Studio Code](https://code.visualstudio.com/) (optional): for developing your homework. If you prefer other editors, you're good to go. - - [ChatGPT](https://chat.openai.com/) or other LLMs (optional): for your homework. - In the era of AI, we believe that it is crucial to learn how to wisely use AI in programming. - So we adjusted the difficulty of homework assuming that you'll use ChatGPT 3.5 (or equivalent) to solve it. +- [Visual Studio Code](https://code.visualstudio.com/) (optional): for developing your homework. If you prefer other editors, you're good to go. + +- [Single Sign On (SSO)](https://auth.fearless.systems/) + + You can log in to [gg](https://gg.kaist.ac.kr) and [development server](https://cloud.fearless.systems) using the following SSO account: + + id: KAIST student id (8-digit number) + + email: KAIST email address (@kaist.ac.kr) + + password: please reset it here: + + For [gg](https://gg.kaist.ac.kr), please log in with the "kaist-cp-class" option. + For [development server](https://cloud.fearless.systems), please log in with the "OpenID Connect" option. + - [Development server](https://cloud.fearless.systems/) + **IMPORTANT: Don't try to hack. Don't try to freeze the server. Please be nice.** - + Now you can [use it as a VSCode remote server as in the video](https://www.youtube.com/watch?v=TTVuUIhdn_g&list=PL5aMzERQ_OZ8RWqn-XiZLXm1IJuaQbXp0&index=3). + + You can create and connect to a workspace to open terminal or VSCode (after installing it). - + [NOTE: We recommend the `rust-analyzer` plugin instead of `rls`](https://github.com/rust-analyzer/rust-analyzer). - - + [NOTE: If permission denied error occurs when trying to install `CodeLLDB Extension` into the - remote server](https://github.com/kaist-cp/cs420/issues/5), please follow the steps: - 1. Download [this file](https://github.com/vadimcn/vscode-lldb/releases/download/v1.5.0/codelldb-x86_64-linux.vsix) at the remote server. - 1. Follow [the instructions](https://code.visualstudio.com/docs/editor/extension-gallery#_install-from-a-vsix) to install it. - - + [NOTE: If you cannot connect to the remote server via VSCode with `fail to create hard link` error message](https://github.com/kaist-cp/cs420/issues/91), please follow the steps: - 1. Close VSCode window and try to connect to the remote server via terminal(or cmd). If you encounter `Connection timed out` error message, try again after a few minutes. - 1. Delete all the files in `~/.vscode-server/bin/`. + + We recommend you to use VSCode and its "Rust Analyzer" and "CodeLLDB" plugins. ## Grading & honor code From 4fc475e7fec8c40086fc4a407ba013b6efb43605 Mon Sep 17 00:00:00 2001 From: woojin Date: Thu, 7 Sep 2023 11:26:26 +0900 Subject: [PATCH 17/17] modify issue template --- .github/ISSUE_TEMPLATE/assignment_question.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/assignment_question.yml b/.github/ISSUE_TEMPLATE/assignment_question.yml index 8eb65fd..1b2e5d9 100644 --- a/.github/ISSUE_TEMPLATE/assignment_question.yml +++ b/.github/ISSUE_TEMPLATE/assignment_question.yml @@ -78,6 +78,5 @@ body: label: Your question here description: 'Also tell us, what did you expect to happen?' placeholder: YOUR QUESTION HERE - render: markdown validations: required: true