diff --git a/Assignment8/code/template.c b/Assignment8/code/template.c new file mode 100644 index 0000000..21403a3 --- /dev/null +++ b/Assignment8/code/template.c @@ -0,0 +1,34 @@ +#include +char currentDirection; + +void fcfs(int start){ + int movement = 0; + double time = 0; + printf("Movement: %i Time:%.1lf\n", movement, time); +} + +void cscan(int start){ + int movement = 0; + double time = 0; + printf("Movement: %i Time:%.1lf\n", movement, time); +} + +int main (int argc, char** argv){ + int position, time; + char algorithm = argv[1][0]; + int start = 0; + currentDirection = 'a'; + + + while ( EOF!=(scanf("%i %i\n",&position,&time))) + { + printf("Delete me: position %i, Delete me: time %i\n",position,time); + } + if (algorithm == 'F'){ + fcfs(start); + }else if ( algorithm == 'C'){ + cscan(start); + } + + return 0; +} \ No newline at end of file diff --git a/Assignment8/in/all_known_in_advance_spaces.in b/Assignment8/in/all_known_in_advance_spaces.in new file mode 100644 index 0000000..4904b69 --- /dev/null +++ b/Assignment8/in/all_known_in_advance_spaces.in @@ -0,0 +1,8 @@ +93 0 +183 0 +37 0 +122 0 +14 0 +124 0 +65 0 +67 0 \ No newline at end of file diff --git a/Assignment8/in/time_dependent_second_spaces.in b/Assignment8/in/time_dependent_second_spaces.in new file mode 100644 index 0000000..8a71de3 --- /dev/null +++ b/Assignment8/in/time_dependent_second_spaces.in @@ -0,0 +1,14 @@ +7394 61 +1217 63 +3898 70 +4254 74 +8951 75 +4764 86 +5517 95 +6765 100 +151 108 +5637 121 +4245 125 +8742 130 +1703 138 +879 140 diff --git a/Assignment8/in/time_dependent_spaces.in b/Assignment8/in/time_dependent_spaces.in new file mode 100644 index 0000000..50c59ef --- /dev/null +++ b/Assignment8/in/time_dependent_spaces.in @@ -0,0 +1,8 @@ +93 10 +183 12 +37 15 +122 17 +14 18 +124 20 +65 23 +67 25 \ No newline at end of file diff --git a/Assignment8/makefile b/Assignment8/makefile new file mode 100644 index 0000000..fd60b15 --- /dev/null +++ b/Assignment8/makefile @@ -0,0 +1,15 @@ +all: + gcc -g -O0 ./code/*.c -lm +1: + ./a.out F < in/all_known_in_advance_spaces.in > student_out/f-in-advance.out && diff student_out/f-in-advance.out out/f-in-advance.out +2: + ./a.out C < in/all_known_in_advance_spaces.in > student_out/c-in-advance.out && diff student_out/c-in-advance.out out/c-in-advance.out +3: + ./a.out F < in/time_dependent_spaces.in > student_out/f-time_dependent.out && diff student_out/f-time_dependent.out out/f-time_dependent.out +4: + ./a.out C < in/time_dependent_spaces.in > student_out/c-time_dependent.out && diff student_out/c-time_dependent.out out/c-time_dependent.out +5: + ./a.out F < in/time_dependent_second_spaces.in > student_out/f-time_dependent_second.out && diff student_out/f-time_dependent_second.out out/f-time_dependent_second.out +6: + ./a.out C < in/time_dependent_second_spaces.in > student_out/c-time_dependent_second.out && diff student_out/c-time_dependent_second.out out/c-time_dependent_second.out + diff --git a/Assignment8/out/c-in-advance.out b/Assignment8/out/c-in-advance.out new file mode 100644 index 0000000..237ba2e --- /dev/null +++ b/Assignment8/out/c-in-advance.out @@ -0,0 +1 @@ +Movement: 183 Time:36.6 diff --git a/Assignment8/out/c-time_dependent.out b/Assignment8/out/c-time_dependent.out new file mode 100644 index 0000000..6ca9aee --- /dev/null +++ b/Assignment8/out/c-time_dependent.out @@ -0,0 +1 @@ +Movement: 10067 Time:2023.4 diff --git a/Assignment8/out/c-time_dependent_second.out b/Assignment8/out/c-time_dependent_second.out new file mode 100644 index 0000000..2ceb586 --- /dev/null +++ b/Assignment8/out/c-time_dependent_second.out @@ -0,0 +1 @@ +Movement: 16765 Time:3414.0 diff --git a/Assignment8/out/f-in-advance.out b/Assignment8/out/f-in-advance.out new file mode 100644 index 0000000..17d3f66 --- /dev/null +++ b/Assignment8/out/f-in-advance.out @@ -0,0 +1 @@ +Movement:693 Time:228.6 diff --git a/Assignment8/out/f-time_dependent.out b/Assignment8/out/f-time_dependent.out new file mode 100644 index 0000000..97c2b5e --- /dev/null +++ b/Assignment8/out/f-time_dependent.out @@ -0,0 +1 @@ +Movement:693 Time:238.6 diff --git a/Assignment8/out/f-time_dependent_second.out b/Assignment8/out/f-time_dependent_second.out new file mode 100644 index 0000000..75b11fb --- /dev/null +++ b/Assignment8/out/f-time_dependent_second.out @@ -0,0 +1 @@ +Movement:53345 Time:10865.0