CSc 102 - INTRODUCTION TO COMPUTING
Prof. George Wolberg
Extra Credit Homework due 5/21/03 (bring to final on floppy disk):
Write a linear transformation function linear(I, a, b) that takes
image I and transforms all of its pixels according to the equation:
ax + b, where x is the intensity value of a pixel.
Note that when a=2 and b=0, that corresponds to brightening the image
by a factor of 2.
If a=1 and b=20, that corresponds to adding a constant brightness of 20
throughout the image.
You MUST clip the output intensity values so that they do not exceed 255.
Use a lookup table, as in the threshold example contained below in image.zip.
Image.zip contains the source code to a thresholding program
which you can modify to write the linear() function.
It also contains three sample images (in PGM format) and an image viewer to
display images.
All the files are bundled together in a zip file. You need WinZip to unzip
the files. You can download WinZip from the "Download Evaluation Version"
link in www.winzip.com
[Download ip.zip (473610 bytes)]
Homework #11 due 5/9/03:
-
Chapter 5: Problems 40, 41
Homework #10 due 4/25/03:
Write a Tic-Tac-Toe program that can be played by two players.
Your program must get the dimensions, n, of the board.
Assume n is an odd number and 3 <= n <= 9.
Player 1 is assigned 'X' and player 2 is assigned 'O'.
Your program must get (row,column) coordinates from players 1 and 2,
and display an 'X' or an 'O' in the appropriate location.
The program decides who is the winner or if there is a tie in the game.
Here is sample output:
Enter the board dimensions: 3
Player #1 is X
Player #2 is O
Player #1 moves first.
0 1 2
0: | |
-----
1: | |
-----
2: | |
Player #1 move: 1 1
0 1 2
0: | |
-----
1: |X|
-----
2: | |
Player #2 move: 2 0
0 1 2
0: | |
-----
1: |X|
-----
2:O| |
Player #1 move: 0 0
0 1 2
0:X| |
-----
1: |X|
-----
2:O| |
Player #2 move: 2 2
0 1 2
0:X| |
-----
1: |X|
-----
2:O| |O
Player #1 move: 0 1
0 1 2
0:X|X|
-----
1: |X|
-----
2:O| |O
Player #1 move: 2 1
0 1 2
0:X|X|
-----
1: |X|
-----
2:O|O|O
Game Over!!
Player #2 is the winner.
Homework #9 due 4/11/03:
-
Chapter 4: Problems 9, 22, 33
Homework #8 due 4/4/03:
-
Chapter 4: Problems 10, 15; Extra credit: 20
Homework #7 due 3/21/03:
-
Chapter 3: Problems 45, 46
Homework #6 due 3/14/03:
-
Chapter 3: Problems 29, 32, 40
Homework #5 due 3/7/03:
-
Read Chapter 3 in Deitel/Deitel book.
Chapter 3: Problems 12, 18
Homework #4 due 2/28/03:
-
Chapter 2: Problems
2.38b,
2.54
Homework #3 due 2/21/03:
Homework #2 due 2/14/03:
-
Read Chapter 2 in Deitel/Deitel book.
Chapter 2: Problems 14, 15, 16, 18
Homework #1 due 2/7/03:
-
Read Chapter 1 in Deitel/Deitel book.
Chapter 1: Problems 10-20, 23-25
George Wolberg