# Random Numbers - Richard Buckland UNSW (2008)

Extension lecture introducing randomness. What is a random process? How can a deterministic process on a deterministic computer generate random output? Why is randomness useful? What are problems we face when generating random numbers? The lecture introduces Von Neumann's simple algorithm (which we later analyse in labs), and Knuth's Art of Computer Programming. We briefly revisit the triangle problem. Richard amazes and astounds with magic tricks. Some mention of Shaun of the Dead. Extension lectures are for first year computing students at UNSW. The topics covered are non-examinable, students attend only if they are interested. Richard generally raises more questions than he answers.

• ##### Higher Computing - Richard Buckland UNSW 2008
Richard Buckland

Richard Buckland teaches Higher Computing at UNSW - The University of New South Wales.

• ##### Inside a Computer - Richard Buckland UNSW
Richard Buckland

Introduction to computing for first year computer science and engineering students at UNSW. What the course is about. A simple C program. Experimentation and fiddling. How a computer works (in 10 minutes), transistors, chips, microprocessors. Our own baby microprocessor, the 4917, and how it works. Lost sound after 50 mins, partial sound restored at 51 mins

• ##### Machine Code - Richard Buckland UNSW
Richard Buckland

After some announcements we revise using transistors as switches. Then we look at how to program our basic 4 bit microprocessor using 4917 machine code. At the end we see how we can try out our machine code programs using the 4917 emulator on the web page

• ##### Simple C Program - Richard Buckland UNSW
Richard Buckland

Strings, elements and layout of a c program. using gcc, comments, ints, printf, scanf, main, #include, printing newlines. Discussion of clarity. also: about transistors, compiling, machine code

• ##### Clarity (C programming #2) - Richard Buckland UNSW
Richard Buckland

Style, clarity, hackers vs elite programmers, simple c programming, side effects, compiler options, segmentation faults. You get an error - what to do? Following the spec. Integer division and remainder.

• ##### Solving Problems - Richard Buckland UNSW 2008
Richard Buckland

Human Nature, Testing, Top-down problem solving. How to get started when you first get a problem. The importance of testing.Also: magic numbers, style - the search for meaning, "why are you here?" mastering skills, why kids give up on musical instruments, pleasure and pain, richard getting fit, software piracy/viking numbers, Bjorn. First twinges of RSI. Moving to an 8bit Microprocessor. My lousy memory about facts and figures: Viking 1 and 2 were landers not rovers, and viking 2 failed first, not Viking 1 - it was Viking 1 with the software problem.

• ##### Side Effects - Richard Buckland UNSW 2008
Richard Buckland

The Adversary and adversary models of computation: an all powerful force out to get you. Side Effects: in machine code, in c functions, in general. Returning a value from main. Also: ASCII, talking in lectures, mars bars and Marco Polo and the emperor of china. Music: Triohatala by Stimmhorn (not really vikings)

• ##### Writing a Simple C Program - Richard Buckland
Richard Buckland

We write a simple c program together during the lecture: "countdown" how many seconds are left until the first assignment is due? We (or rather Richard) make many mistakes. Using top down design, functions, function prototypes, integer arithmetic, input/output. we discuss program style, clarity, simplicity and complexity. how to start to solve a problem. what to do when you get stuck. more on top down approach. # includes magic numbers variable names. why not to write amusing error messages. Prjintf().

• ##### COMP1917 Higher Computing - Richard Buckland UNSW
Richard Buckland

R Introduction to computing for first year Computer Science and Engineering students at UNSW.

• ##### COMP1917 Higher Computing - Richard Buckland UNSW: Part 1
Richard Buckland

After lecture 8 we had a one week break, and during the break we ran a revision session to recap on the material covered in the first two weeks. This was for students new to programming to help them consolidate what we had done so far. This is the first part of the revision session.

• ##### COMP1917 Higher Computing - Richard Buckland UNSW: Part 2
Richard Buckland

After lecture 8 we had a one week break, and during the break we ran a revision session to recap on the material covered in the first two weeks. This was for students new to programming to help them consolidate what we had done so far. This is the second part of the revision session. sadly camera problems meant some bits were not recorded.

• ##### A Simple Recursive Function - Richard Buckland UNSW
Richard Buckland

We sum the numbers 0..n using gauss, the formula for an arithmetic progression, and finally using a simple recursive program. Apparently summing the numbers 0..n is important in computer science. Along the way we continue our discussion of style and craftsmanship, chainsaws, floats, doubles, longs, side effects. Skating. Richard explains that this is not a C course. It is a computing course which happens to use C. C is our tool it is not our objective.

• ##### Functions - Richard Buckland UNSW
Richard Buckland

Class selects class reps for the first 9:30. The lecture looks at functions. What they provide: Abstraction, Code Reuse, Scope. How functions work in C (under the hood) Machine code view of function calls in our 8 bit machine code. Introduction to abstraction. what is abstraction? what are the advantages of abstraction?

• ##### What To Do When Things Go Wrong? Richard Buckland UNSW
Richard Buckland

We start by discussing the skater guy from last lecture. intrinsic vs extrinsic motivation. deep and surface learning. class reps revisited briefly. what can go wrong. what courses of action are open to you to deal with things going wrong in your code? we look at 4 general strategies and discuss their relative strengths and weaknesses. assert as a way of documenting assumptions and of checking them. contracts. who is to blame. what can you expect other parties to do? what do you need to allow for yourself. more types: char for representing characters. ascii, relation to 8917, signed vs unsigned. typecasts. implicit type conversions (widening) vs explicit type conversions, typedef. c is lax with types. getting fit - why is my plan not working. motivation. behaviour change.

• ##### The Mechanics of Function Calls - Richard Buckland UNSW
Richard Buckland

How a C function call is implemented in machine code. frames. role and responsibilities. Abstraction revisited. Scope revisited. This is the first part of lecture 12.

• ##### The Mechanics of Function Calls (part 2) - Richard Buckland UNSW
Richard Buckland

How C function calls are implemented - at the machine code level. The role of the callee. Frames. Saving registers, local variables. one way of returning a value. Also: following safe conventions even when we don't have to do so. The danger of having to think. The lunch box scope example completed. Can you ever have too many comments? The address of operator &. This is the second part of Lecture 12. We finish early which leaves us time to chat about another key person in the development of the science of computing - Alan Turing (see Lecture 12.3 which follows)

• ##### The Amazing Alan Turing - Richard Buckland (extension lecture) UNSW 2008
Richard Buckland

We had a gap at the end of Lecture 12 so Richard gives an unplanned and impromptu talk about some of the contributions of the amazing thinker Alan Turing. So much to say, so little time, such fast talking. We chat about 3 different major contributions he made to the world - his decryption work during WWII and the Engima Machine; his abstract model of a computer (the Turing Machine) and what things can be effectively "computed"; and finally, briefly only, his thoughts about what it is to be human and the difference between humans and computers - the Turing Test. Alan Turing is a key figure in the development of computing, indeed if I had to pick just one thinker who was the most amazing he'd get my vote. Richard promises to talk about the Turing Test in more depth in the next extension lecture. Also comes up:Epimenides paradox, non computable functions, the halting problem, U-559, Colin Grazier G.C., Anthony Fasson, G.C.,Tommy Brown, Blade Runner,CAPTCHAs. Errata:My memory was about as reliable as usual - I said Tommy stayed outside in a boat but i've since read that all three swam across and went into the U-559. Humbling bravery. I've also since realised that Colin Grazier was from Tamworth in the UK, not the Tamworth in Australia as I had always thought (why are so many English places named after Australian towns?) Finally, something which actually I did know but still managed to get wrong - the important material salvaged was not a cypher machine but quantities of data (ciphertext and the corresponding plaintext I think) which the codebreakers at Bletchley Park were able to use as "cribs" and were of vast help in cracking the submarine code used at that time.

• ##### The Turing Test - Richard Buckland UNSW
Richard Buckland

Inspirational Scientist Jane Goodall speaks about Jo-Jo and Rick. (sound patchy for first 8 mins - download the full quality 4min audio clip of her lecture from http://www.cse.unsw.edu.au/~richardb/JaneGoodall.wavcourtesy of the ABC RN Science Show) More about the great thinker Alan Turing. The Turing Test and its links with design, computer science, and life the universe and somethings. What is it to be a person? Philosophy T. Intensional vs Extensional points of view. Pointers * and & revisited. while loops common mistakes with loops Also mentioned: godel escher bach auden EOF

• ##### UNSW COMP1917 Higher Computing 2008 S1W4L3
Richard Buckland

Introduction to programming course for first year computer science students at UNSW.

• ##### Frames (revision) - Richard Buckland (UNSW)
Richard Buckland

Students give feedback about what problems they are having with machine code. Most problematic topic seems frames. Richard revises: what *is* a frame? how is a frame used? roles of the calling function and the called function. what is the return address and how is it used? what is the frame pointer and how is it used?

• ##### Arrays (part 1) - Tim Lambert UNSW
Richard Buckland

Arrays in C. eg calculating the average of a bunch of numbers. man pages - consulting the manual for scanf. debugging by using printf. invalid input to scanf. easy to write an infinite loop!

• ##### Arrays (part 2) - Tim Lambert UNSW
Richard Buckland

Examples using arrays in C. eg calculating letter frequencies in a text, substitution ciphers. array initialisers. also: strings, ctype.h

• ##### Pass By Reference: Arrays#3 - Tim Lambert UNSW
Richard Buckland

Tim explains pass by reference and the link between arrays and pointers. Using sample code we see that C passes arrays into functions *by reference*, unlike all the other types we have seen so far.

• ##### Game Design - Malcolm Ryan UNSW
Richard Buckland

What is fun? UNSW Researcher Malcolm Ryan gives an extension lecture on game design.

• ##### Everything U Need 2 Know About Pointers -Richard Buckland
Richard Buckland

(*but were afraid to ask)Review of pointers and indirect addressing. pass by reference/pass by value. Passing arrays into functions. 3 neat things you can do with pointers:1. pass by ref2. dynamic data structures (to come)3. ADTs in c (to come) the exponential growth of doubling revisited. magic trick where you are offered a choice - VS the importance of a good spec. Starting to design a suduko solver. Mars bars from Hong Kong.

• ##### The Most Important Thing - Richard Buckland UNSW
Richard Buckland

The challenge: can we write a Sudoku solver in a single lecture? What is a sudoku puzzle? Estimation revisited. how to solve a problem - difference between the approach of a master and a novice. What is the most important thing? Also: How to lie with statistics. hang gliding. easy as falling off a bike. algorithms and data structures.

• ##### Stack Frames - Richard Buckland UNSW
Richard Buckland

Review and discussion of sudoku code from last lecture. Backtrack vs brute force. Course waffles. Stacks, "the stack" in memory, Buffer overflows. Also: the course ENGG1000, wiki textbook (idea from hong kong). Predicates, comparing with TRUE. Stack overflow.

• ##### eXtreme Programming - Richard Buckland
Richard Buckland

Extreme programming, unit tests, test as you go, unit tests in C, one objective at a time, refactoring. asserts. multi-file programs in C. linking. #include header files prototypes. main. static helper functions. object files .o files Also: hornblower patriotism / the French

• ##### A Miracle - Richard Buckland UNSW
Richard Buckland

An unexpected miracle. Programming in the large VS programming in the small.

• ##### Programming in the Large - Richard Buckland UNSW
Richard Buckland

How we use standards (called interfaces in this context) to permit us to write large scale computer programs in teams. Task2 as an example of standards. Writing a new interface function. Writing C unit tests using assert. Also: strings vs arrays of chars, array initializers for strings, static functions, unit testing.

• ##### Stress - Richard Buckland UNSW
Richard Buckland

This lecture marks the halfway point of the course. Dealing with stress, programming errors involving arrays, how to write a reflective diary entry, 2 puzzles which seem unrelated, vampires, zombies, and structs in C

• ##### Random Numbers - Richard Buckland UNSW (2008)
Richard Buckland

Extension lecture introducing randomness. What is a random process? How can a deterministic process on a deterministic computer generate random output? Why is randomness useful? What are problems we face when generating random numbers? The lecture introduces Von Neumann's simple algorithm (which we later analyse in labs), and Knuth's Art of Computer Programming. We briefly revisit the triangle problem. Richard amazes and astounds with magic tricks. Some mention of Shaun of the Dead. Extension lectures are for first year computing students at UNSW. The topics covered are non-examinable, students attend only if they are interested. Richard generally raises more questions than he answers.

• ##### The Trouble with Concrete Types - Richard Buckland UNSW
Richard Buckland

The first 17.5 minutes are a discussion of what the task2 diaries revealed: poor time management (eek!) Richard confesses he is bad at time management too and makes some suggestions. The remainder of the lecture is setting up for ADTs (introduced in the next lecture). Task2 (the sudoku solver) is used as motivation. Why do we want to break the problem into separate quasi-independent files? (A: Metcalf's law) What was the relation between the sudokoGrid type and its interface? What is the subtle problem Richard keeps alluding to with respect to the way this separation was implemented? Another Richard, or perhaps Alex, comes up with a better way of implementing sudukoGrid.c - is this as wonderful as it seems or have we unearthed a mare's nest? If only there was some way of solving this problem ... (dissolve to lecture 30)

• ##### Abstract Data Types in C - Richard Buckland UNSW
Richard Buckland

Finishes off the ideas started in #29. The need for Abstract Data Types (ADTs). How to implement them in C. Their wonderfulness. Also: Undocumented features. Can we trust programmers? Allocating memory on the stack. Allocating memory on the heap (malloc/free). Introduction to the project (card game: Blackadder & Baldrick).

• ##### The Major Project - Richard Buckland UNSW
Richard Buckland

Discussion of the major project for 1917 this year (2008) - the card game "Blackadder and Baldrick". The winner of the project grand final playoff gets the title "coolest programmer in first year 2008", and Marvin.

Richard Buckland

Discussion of the project. Converting sudukoGrid into an ADT. also: Accessing the components of a struct using dot notation, and using -> notation.

• ##### Steganography (hidden messages) - Richard Buckland UNSW
Richard Buckland

Extension lecture introducing steganography (hidden messages). Security via obscurity. Hidden messages in book Godel Escher Bach. In film Starship Troopers. In games. In cryptography. In teaching. Digital watermarking. SETI. Are we in a simulation? Extension lectures are for first year computing students at UNSW. The topics covered are non-examinable, students attend only if they are interested. Richard generally raises more questions than he answers.

• ##### Don't give up - Richard Buckland UNSW
Richard Buckland

0:00 Richard talks about what a personal trainer does and how old people exercise. 8:00 project Q&A.27:00 Josephus, whose back story richard discovers from a student. We talk about how to program the Josephus problem. There are many ways we could approach this - we discuss their various merits and sketch out a way of approaching problems like this. Also: Algorithms vs Data Structures. Wei Hua learns to ride a uni-cycle. The Prisoner #6. The WAV format standard. The Australian national anthem - Advance Australia Fair.

• ##### The Australian National Anthem - Richard Buckland UNSW
Richard Buckland

Download the Australian National Anthem: http://www.cse.unsw.edu.au/~richardb/nationalAnthem.wavAdvance Australia Fair. The Australian National Anthem challenge. What is a file? File I/O in C (FILE as an abstract type). Infinite stacks. Memory management, problems with free(). The snake puzzle revisited (linked lists). PBM graphics format. Are we simulated, real, or just a video on youtube? Sending a message to the creator.

• ##### Linked Lists - Richard Buckland UNSW
Richard Buckland

Dob in your commie lecturerhttp://www.google.com.au/search?q=makeeducationfair http://www.younglibs.org.au Indirect addressing. Arrays vs lists. Sample code to set up and manipulate a linked list. Doubly linked lists. Also: The 3-way shuffle to interchange two things. The Wiggles. Robert Sheckley. Stranger than Fiction. Filming starts during the break, lecture starts at 2:10

• ##### Experimenting with CMOS - Richard Buckland UNSW
Richard Buckland

Extension lecture introducing do-it-yourself digital design at home using cmos chips and a breadboard. Extension lectures are for first year computing students at UNSW. The topics covered are non-examinable, students attend only if they are interested. Richard generally raises more questions than he answers.

• ##### Complexity & Trees - Richard Buckland UNSW
Richard Buckland

Searching, best worst and expected case. Binary search and insert - linked lists vs arrays. Trees. Ordered binary trees. 3 interesting books: Puzzle Guide to Godel (Raymond Smullyan), Surely you're joking Mr Feynman (Richard Feynman), Alice/Annotated Alice (Lewis Carrol/Martin Gardiner)

• ##### Programming Errors - Richard Buckland UNSW
Richard Buckland

Persevering. Assignment extensions considered harmful. C errors. Errors at runtime, at compile time, gcc, valgrind, mudflap. Array bounds, Segmentation faults. Risky behaviour - it's hard to detect risk when all goes well. Snarks and Boojums and Zoolander. Catastrophes. Types, unsigned, limits.h, example of bitwise operator use. Von Neumann's clever (but flawed) random number generator.

• ##### Taste of Graphics - Tim Lambert, Yose Widjaja UNSW
Richard Buckland

Tim and Student Yose Widjaja give a taste of the 3rd year graphics course. Yose shows his project for 3d visualisation, and using Ninjas to create and delete 3d pixels. A demo of a flame simulator done by graphics students as their first assignment on CPU and GPU. At the end Tim talks a bit about directX vs open gl.

• ##### Sample Tree Code: Loop Detection - Richard Buckland UNSW 2008
Richard Buckland

Detecting fixed points in von neumann's simple random number generator. data structure revision. using trees. implementing a very simple tree. Talk about the anagram lab exercise. Improving the UNSW 89019 microprocessor. CISC and RISC design. Using memory segments to be able to address more memory. The bicycle wheel puzzle. Simulation - a neat and simple way to solve complicated problems when you can't be bothered to use/can't rely upon/have completely lost your ability to do complex maths accurately. mentioned for no apparent reason: GUNNS Limited, Edgar Allen Poe.

• ##### Ethics - Richard Buckland UNSW
Richard Buckland

What is important? What are "Ethics"? What does it mean to be a good person? Whistleblowing. The whistleblowers handbook. Law. Intellectual property. Copyright. Public Domain. FTA.

• ##### Hamming Error Correcting Code - Richard Buckland UNSW
Richard Buckland

Hamming codes, parity bits, magic. Detecting errors when transmitting information. Even better: correcting errors.

• ##### Professionalism - Richard Buckland UNSW
Richard Buckland

Professionalism and computing. Most students in this course are going to be professionals - but what does that mean? What is a professional? How does it differ from being a non-professional? Why Microsoft is not evil. Professionalism and engineering. Arthur Andersen and Enron. NASA and the Challenger (1986) and the remarkable Richard Feynman, again. NASA (again) and the Columbia (2003). The Therac-25. Public perception of ethics of various professions (Australian data, Ray Morgan) Wise advice for professionals who manage projects: One Hundred Rules for NASA Project Managers by Jerry Madden. Ethics revised. Groundhog day. What is it to be a master programmer? Solving the right problem. Henri Cartier Bresson. Ansell Adams is a geek. This is our last (non-examinable) extension lecture. Just for fun. Wrapping up lots of loose threads. What do nationalism and national anthems have to do with being a good programmer?Question everything. Being a scholar. Also, Dane manages to barter his way home, and Theo and Jean-Paul solve the national anthem challenge.

• ##### What Makes a Good Programmer? - Richard Buckland UNSW
Richard Buckland

The last week of the first computing course course. In this lecture we start to answer the question "What makes a good programmer?" which students have been asking on the forum for a few weeks (what wonderful students!) We then consider how this course fits into the whole computing degree and some ideas about life and learning after leaving university. Craftsmanship. Science. Design. Looking back over what we learned in the course. The first few weeks. Also: striving to be a good photographer. patterns and trees. never giving up. John Stuart Mill. Brave new World. Henri Cartier Bresson. Crazy Idea: Ontogeny recapitulates Phylogeny in computing education.

• ##### The Entire Semester in 46 Minutes and 2 Seconds - Richard Buckland
Richard Betts

First year computing in summary. Everything we did so far. A lot of what and a bit of why. Also richard gets rick rolled. The course soundtrack https://wiki.cse.unsw.edu.au/cs1917cgi/08s1/SoundTrack And potatoes.

• ##### Learning and Teaching Computing - Richard Buckland UNSW
Richard Buckland

The last lecture of COMP1917 /part 1. (The first 18 mins: prizes and course wrap up.)18:25 Richard's teaching philosophy. About teaching and about learning. Where we learn, how we learn, what we learn, why we learn. Intrinsic and extrinsic motivation. Deep and surface learning. More wisdom from Richard Feynman - the brown throated thrush. All of my students are wonderful and amazing. Some of their achievements are publicly acknowledged at the start of the lecture. Also, the 2008 coolest programmer and honour roll. Brownie points. Farewell Alex North. IYP. Course feedback.

• ##### The Strange Case of the Erotic Kiss - Richard Buckland UNSW
Richard Buckland

Note: The Strange Case of the Erotic Kiss is at 56:30 This lecture is the last hour of the last lecture of COMP1917 - the higher stream of the first computing course of the School of Computer Science and Engineering at UNSW. We discussed the structure of the final exam. (Richard has some crazy ways of structuring exams - before the exam make sure you read the sample exam on the course homepage if you missed this lecture - so you don't get affected by misreading the instructions on exam day in the stress of the exam). Group work (and brownies/girl guides). The students' advice to next year's students: * Practise practise practise.* Write your tests *first*!* Do all the lab exercises even if you don't finish them in time for marks. What comes next in your study of computing. About COMP1927 and COMP2911. We say goodbye. The end of a fun semester together - I've very much enjoyed working with you all. My warm best wishes for your future learning and your path through university and beyond, and I hope to see you again in my senior cryptography and security course in a few years. At the end: Richard's fatherly advice for life. Also mentioned: RSI, paper aeroplane injuries, writing the textbook on the wiki for the open book exam, being an actuary. In 2009 I'll record our second course: COMP1927 - "Higher Data Structures and Algorithms". Over the remainder of 2008 we'll post a few more supplementary videos from 1917. At the start of 2009 we'll post the tute and lab material accompanying these 1917 lectures for those who wish to use these videos to teach themselves programming. fond regards,Richard

• ##### Coding Samples C: Extracting Digits Using % /, Recursion
Richard Buckland

Live C coding samples (screen capture movie) from COMP1917. Material from the first two weeks (Lectures 1-8).

• ##### Coding Samples B: Scope, Pass By Copy
Richard Buckland

Live C coding samples (screen capture movie) from COMP1917. Material from the first two weeks (Lectures 1-8).

• ##### Coding Samples A: xcode, .hfiles
Richard Buckland

Live C coding samples (screen capture movie) from COMP1917. Material from the first two weeks (Lectures 1-8).

• ##### Gamification and The Joy of Learning - Richard Buckland
Richard Buckland

Why is university learning seen as a chore by many students, even when they love the subject they are studying? Why does everything have to be worth marks? This is the start of a talk Richard Buckland gave at the UNSW School of Education in November 2011 where he discusses an experiment with a large first year computing course in which assessment activities did not contribute to students' final grades.