# HG changeset patch # User Christian Urban # Date 1630760880 -3600 # Node ID aad5957eb7e4102c8f78a63fdadbd771f1aaad64 # Parent a6e9fc38ae547e5469c0163c104d2c3aa354a705 cwupdates diff -r a6e9fc38ae54 -r aad5957eb7e4 cws/cw01.pdf Binary file cws/cw01.pdf has changed diff -r a6e9fc38ae54 -r aad5957eb7e4 cws/cw01.tex --- a/cws/cw01.tex Sat Sep 04 13:29:36 2021 +0100 +++ b/cws/cw01.tex Sat Sep 04 14:08:00 2021 +0100 @@ -119,11 +119,11 @@ What is your King's email address (you will need it in Question 5)? Also could you please let me know from where you will be mainly -studying? Thanks! +studying? (online / in-person, in London / somewhere else) Thanks! \subsection*{Question 2 (Unmarked)} -Can you please list all programming languages in which you have +Can you please also list all programming languages in which you have already written programs (include only instances where you have spent at least a good working day fiddling with a program)? This is just for my curiosity to estimate what your background is. @@ -246,7 +246,8 @@ You can either add the constructor $CFUN$ to your implementation in Question 3, or you can implement this questions first and then use $CFUN$ instead of \code{RANGE} and \code{CHAR} in Question 3. - +In an ideal world one would do this task first, but this might confuse +you with what you need to do in the previous question. \subsection*{Question 5} diff -r a6e9fc38ae54 -r aad5957eb7e4 cws/cw02.pdf Binary file cws/cw02.pdf has changed diff -r a6e9fc38ae54 -r aad5957eb7e4 cws/cw02.tex --- a/cws/cw02.tex Sat Sep 04 13:29:36 2021 +0100 +++ b/cws/cw02.tex Sat Sep 04 14:08:00 2021 +0100 @@ -73,11 +73,10 @@ \texttt{<}, \texttt{=}, \texttt{;}, - \texttt{,} and + \texttt{,} + \texttt{$\backslash$} and \texttt{:} - \textcolor{red}{Please also add \texttt{$\backslash$} for the collatz program.} - \item strings are enclosed by \texttt{"\ldots"} and consisting of symbols, whitespaces and digits \item parentheses are \texttt{(}, \texttt{\{}, \texttt{)} and \texttt{\}} diff -r a6e9fc38ae54 -r aad5957eb7e4 cwtests/cw02/collatz.while --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cwtests/cw02/collatz.while Sat Sep 04 14:08:00 2021 +0100 @@ -0,0 +1,8 @@ +write "Input a number "; +read n; +while n > 1 do { + if n % 2 == 0 + then n := n/2 + else n := 3*n+1 +}; +write "Yes" diff -r a6e9fc38ae54 -r aad5957eb7e4 cwtests/cw02/collatz2.while --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cwtests/cw02/collatz2.while Sat Sep 04 14:08:00 2021 +0100 @@ -0,0 +1,27 @@ +// Collatz series +// +// needs writing of strings and numbers; comments + +bnd := 1; +while bnd < 101 do { + write bnd; + write ": "; + n := bnd; + cnt := 0; + + while n > 1 do { + write n; + write ","; + + if n % 2 == 0 + then n := n / 2 + else n := 3 * n+1; + + cnt := cnt + 1 + }; + + write " => "; + write cnt; + write "\n"; + bnd := bnd + 1 +} \ No newline at end of file diff -r a6e9fc38ae54 -r aad5957eb7e4 cwtests/cw02/factors.while --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cwtests/cw02/factors.while Sat Sep 04 14:08:00 2021 +0100 @@ -0,0 +1,11 @@ +// Find all factors of a given input number + + +write "Input n please"; +read n; +write "The factors of n are"; +f := 2; +while (f < n / 2 + 1) do { + if ((n / f) * f == n) then { write(f) } else { skip }; + f := f + 1 +} \ No newline at end of file diff -r a6e9fc38ae54 -r aad5957eb7e4 cwtests/cw02/fib.while --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cwtests/cw02/fib.while Sat Sep 04 14:08:00 2021 +0100 @@ -0,0 +1,13 @@ +write "Fib"; +read n; +minus1 := 0; +minus2 := 1; +while n > 0 do { + temp := minus2; + minus2 := minus1 + minus2; + minus1 := temp; + n := n - 1 +}; +write "Result"; +write minus2 + diff -r a6e9fc38ae54 -r aad5957eb7e4 cwtests/cw02/loops.while --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cwtests/cw02/loops.while Sat Sep 04 14:08:00 2021 +0100 @@ -0,0 +1,14 @@ +start := 1000; +x := start; +y := start; +z := start; +while 0 < x do { + while 0 < y do { + while 0 < z do { z := z - 1 }; + z := start; + y := y - 1 + }; + y := start; + x := x - 1 +} + diff -r a6e9fc38ae54 -r aad5957eb7e4 style.sty --- a/style.sty Sat Sep 04 13:29:36 2021 +0100 +++ b/style.sty Sat Sep 04 14:08:00 2021 +0100 @@ -75,10 +75,10 @@ % CW deadlines -\def\cwONE{16 October} -\def\cwTWO{6 November} -\def\cwTHREE{27 November} -\def\cwFOUR{18 December} -\def\cwFIVE{15 January} +\def\cwONE{18 October} +\def\cwTWO{8 November} +\def\cwTHREE{29 November} +\def\cwFOUR{13 December} +\def\cwFIVE{24 January} \def\cwISABELLE{11 December} diff -r a6e9fc38ae54 -r aad5957eb7e4 videos/01-intro.srt --- a/videos/01-intro.srt Sat Sep 04 13:29:36 2021 +0100 +++ b/videos/01-intro.srt Sat Sep 04 14:08:00 2021 +0100 @@ -52,7 +52,7 @@ 12 00:00:46,130 --> 00:00:49,310 do not need to be an -Über hacker to implement your own +Überhacker to implement your own 13 00:00:49,310 --> 00:00:51,305 @@ -510,11 +510,11 @@ 110 00:05:41,560 --> 00:05:45,935 Even though we cut corners -into could generate apart. +in the code generater part 111 00:05:45,935 --> 00:05:48,575 -By producing code for the JVM, +by producing code for the JVM, 112 00:05:48,575 --> 00:05:51,710 @@ -835,11 +835,11 @@ 180 00:08:52,190 --> 00:08:56,690 Why on Earth studying -compilers in 2020? And even worse +compilers in 2020 (and of course in 2021)? 181 00:08:56,690 --> 00:08:59,659 -why implementing +And even worse: Why implementing your own compiler? 182 @@ -890,7 +890,7 @@ 192 00:09:29,690 --> 00:09:32,585 -wierder, rather than +weirder, rather than getting clocked faster. 193 @@ -950,7 +950,7 @@ 205 00:10:07,189 --> 00:10:11,930 We have TSPs, GPUs, ARM -big,little, Xeon Phis, +big,little, Xeon Phi, 206 00:10:11,930 --> 00:10:14,630 @@ -1245,7 +1245,7 @@ 268 00:13:15,770 --> 00:13:18,650 -bat is very well-known in +but is very well-known in 269 00:13:18,650 --> 00:13:22,040 @@ -1368,7 +1368,7 @@ 295 00:14:26,420 --> 00:14:30,195 their airplanes up in the -air and let them not crush. +air and let them not crash. 296 00:14:30,195 --> 00:14:33,010 @@ -1485,11 +1485,11 @@ 321 00:15:40,280 --> 00:15:43,670 This BF language contains -the kind of memory and +a kind of memory and 322 00:15:43,670 --> 00:15:45,680 -the memory pointer which can +a memory pointer which can 323 00:15:45,680 --> 00:15:48,140 @@ -1558,7 +1558,7 @@ 337 00:16:22,865 --> 00:16:27,120 And I run it with a -benchmark program, which +benchmark program, which you 338 00:16:27,760 --> 00:16:30,960 @@ -1615,11 +1615,11 @@ 350 00:17:06,520 --> 00:17:09,490 -representing the BF memory in +representing the BF memory in C. 351 00:17:09,490 --> 00:17:12,310 -C. We can do this +We can do this by just an array of 352 @@ -1819,11 +1819,11 @@ 395 00:19:31,810 --> 00:19:38,395 Keep this in mind. -As a second try, + 396 00:19:38,395 --> 00:19:42,595 -of course, I can try to now +As a second try, of course, I can try to generate a better C program. 397 @@ -1935,7 +1935,7 @@ 421 00:20:51,530 --> 00:20:54,050 -So there's minus O0. +So it runs with minus O0. 422 00:20:54,050 --> 00:20:56,090 @@ -1984,8 +1984,8 @@ 432 00:21:31,700 --> 00:21:35,255 -any optimizations and run -essentially 20 seconds. +any optimizations and it runs +essentially for 20 seconds. 433 00:21:35,255 --> 00:21:37,880 @@ -2016,11 +2016,11 @@ 439 00:21:55,430 --> 00:21:58,070 increments everything -in a single steps +in single steps 440 00:21:58,070 --> 00:22:00,185 -or decremented in single steps. +or decrements in single steps. 441 00:22:00,185 --> 00:22:04,835 @@ -2147,7 +2147,7 @@ 468 00:23:25,700 --> 00:23:28,160 -I first run the program with +I first run the Mandelbrot program with 469 00:23:28,160 --> 00:23:31,730