diff --git a/lab1/a.out b/lab01/a.out similarity index 100% rename from lab1/a.out rename to lab01/a.out diff --git a/lab1/lab1.c b/lab01/lab1.c similarity index 100% rename from lab1/lab1.c rename to lab01/lab1.c diff --git a/lab2/libstr.a b/lab02/libstr.a similarity index 100% rename from lab2/libstr.a rename to lab02/libstr.a diff --git a/lab2/main.c b/lab02/main.c similarity index 100% rename from lab2/main.c rename to lab02/main.c diff --git a/lab2/makefile b/lab02/makefile similarity index 100% rename from lab2/makefile rename to lab02/makefile diff --git a/lab2/my_string.x b/lab02/my_string.x similarity index 100% rename from lab2/my_string.x rename to lab02/my_string.x diff --git a/lab2/str.c b/lab02/str.c similarity index 100% rename from lab2/str.c rename to lab02/str.c diff --git a/lab2/str.h b/lab02/str.h similarity index 100% rename from lab2/str.h rename to lab02/str.h diff --git a/lab2/str.o b/lab02/str.o similarity index 100% rename from lab2/str.o rename to lab02/str.o diff --git a/lab3/a b/lab03/a similarity index 100% rename from lab3/a rename to lab03/a diff --git a/lab3/a.cpp b/lab03/a.cpp similarity index 100% rename from lab3/a.cpp rename to lab03/a.cpp diff --git a/lab3/a.out b/lab03/a.out similarity index 100% rename from lab3/a.out rename to lab03/a.out diff --git a/lab3/b b/lab03/b similarity index 100% rename from lab3/b rename to lab03/b diff --git a/lab3/c b/lab03/c similarity index 100% rename from lab3/c rename to lab03/c diff --git a/lab3/d b/lab03/d similarity index 100% rename from lab3/d rename to lab03/d diff --git a/lab3/i.txt b/lab03/i.txt similarity index 100% rename from lab3/i.txt rename to lab03/i.txt diff --git a/lab3/lab3_1.c b/lab03/lab3_1.c similarity index 100% rename from lab3/lab3_1.c rename to lab03/lab3_1.c diff --git a/lab3/lab3_2.c b/lab03/lab3_2.c similarity index 100% rename from lab3/lab3_2.c rename to lab03/lab3_2.c diff --git a/lab3/lab3_2b.c b/lab03/lab3_2b.c similarity index 100% rename from lab3/lab3_2b.c rename to lab03/lab3_2b.c diff --git a/lab3/lab3_3.c b/lab03/lab3_3.c similarity index 100% rename from lab3/lab3_3.c rename to lab03/lab3_3.c diff --git a/lab3/lab3_4.c b/lab03/lab3_4.c similarity index 100% rename from lab3/lab3_4.c rename to lab03/lab3_4.c diff --git a/lab4/a.out b/lab04/a.out similarity index 100% rename from lab4/a.out rename to lab04/a.out diff --git a/lab4/i b/lab04/i similarity index 100% rename from lab4/i rename to lab04/i diff --git a/lab4/main.c b/lab04/main.c similarity index 100% rename from lab4/main.c rename to lab04/main.c diff --git a/lab4/test.c b/lab04/test.c similarity index 100% rename from lab4/test.c rename to lab04/test.c diff --git a/lab5/a.out b/lab05/a.out similarity index 100% rename from lab5/a.out rename to lab05/a.out diff --git a/lab5/tictac.c b/lab05/tictac.c similarity index 100% rename from lab5/tictac.c rename to lab05/tictac.c diff --git a/lab6/a.out b/lab06/a.out similarity index 100% rename from lab6/a.out rename to lab06/a.out diff --git a/lab6/a.out.dSYM/Contents/Info.plist b/lab06/a.out.dSYM/Contents/Info.plist similarity index 100% rename from lab6/a.out.dSYM/Contents/Info.plist rename to lab06/a.out.dSYM/Contents/Info.plist diff --git a/lab6/a.out.dSYM/Contents/Resources/DWARF/a.out b/lab06/a.out.dSYM/Contents/Resources/DWARF/a.out similarity index 100% rename from lab6/a.out.dSYM/Contents/Resources/DWARF/a.out rename to lab06/a.out.dSYM/Contents/Resources/DWARF/a.out diff --git a/lab6/i b/lab06/i similarity index 100% rename from lab6/i rename to lab06/i diff --git a/lab6/l6_1.c b/lab06/l6_1.c similarity index 100% rename from lab6/l6_1.c rename to lab06/l6_1.c diff --git a/lab6/l6_2.c b/lab06/l6_2.c similarity index 100% rename from lab6/l6_2.c rename to lab06/l6_2.c diff --git a/lab6/l6_3.c b/lab06/l6_3.c similarity index 100% rename from lab6/l6_3.c rename to lab06/l6_3.c diff --git a/lab6/l6_4.c b/lab06/l6_4.c similarity index 100% rename from lab6/l6_4.c rename to lab06/l6_4.c diff --git a/lab7/2.c b/lab07/2.c similarity index 100% rename from lab7/2.c rename to lab07/2.c diff --git a/lab7/3.c b/lab07/3.c similarity index 100% rename from lab7/3.c rename to lab07/3.c diff --git a/lab7/4.c b/lab07/4.c similarity index 100% rename from lab7/4.c rename to lab07/4.c diff --git a/lab7/5.c b/lab07/5.c similarity index 100% rename from lab7/5.c rename to lab07/5.c diff --git a/lab7/a.out b/lab07/a.out similarity index 100% rename from lab7/a.out rename to lab07/a.out diff --git a/lab7/a.out.dSYM/Contents/Info.plist b/lab07/a.out.dSYM/Contents/Info.plist similarity index 100% rename from lab7/a.out.dSYM/Contents/Info.plist rename to lab07/a.out.dSYM/Contents/Info.plist diff --git a/lab7/a.out.dSYM/Contents/Resources/DWARF/a.out b/lab07/a.out.dSYM/Contents/Resources/DWARF/a.out similarity index 100% rename from lab7/a.out.dSYM/Contents/Resources/DWARF/a.out rename to lab07/a.out.dSYM/Contents/Resources/DWARF/a.out diff --git a/lab7/converted.txt b/lab07/converted.txt similarity index 100% rename from lab7/converted.txt rename to lab07/converted.txt diff --git a/lab7/dos_2.c b/lab07/dos_2.c similarity index 100% rename from lab7/dos_2.c rename to lab07/dos_2.c diff --git a/lab7/dos_3.c b/lab07/dos_3.c similarity index 100% rename from lab7/dos_3.c rename to lab07/dos_3.c diff --git a/lab7/dos_4.c b/lab07/dos_4.c similarity index 100% rename from lab7/dos_4.c rename to lab07/dos_4.c diff --git a/lab7/dos_5.c b/lab07/dos_5.c similarity index 100% rename from lab7/dos_5.c rename to lab07/dos_5.c diff --git a/lab7/g.srt b/lab07/g.srt similarity index 100% rename from lab7/g.srt rename to lab07/g.srt diff --git a/lab7/sub.srt b/lab07/sub.srt similarity index 100% rename from lab7/sub.srt rename to lab07/sub.srt diff --git a/lab7/test b/lab07/test similarity index 100% rename from lab7/test rename to lab07/test diff --git a/lab7/working.srt b/lab07/working.srt similarity index 100% rename from lab7/working.srt rename to lab07/working.srt diff --git a/lab08/1 b/lab08/1 new file mode 100755 index 0000000..5b28b23 Binary files /dev/null and b/lab08/1 differ diff --git a/lab8/1.c b/lab08/1.c similarity index 100% rename from lab8/1.c rename to lab08/1.c diff --git a/lab08/2 b/lab08/2 new file mode 100755 index 0000000..d2e8700 Binary files /dev/null and b/lab08/2 differ diff --git a/lab8/2.c b/lab08/2.c similarity index 100% rename from lab8/2.c rename to lab08/2.c diff --git a/lab8/cipher.c b/lab08/cipher.c similarity index 100% rename from lab8/cipher.c rename to lab08/cipher.c diff --git a/lab8/cipher.h b/lab08/cipher.h similarity index 100% rename from lab8/cipher.h rename to lab08/cipher.h diff --git a/lab08/cipher.o b/lab08/cipher.o new file mode 100644 index 0000000..5acd2dc Binary files /dev/null and b/lab08/cipher.o differ diff --git a/lab8/constants.h b/lab08/constants.h similarity index 100% rename from lab8/constants.h rename to lab08/constants.h diff --git a/lab8/data.bdb b/lab08/data.bdb similarity index 100% rename from lab8/data.bdb rename to lab08/data.bdb diff --git a/lab8/libcipher.a b/lab08/libcipher.a similarity index 100% rename from lab8/libcipher.a rename to lab08/libcipher.a diff --git a/lab8/makefile b/lab08/makefile similarity index 100% rename from lab8/makefile rename to lab08/makefile diff --git a/lab8/speck_macro.h b/lab08/speck_macro.h similarity index 100% rename from lab8/speck_macro.h rename to lab08/speck_macro.h diff --git a/lab9/1.c b/lab09/1.c similarity index 100% rename from lab9/1.c rename to lab09/1.c diff --git a/lab09/2.c b/lab09/2.c new file mode 100644 index 0000000..6ef5650 --- /dev/null +++ b/lab09/2.c @@ -0,0 +1,53 @@ +#include +#include +#include + +#define SIN 0.8660254 + +typedef struct{ + double x, y; +} coordinate; + +// Draws the computation +void draw_koch_snowflake(coordinate a, coordinate b, int t, FILE *f){ + if(!t){ + fprintf(f, "M%f %f L%f %F ", a.x, a.y, b.x, b.y); + return; + } + coordinate tmp = { (b.x - a.x)/3, (b.y - a.y)/3}; + coordinate c = {a.x + tmp.x, a.y + tmp.y}; + coordinate d = {a.x + (1.5 * tmp.x - SIN * tmp.y), a.y + (1.5 * tmp.y + SIN * tmp.x)}; + coordinate e = {a.x + 2 * tmp.x, a.y + 2 * tmp.y}; + draw_koch_snowflake(a, c, t-1, f); + draw_koch_snowflake(c, d, t-1, f); + draw_koch_snowflake(d, e, t-1, f); + draw_koch_snowflake(e, b, t-1, f); +} + +// Provides a frame for the path +void framework(coordinate a, coordinate b, int t, FILE *f){ + fprintf(f, ""); +} + +int main(int argc, char *argv[]){ + int w, h, r; + w = h = 512; + r = w / 3; + int n = atoi(argv[1]); + FILE *f; + if( !(f=fopen("koch.svg","w")) ) return -1; + fprintf(f,"", w, h); + coordinate a = {w / 2, h / 2 + r}; + coordinate b = {w / 2 - r * SIN, h / 2 - r * 0.5}; + coordinate c = {w / 2 + r * SIN, h / 2 - r * 0.5}; + framework(b, a, n, f); + framework(c, b, n, f); + framework(a, c, n, f); + fprintf(f, ""); + fclose(f); + return 0; +} diff --git a/lab09/a.out b/lab09/a.out new file mode 100755 index 0000000..e8fa185 Binary files /dev/null and b/lab09/a.out differ diff --git a/lab09/koch.svg b/lab09/koch.svg new file mode 100644 index 0000000..9181e3d --- /dev/null +++ b/lab09/koch.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/lab09/t.c b/lab09/t.c new file mode 100644 index 0000000..54657bf --- /dev/null +++ b/lab09/t.c @@ -0,0 +1,15 @@ +#include +#define N 3 + +void movedisks(int ndisks, char fromPeg, char toPeg, char auxPeg) { +if (ndisks == 1) + printf("Move disk 1 from [%c] to [%c]\n", fromPeg, toPeg); +else { + movedisks ( ndisks - 1 , fromPeg , auxPeg , toPeg ) ; + printf("Move disk %d from [%c] to [%c]\n", ndisks, fromPeg, toPeg); + movedisks ( ndisks - 1 , auxPeg , toPeg , fromPeg ) ; + } +} +int main(void) { + movedisks(N, 'A', 'C', 'B'); +} diff --git a/lab09/test.svg b/lab09/test.svg new file mode 100644 index 0000000..799f916 --- /dev/null +++ b/lab09/test.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file