Underwhelming Python labs (compsci)

Izack

Non sequitur
Addon Developer
Joined
Feb 4, 2010
Messages
6,664
Reaction score
14
Points
113
Location
The Wilderness, N.B.
Today I had a 4-hour lab period in which I was expected to write a program that takes an image and makes it grayscale. We work in a watered-down Python environment running in Java (WHY?!).

Obviously it took about 5 minutes to boot the computer, setup the environment and write a paragraph, then submit it:

Code:
def grayScale(redWeight,greenWeight,blueWeight):
  pic=makePicture(pickAFile())
  show(pic)
  for p in getPixels(pic):
    r = getRed(p)*redWeight #0.299
    g = getGreen(p)*greenWeight #0.587
    b = getBlue(p)*blueWeight #0.114
    lum = r+g+b
    setColor(p,makeColor(lum,lum,lum))
  repaint(pic)
This was four steps beyond what was expected, and done in 1/48th of the alotted time. Hopefully the course won't stay so mundane throughout, or I'm in for a very dull semester.
 
You are in for a dull semester.

By the end you will be doing something very similar but 3 times longer :P
 
Ouch... if you feel underwhelmed, what about doing the output in OpenGL. :D
 
Wonderful news, tl8. Looking forward to the free time. :lol:

Challenge accepted. Eventually. :)
 
Back
Top