these are my instructions:
http://tinman.cs.gsu.edu/~raj/2010/sp10/lab6.html
this is what I have so far:
from myro import *
from random import *
def moveCell(pic1,cell1,pic2,cell2):
x1 = 240*((cell1-1)%3)
y1 = 240*((cell1-1)/3)
x2 = 240*((cell2-1)%3)
y2 = 240*((cell2-1)/3)
for i in range(240):
for j in range(240):
pix1 = getPixel(pic1,x1+i,y1+j)
r,g,b = getRGB(pix1)
color = makeColor(r,g,b)
setPixel(pic2,x2+i,y2+j,color)
def exchangeCell(pic1,cell1,pic2,cell2):
x1 = 240*((cell1-1)%3)
y1 = 240*((cell1-1)/3)
x2 = 240*((cell2-1)%3)
y2 = 240*((cell2-1)/3)
for i in range(240):
for j in range(240):
pix1 = getPixel(pic1,x1+i,y1+j)
r,g,b = getRGB(pix1)
color = makeColor(r,g,b)
setPixel(pic2,x2+i,y2+j,color)
def main():
pic = makePicture("atlantaBraves.jpg")
show(pic,"Original Picture")
occupied = [False,False,False,False,False,False]
scrambledPic = makePicture(720,480)
for i in range(1,7):
cell = input("Cell number (1-6) to exchange:")
if cell == 0:
break
n = randint(1,6)
while occupied[n-1] == True:
n = randint(1,6)
moveCell(pic,i,scrambledPic,n)
occupied[n-1] = True
show(scrambledPic,"Scrambled Picture")
the syntax is right but it still errors me and I can't see what I did wrong! I can't wait until I get a better teacher...