Class 10. Summer 2012

June 18th, 2012

Assignment due by Thursday.

Write a program that produces an animation in a window of at least two ‘bouncing balls’ so that it appears that each shape bounces off the sides of the window and that they also ‘bounce’ off of each other when they collide. Have the balls change color when they  bounce off the  edges of the window. For up to 10 extra points have them change color and change speed on each bounce. Want more points? Do more balls, more special effects, use mixed shapes – circle, triangle, oval…. Impress me.

Discussion problem:

Three numbers are given as input and labeled x,y, and z.

Write an algorithm to find the maximum of the three.

Some review quizzes for Chapters 6, 7 & 8

Class 9. Summer 2012

June 13th, 2012

Ted Talk

Continue with Chapter 6

Go over #11 in the programming exercises

Note that we’ve seen the face-maker programming exerciser

Here is the ‘anonymizer’ program and some data files:

How do we change this so it will handle more than one face??

Animation programming assignment.

Class 8. Summer 2012

June 12th, 2012

Flame virus linked to Stuxnet: researchers

TED talk

Functions

Chapter 6 – Chapter06.ppt

Animation with a function.

Programs from the text

Try some of the exercise at the end of the chapter, in the lab.

Class 7. Summer 2012

June 6th, 2012

Chapter 5 Strings & Files

Author’s Power Point for Chapter 5 Chapter05.ppt

Programs in the text from Chapter 5

Class 6. Summer 2012.

June 3rd, 2012

 Clifford  Stoll on Tedd – 18 minutes with an agile mind

Return Tests

Chapter 4 of the text.  Objects and Graphics

Materials from the author:

Starting with Zelle’s graphics library

Two others to try:


Graphics Reference (HTML)
Graphics Reference (PDF)

HW for Tuesday

  • Page 118, Exercsie 1
  • Page 118, Exercise 2
  • Choose 1 of exercises 7- 10, pages 118 and 119.

HW for Thursday

  • Modify exercise 2 so that all the circles are appropriately labels with point values as follows: a bull’s eye is worth 9 points and each successive ring is worth 2 points less down to 1 for white.
  • Exercise 11 page 120.

When you turn in the HW, send me by email the source for each program and a still or video capture of the output. You can use Jing to capture stills or video from your screen. Jing has free versions for PC and Mac.

We will spend a little more time working working with the graphics library. You can use this to get the experience you need to do the HW

Before goign to the graphics program we’ll see a brief video presentation

Hod Lipson builds “self-aware” robots | Video on TED.com

Graphics, another try with more specific instructions


Graphics Reference (HTML)
Graphics Reference (PDF)

Play out a video for the house.

Take a look at distance.py for information on how to display information on the screen

For lab. Modify triangle.py, http://mcsp.wartburg.edu/zelle/python/ppics2/code/chapter04/triangle.pyw, so that it draws a pentagon rather than a triangle.

Take a look at the other programs in this chapter

http://mcsp.wartburg.edu/zelle/python/ppics2/code/chapter04/click.py

http://mcsp.wartburg.edu/zelle/python/ppics2/code/chapter04/convert_gui.pyw

http://mcsp.wartburg.edu/zelle/python/ppics2/code/chapter04/futval_graph2.py

 

Class 5. CPSC 110. Summer 2012

May 30th, 2012

News about Flame virus.

Chapter 3 Sample questions.

Chapter 3 – try a program

Test on Thursday – Chapters 1,2, & 3. Answers to exercises are in canvas.

Class 4. Summer 2012

May 24th, 2012

 

A couple of videos regarding eWaste.

Chapter 3

HW for Chapter 3 – Due Wednesday, May 30, 2012

Chapter 3  Summary

Chapter 3 Power Point

Math Library –

program using the Math Library to solve a quadratic

George Washington SurveyorGeorge Washington and Trigonometry

George Washington: Surveyor and Mapmaker

triangle

Develop a solution to finding the width of a river, gorge, stream…

In class – develop designs for solving #2, #5 page 76, #11 page 77

Go to lab and implement a design.

Reading/Writing Assignment

Sample papers

Cliff Stoll Video

 

Class 3. Summer 2012

May 23rd, 2012

Downloading and installing Python on your computer.

 

Miniaturization & the interface – Pattie Maes demos the Sixth Sense | Video on TED.com

Lab work:

  • Exercise 2, Page 53
  • Exercsie 3, Page 53
    • Modify convert.py with a loop so it converts 5 values before quitting

Chapter 2 Summary

A couple of videos regarding eWaste.

Quiz about material in Chapter 2.  Complete in 15 minutes – you may use the lab and/or your book.

Quiz on Chapter 2

Intro to Chapter 3 – read Chapter 3.

HW for Chapter 3 – Due Wednesday, May 30, 2012

Class 2. Summer 2012

May 22nd, 2012

Downloading and installing Python on your computer.

A discussion of Algorithms and Computers. See the presentation at https://docs.google.com/present/view?id=ddmmhxsn_1260gr2p29cx

Go over chaos program

# File: chaos.py
# A simple program illustrating chaotic behavior.
def main():
     print("This program illustrates a chaotic function")
     x = eval(input("Enter a number between 0 and 1: "))
     for i in range(10):
         x = 3.9 * x * (1 - x)
         print(x)
main()

Translation process. Text to Binary

In Python the program is interpreted. It is translated to binary by the Python language system and then run.

# program to print Hello, World!
def main():
     print("Hello, World!")

main()

In Java the program is translated to an intermediate format called bytecodes. These are interpreted or executed by a Java Virtual Machine.

In C++ the program is compiled for a specific computer system.

#include      // class for stream input/output
using namespace std;    // use the standard namespace

int main ()             //start of main function
{

      // Write 'Hello, World!'  to output

      cout << "Hello,  World! " << endl;

}

Translated to binary or octal (base eight) so it looks like

042577 043114 000401 000001 000000 000000 000000 000000
000002 000003 000001 000000 004630 004005 000064 000000
 016500 000000 000000 000000 000064 000040 000005 000050
 000036 000035 000006 000000 000064 000000 000064 004005
 000000 000000 000240 000000 000240 000000 000005 000000
 000000 000000 000003 000000 000324 000000 000000 000000
 000000 000000 000021 000000 000000 000000 000004 000000
 000000 000000 000001 000000 000000 000000 000000 004005
 000000 000000 006764 000000 006764 000000 000005 000000
 000000 000001 000001 000000 006764 000000 006764 004006 ......
public class HelloWorld {
public static void main( String[] args  )
{
System.out.println("Hello world");
}
}

About Writing Programs

HW for Wednesday:

  • Turn on your source program and answers to questions from “Our first visit to computer lab.”  This can be as an attachment to an email to

ernestackermann AT  gmail.com

replace AT with @  and delete spaces

HomeWork for Thursday:

  • Page 54. Turn in one program – the source and the output of at least three tests. You can send this as an attachment to an email to me. Do any of the exercises 4-6, 7, 10 0r 11.

 

HW Due from Chapter 3

May 20th, 2012

Title: HW from Chapter 3
Description: HW Due from Chapter 3. Do two programming exercises on pages 76 – 78. Your choice of one from 7, 9,10 and one from 14 – 17.