EEN118 R (Programming 1) Autumn 2014
Tues, Thurs 12:30-1:45 in MM-203

Class History

Class 1  ‑ Tue 26‑8‑2014   Quick introductions, what it is all about.
Class 2  ‑ Thur 28‑8‑2014 Setting up a project. Two simple programs, one text based and the other graphical.
Class 3  ‑ Tue 2‑9‑2014 The lost day.
Class 4  ‑ Thur 4‑9‑2014 Types, values, and operators. Functions and ifs and elses.
The final version of today's peculiar example.
Class 5  ‑ Tue 9‑9‑2014 More functions: experiments with triangles and pi first version, second version,
Five steps towards controlling repetition without having to learn anything new: one, two, three, four, four and a half, five.
All the operators and data types and dull rules.
Class 6  ‑ Thur 11‑9‑2014 Adventures with "circularly defined" functions - flexible control of repetition.
Six examples, make sure you understand how and why each works.
Class 7  ‑ Tue 16‑9‑2014 Carefully analysing the strange function from Thursday.
Much more practice with strange and useful recursive functions.
Class 8  ‑ Thur 18‑9‑2014 A very very long program, and it isn't a very good idea either, but
the same results can be achieved sensibly in six simple steps: one, two, three, four, five, six.
Essential development plan - maintain, make use of, and enlarge the guarantee.
Class 9  ‑ Tue 23‑9‑2014 A program that writes a program for us,
Spirograph of squares, Recursive tiling in squares, The fractal triangle turns into a snowflake,
Plotting a graph with a new recursive scheme, Using colour to show two functions in one graph.
Class 10  ‑ Thur 25‑9‑2014 Using unix short summary of commands.
The number guessing game, and how it leads directly to a very fast way of finding square roots, arcsines, and so on.
The importance of being able to do two-to-the-power-ofs in your head, and how easy it is.
Class 11  ‑ Tue 30‑9‑2014 Remember to use const, it is very helpful.
"cout <<" for output, setw and setprecision.
Quickly finding square roots using the Binary Chop Search method.
and Newton's method, which is even faster.
Class 12  ‑ Thur 2‑10‑2014 How to make bees, and what a caprimulgus does at night.
Simulating Brownian motion with a useful while loop.
Binary Chop Search at the pet shop.
  Sat & Sun Voluntary pre-test review sessions. Saturday at 3 and Sunday at 1, in the lab room.
Class 13  ‑ Tue 7‑10‑2014 Preparing for the test: an old sample, another.
Class 14  ‑ Thur 9‑10‑2014 Test Day.
Class 15  ‑ Tue 14‑10‑2014 The fibonnacci sequence version 1, accidentally exponential, and version 2, simple and fast.
Introducing variables for version 3, no improvement really.
Exploring the Collatz sequence, and now looking at it graphically to see if there are any patterns. Finally the mysterious version, scaled to show more, but it gets stuck when n is 113383 because the 120th value in the sequence is 2,482,111,348, just too big for an int.
Little Break
Class 16  ‑ Tue 21‑10‑2014 Things we learned from the test.
The dangers of complacency.
Developing our own sine function.
Class 17  ‑ Thur 23‑10‑2014 <iostream>, <string>, <iomanip>, <cmath>, using namespace std;, cin.
Why factorial goes wrong so soon.
Viewing successive approximations to the sine function.
Class 18  ‑ Tue 28‑10‑2014 Inconvenient but nice: the unicode character set.
Dealing with files: ifstream, ofstream, open, fail, close, >>, <<, getline.
The table of elements program, and this is the file that it reads.
Class 19  ‑ Thur 30‑10‑2014 Introducing objects with struct. Some string processing.
Beginning the Chemistry Calculator.
Class 20  ‑ Tue 4‑11‑2014 Getting further with the Chemistry Calculator, restructuring to improve clarity, fidning the need for
Reference Parameters.
Class 21  ‑ Thur 6‑11‑2014 The finished chemistry calculator, even able to handle complicated formulæ like C6H2(NO2)3CH3, trinitrotoluene, through a very simple use of recursion.
Class 22  ‑ Tue 11‑11‑2014 Object Orientation: Methods and Constructors, and teaching << new tricks.
All incorporated into the Chemistry Calculator.
Class 23  ‑ Thur 13‑11‑2014 Separate compilation for convenience and to preserve trade secrets.
protected: and public: make things safe.
  Sun 16th Voluntary pre-test review sessions. Sunday at 12 and 3, in the lab room.
Class 24  ‑ Tue 18‑11‑2014 The update operators +=, -=, *=, /=, %=, &&=, and so on.
The difference between a++ and ++a (both bad!).
For loops and do-while loops, break and continue.
Why C++ is completely hopeless with two dimensional arrays.
How we can make everything perfect with our own class.
Class 25  ‑ Thur 20‑11‑2014 Deriving formulas from test data: the graphical method (I clicked on the wrong graph paper in class and never noticed, this is what it should have looked like, along with the timing data. The blue line almost perfectly hits all the points, and its gradient is exactly 2, showing us that time is proportional to N squared), and the differences method.
Sometimes the best was to program a solution is to forget the computer and use your mind: find the sum of all the numbers from 1 to N inclusive, that are not multiples of 5 or 7, where N can be anything from 1 to 1,000,000,000. Which of these functions would be faster?
Break
  Mon 1st Voluntary pre-test review sessions. Monday after the lab session.
Class 26  ‑ Tue 2‑12‑2014 Test Day.
Class 27  ‑ Thur 4‑12‑2014 Sorting numbers with lego bricks. To sort N numbers requires half-N-squared lego bricks. That measures the amount of effort devoted to the task, and therefore the amount of time it takes. No wonder we got a quadratic graph.
Class 28  ‑ Tue 9‑12‑2014 What we learned from the second test.
  Wed 10th Dec Voluntary pre-final review session. Wednesday at 3 p.m.
  Thur 11th Dec Final at 2:00 pm.
  Sat 13th Dec Voluntary pre-final review session for the Kubat section. Saturday at 1 p.m.


Lab Assignments

Lab 1, Tues 2 Sept - Mon 8 Sept
(pdf) Using visual C++ to run programs; drawing stars and stick figures.
Lab 2, Tues 9 Sept - Mon 15 Sept
(pdf) Divide and conquer: building big programs from little functions.
Lab 3, Tues 16 Sept - Mon 22 Sept
(pdf) Controlling repetition in programs.
Lab 4, Tues 23 Sept - Mon 29 Sept
(pdf) A video game: exploding the enemy with a cannon.
Lab 5, Tues 30 Sept - Mon 6 Oct
(pdf) Generating calendars and using Unix.
Lab 6, Tues 7 Oct - Mon 13 Oct
(pdf) A real-time animated clock application.
Lab 7, Mon 20 Oct - Thur 24 Oct
(pdf) A randomly generated Happy Street Scene.
Lab 8, Mon 27 Oct - Thur 30 Oct
(pdf) An interactive desk calculator.
Lab 9, Mon 3 Nov - Thur 6 Nov
(pdf) Meteorological data processing and visualisation. the data files
Lab 10, Mon 10 Nov - Thur 13 Nov
(pdf) Database programming under Unix.
Data files: database1.txt, 2, 3, 5, 10, 20, 30, 50, 100.
The special timing function.
Lab 11, Mon 17 Nov - Thur 20 Nov
(pdf) A robot seaching for treasure in a maze. sample maze.
The due date for this lab is one week later than it normally would be.
Lab 12, Mon 1 Dec - Thur 4 Dec
(pdf) An automatic robot: he turned into a video game.
Sun 14 Dec
Last day anything will be accepted for grading.