コード例 #1
0
ファイル: scale.py プロジェクト: Lotka-github/pyStdDraw
def main(argv):

    fileName = argv[1]
    w = int(argv[2])
    h = int(argv[3])

    source = picture.Picture()
    source.load(fileName)

    target = picture.Picture(w, h)

    for ti in range(w):
        for tj in range(h):
            si = ti * source.width() // w
            sj = tj * source.height() // h
            target.set(ti, tj, source.get(si, sj))

    maxHeight = max(source.height(), target.height())

    stddraw.createWindow(source.width() + target.width(), maxHeight)
    stddraw.setXscale(0, source.width() + target.width())
    stddraw.setYscale(0, maxHeight)

    stddraw.picture(source, source.width() / 2, maxHeight / 2)
    stddraw.picture(target, source.width() + target.width() / 2, maxHeight / 2)

    stddraw.show()
    stddraw.wait()
コード例 #2
0
ファイル: Tile.py プロジェクト: compsci-river/CS-136
    def draw(self, x, y):
        p = picture.Picture("blank.gif")
        if self.lit:
            p = picture.Picture(self.name)
        StdDraw.picture(p, (x + 0.5) * self.SIZE, (y + 0.5) * self.SIZE)

        ##### YOUR CODE HERE #####
        pass
コード例 #3
0
 def MakePattern(p):
     s = eval(input("Please enter a size: "))
     d = eval(input("Please enter a depth: "))
     pic = picture.Picture(s,s)
     x1 = 0
     y1 = 0
     x2 = s
     y2 = s
     if (p == "Bubbles"):
         r = s//4
         Bubbles(pic,x1,y1,x2,y2,r,d)
     elif (p == "Carpet"):
         h = s//3
         Carpet(pic,x1,y1,x2,y2,h,d)
     elif (p == "Gasket"):
         (aX,aY) = (0,s)
         (bX,bY) = (s,s)
         (cX,cY) = ((s//2),0)
         pic.setFillColor(100,200,255)
         pic.setOutlineColor(30,200,255)
         pic.drawPolygonFill(((aX,aY), (bX,bY), (cX,cY)))
         Gasket(pic,aX,aY,bX,bY,cX,cY,d)
     elif (p == "Snowflake"):
         (aX,aY) = ((s//6),((s//3)*2))
         (bX,bY) = (((s//6)*5),((s//3)*2))
         (cX,cY) = ((s//2),(s//6))
         Snowflake(pic,aX,aY,bX,bY,d)
     else:
         print("Sorry! The pattern you entered is invalid.")
     pic.display()
     input()
コード例 #4
0
ファイル: life.py プロジェクト: msimonds/PersonalRepo
def main():
# setting up board stuff
    board = []
    newBoard = []
    for i in range(W):
        board.append([0]*H)
        newBoard.append([0]*H)
    board = boardSetup(board)
    pic = picture.Picture((300,480))
    tiles = []
    pic.setOutlineColor((0,255,0))
    pic.setFillColor((0,0,0))
    for i in range(W):
        tiles.append([0]*H) 
    for x in range(W):
        for y in range(H):
            tiles[x][y] = pic.drawRectFill(x*6,y*6,6,6)
# goes through board and checks if cell is alive, then changes it to red
    for x in range(W):
        for y in range(H):
            if board[x][y] == 1:
                tiles[x][y].changeFillColor((255,0,0))
# goes through iterations of the configurations, displaying at each step
    for i in range (ROUNDS-1):
        pic.display()
        newBoard = liveCount(board,newBoard)
        for l in range(W): # sets newBoard to board then changes color of cells of board
            for p in range(H):
                board[l][p] = newBoard[l][p]
                if board[l][p] == 1:
                    tiles[l][p].changeFillColor((255,0,0))
                if board[l][p] == 0:
                    tiles[l][p].changeFillColor((0,0,0))
    pic.display()
    input()
コード例 #5
0
 def setUp(self):
     self.picture = picture.Picture(1, 1)
     self.picture.show()
     outdated_inspector_id = self.picture.inspector_id
     self.picture.close()
     # oh no!
     self.picture.inspector_id = outdated_inspector_id
コード例 #6
0
ファイル: Avatar.py プロジェクト: compsci-river/CS-136
 def draw(self):
     p = picture.Picture("avatar.gif")
     x = (self.x+0.5)*Tile.SIZE
     y = (self.y+0.5)*Tile.SIZE
     StdDraw.picture(p,x,y)
     if self.timer < 100:
         StdDraw.text(x,y,str(self.hp))
コード例 #7
0
ファイル: Monster.py プロジェクト: compsci-river/CS-136
 def draw(self):
     p = picture.Picture(self.name)
     x = (self.x+0.5)*Tile.SIZE
     y = (self.y+0.5)*Tile.SIZE
     if self.world.tiles[self.x][self.y].getLit():
         StdDraw.picture(p,x,y)
         if self.timer < 3:
             StdDraw.text(x,y,str(self.hp))
コード例 #8
0
    def __init__(self, title, width, height, frame_rate):

        game.Game.__init__(self, title, width, height, frame_rate)

        # create a game instance
        # YOU SHOULD CHANGE THIS TO IMPORT YOUR GAME MODULE
        self.mGame = picture.Picture(width, height)
        return
コード例 #9
0
ファイル: pygame_starter.py プロジェクト: richt3211/CS-1410
    def __init__(self, width, height, fps):

        game_mouse.Game.__init__(self, "Pygame Starter",
                                 width,
                                 height,
                                 fps)
        self.mPicture = picture.Picture ( width, height )
        return
コード例 #10
0
 def test_doesntUseOurServer(self):
     """
     It's possible that the subprocess's server crashes because the port is
     taken, but the client succeeds in connecting to our server in the
     current process. Let's check that this isn't true.
     """
     x = picture.Picture(1, 1)
     # ewww !
     x.inspector_id = int(self.stdout)
     self.assertTrue(x.is_closed())
コード例 #11
0
def draw_screen(main_screen):
    main_screen.fill((0, 0, 0))

    # picture1= picture.Picture(105,15,[250,270],"finallogo.jpg")
    # picture1.draw(main_screen)
    bimage = picture.Picture(0, 0, [600, 600], "icecream.jpeg")
    bimage.draw(main_screen)
    global p1
    p1 = blocks.button([60, 40], [510, 550], (255, 255, 255))
    p1.create(main_screen)
    lp1 = labelclass.Label([510, 550], [60, 40], "Order", 25)
    lp1.createlabel(main_screen)
コード例 #12
0
def length_contraction(
    a
):  #takes in a, the contracted length of the fence, and shows the user how much
    #the fence has contracted with a picture

    print("When Nora looks at the fence, it is contracted to", a, "meters.")

    #####makes canvas for length contraction
    pic = picture.Picture(600, 800)
    pic.setFillColor(20, 60, 160)
    pic.drawRectFill(0, 0, 600, 800)

    #draws 100 m fence
    pic.setFillColor(255, 255, 255)
    for i in range(5):
        pic.drawRectFill(100 + i * 100, 100, 25,
                         200)  #draws vertical slats of fence
        pic.setOutlineColor(225, 225, 225)
        pic.drawPolygonFill([(100 + i * 100, 100), (112.5 + i * 100, 90),
                             (125 + i * 100, 100)])
        #draws triangles that make up the top of each verticle slat

    pic.setFillColor(255, 255, 255)
    pic.setOutlineColor(0, 0, 0)
    pic.drawRectFill(100, 125, 425, 25)  #draws horizontal slats on fence
    pic.drawRectFill(100, 230, 425, 25)  #draws horizontal slats on fence

    #draws length contracted fence
    for i in range(5):
        pic.drawRectFill(
            100 + (i * 100) * (a / 100), 500, 25 * (a / 100), 200
        )  #draws shortened vertical slats of fence, a is the length of the shorter fence
        pic.setOutlineColor(225, 225, 225)
        pic.drawPolygonFill([
            (100 + (i * 100) * (a / 100), 500),
            ((100 + (i * 100) * (a / 100)) + ((a / 100) * 25) / 2, 490),
            ((100 + (i * 100) * (a / 100)) + 25 * (a / 100), 500)
        ])
        #draws triangles that make up the top of each verticle slat while accounting
        #for length contraction

    pic.setFillColor(255, 255, 255)
    pic.setOutlineColor(0, 0, 0)
    pic.drawRectFill(100, 525, 425 * (a / 100),
                     25)  #draws shortened horizontal slats on fence
    pic.drawRectFill(100, 630, 425 * (a / 100),
                     25)  #draws shortened horizontal slats on fence

    pic.display(
    )  #displays picture of normal and contracted fence.  The normal fence is on top,
    #the length contracted fence on the bottom
    input()
コード例 #13
0
ファイル: life.py プロジェクト: shanabrookjody/conways_life
def vissetup():
    global boardvis
    global tiles
    boardvis = picture.Picture(
        (cellsize * h + 1, cellsize * w + 1)
    )  #creating canvas (the +1 is just for the outline on the edge, which would get cut off)
    tiles = []  #creates empty list of lists
    for i in range(h):
        tiles.append([0] * w)
    for i in range(h):  #fills lists with "tile" objects in canvas
        for j in range(w):
            tile = boardvis.drawRectFill(cellsize * i, cellsize * j, cellsize,
                                         cellsize)
            tiles[i][j] = tile
コード例 #14
0
ファイル: nearest_neighbor.py プロジェクト: bambergerz/CNN
    def predict(self, X):
        """

        :param X: X is an N x D array where each row i in N is an example. Each example (image) consists of D / 3
        pixels. Each pixel contains an R, G, and B value where each is between 0 and 255.
        :param y: A 1 dimensional array of size N.
        :return: None
        """
        num_test = len(X)                                           # number of rows (i.e. examples)
        Ypred = [0 * num_test]
        for i in range(num_test):
            # find the nearest training image to the i'th test image
            # Using either Manhattan or Euclidian distance as a metric.
            p1 = picture.Picture(self.X_train[i])
            distances = distance.Manhattan()
コード例 #15
0
 def open_picture_file(self,
                       path,
                       layer,
                       scale,
                       center_x,
                       center_y,
                       select=False,
                       display=True):
     pic = picture.Picture(path, scale, center_x, center_y)
     self.pictures_all.add(pic, layer=layer)
     if select:
         pic.select()
         self.pictures_selected.add(pic, layer=layer)
     if display:
         self.pictures_to_display.add(pic, layer=layer)
コード例 #16
0
def main():
    num = int(input("Enter number of points: "))
    start_time = time.time()
    points = make_points(num)
    fastest = optimize(points)
    elapsed_time = time.time() - start_time
    canvas = picture.Picture(800, 800)
    canvas.setFillColor(0, 0, 0)
    for point in fastest:
        canvas.drawCircleFill(point[0], point[1], 4)
    canvas.setOutlineColor(255, 0, 0)
    for index, point in enumerate(fastest[:-1]):
        canvas.drawLine(point[0], point[1], fastest[index + 1][0],
                        fastest[index + 1][1])
    canvas.display()
    print(elapsed_time)
    input()
コード例 #17
0
def testNN():
    vectors = {}
    print u"Test neuronové sítě:"
    tset = os.listdir(directoryTest)

    for n in tset:
        p = picture.Picture(os.path.join(directoryTest, n))
        v = p.getVector()
        filename = n.split(".")
        vectors[filename[0]] = v

    for k in vectors.keys():
        for i in range(firstLayer):
            for y in range(len(vectors[k])):
                inputPerceptrons[i].setInput(y + 1, vectors[k][y])
            inputPerceptrons[i].computeBaseFunction()
            inputPerceptrons[i].computeOutput()

        for i in range(hiddenLayer):
            for y in range(firstLayer):
                hiddenPerceptrons[i].setInput(y + 1,
                                              inputPerceptrons[y].getOutput())
            hiddenPerceptrons[i].computeBaseFunction()
            hiddenPerceptrons[i].computeOutput()

        for i in range(lastLayer):
            for y in range(hiddenLayer):
                lastPerceptrons[i].setInput(y + 1,
                                            hiddenPerceptrons[y].getOutput())
            lastPerceptrons[i].computeBaseFunction()
            lastPerceptrons[i].computeOutput()

        max = 0.0
        for y in range(lastLayer):
            if max < lastPerceptrons[y].getOutput():
                max = lastPerceptrons[y].getOutput()

        for y in range(lastLayer):
            if int(k[0]) == y:
                if max == lastPerceptrons[y].getOutput():
                    print k, "OK", lastPerceptrons[y].getOutput()
                else:
                    print k, "FAIL", lastPerceptrons[y].getOutput()
コード例 #18
0
ファイル: gamefield.py プロジェクト: mikyman/Public
 def __init__(self, length, height):
     # if 52 >= length*height >= 4
     if (length * height) > 81 or (length * height) < 4:
         raise Exception(
             '\nThe valid range of (LENGTH x HEIGHT) must be between 4 and 81!'
         )
     elif length < 1 or length > 9:
         raise Exception(
             '\nThe valid range of length must be between 1 and 9!')
     elif height < 1 or height > 9:
         raise Exception(
             '\nThe valid range of height must be between 1 and 9!')
     else:
         self.LENGTH = length
         self.HEIGHT = height
         self.picture = picture.Picture(
             (self.LENGTH * self.HEIGHT) // 4, self.LENGTH,
             ((self.LENGTH * self.HEIGHT) % 4) > 1)
         self.state = self.reset_board()
         self.board = self.__init_board()
コード例 #19
0
def main():
    # setting up the board
    board = []
    newBoard = []
    for i in range(WIDTH):
        board.append([0] * HEIGHT)
        newBoard.append([0] * HEIGHT)
    board = boardSetup(board)
    pic = picture.Picture((300, 480))
    tiles = []
    pic.setOutlineColor((0, 255, 0))
    pic.setFillColor((0, 0, 0))
    for i in range(WIDTH):
        tiles.append([0] * HEIGHT)
    for x in range(WIDTH):
        for y in range(HEIGHT):
            tiles[x][y] = pic.drawRectFill(x * 6, y * 6, 6, 6)
# traverses the board and checks if cell is alive, if the cell is alive, then it gets changed to red.
    for x in range(WIDTH):
        for y in range(HEIGHT):
            if board[x][y] == 1:
                tiles[x][y].changeFillColor((255, 0, 0))


# Iterates through each round and displays the progress as it occurs
    for i in range(ROUNDS - 1):
        pic.display()
        newBoard = liveCount(board, newBoard)
        for l in range(
                WIDTH
        ):  # sets newBoard to board then changes color of cells of board
            for p in range(HEIGHT):
                board[l][p] = newBoard[l][p]
                if board[l][p] == 1:
                    tiles[l][p].changeFillColor((255, 0, 0))
                if board[l][p] == 0:
                    tiles[l][p].changeFillColor((0, 0, 0))
    pic.display()
    input()
コード例 #20
0
ファイル: recpic.py プロジェクト: cmccahil/Classwork
def main():
    print("Here are the options:")
    print("   Bubbles")
    print("   Carpet")
    print("   Gasket")
    print("   Snowflake")
    print("   Quit")
    done = False
    while not done:
        #t will stand for the type of design the user wants
        t = input("Which would you like? ")
        size = eval(input("Size: "))
        depth = eval(input("Depth: "))
        canvas = picture.Picture(size, size)
        print(t.lower())
        if t.lower() == "bubbles":
            canvas.setFillColor(255, 125, 0)
            canvas.drawRectFill(0, 0, size, size)
            bubbles(size // 2, size // 2, size // 4, depth, canvas)
        elif t.lower() == "carpet":
            canvas.setFillColor(0, 255, 0)
            canvas.drawRectFill(0, 0, size, size)
            carpet(size // 3, size // 3, size // 3, depth, canvas)
        elif t.lower() == "gasket":
            canvas.setFillColor(255, 255, 0)
            canvas.drawRectFill(0, 0, size, size)
            gasket(0, size, size // 2, 0, size, size, depth, canvas)
        elif t.lower() == "snowflake":
            canvas.setFillColor(190, 40, 180)
            canvas.drawRectFill(0, 0, size, size)
            snowflake(size // 6, 3 * (size // 4), (2 / 3) * size, depth,
                      canvas)
            canvas.display()
        elif t.lower() == "quit":
            done = True
        else:
            print("That is not an option")
コード例 #21
0
ファイル: fileops.py プロジェクト: dvrhax/cornice3
def listdir(path):
    """\
    like os.listdir, but it works also for zipfiles (and in this case it
    returns only files, not subdirs)
    """
    out = []
    if os.path.isdir(path):
        #if os.name == 'nt': l = os.listdir(path) # dircache bug on win32??
        #else: l = dircache.listdir(path)
        l = os.listdir(path)
        for f in l:
            try:
                fullname = os.path.join(path, f)
                info = get_path_info(fullname)
                out.append(picture.Picture(fullname, info))
            except:
                pass
        return out
    elif path.startswith('collection:'):
        print('OK, setting path!', path)
        path = path[11:]
        print('path now:', path)
        if not path or path[0] != '?':
            return []
        params = {}
        for elem in path[1:].split('&'):
            key, val = [urllib.parse.unquote(s) for s in elem.split('=')]
            params[key] = val
        for res in collection.query(params):
            try:
                info = get_path_info(str(res[0]))
                img = picture.Picture(res[0], info)
                img.name = res[1]
                out.append(img)
            except:
                import traceback; traceback.print_exc()
        return out
    else:
        try:
            z, p = path.split('#zip:', 1)
        except ValueError as e:
            # this can happen if path is not a valid path at all (neither a
            # directory nor a valid zipfile...
            return []
        if not zipfile.is_zipfile(z):
            return []
        # otherwise, build the list of files in the archive
        # (no cache for now...)
        zf = zipfile.ZipFile(z)
        #ret = []
        if p and p[-1] != '/': p += '/'
        for name in zf.namelist():
            if name.startswith(p):
                name = name[len(p):]
                if name and '/' not in name:
                    try:
                        fullname = os.path.join(path, name)
                        info = get_path_info(fullname)
                        out.append(picture.Picture(fullname, info))
                    except:
                        pass
                    #print 'adding', name, 'to listdir'
                    #ret.append(name)
        return out #ret
コード例 #22
0
    seedWidth = int(img.shape[0] / 50)
    seedHeight = int(img.shape[1] / 50)
    print(seedWidth)
    print(seedHeight)
    print(img.shape)

    rowCounter = 0

    values = []
    # for every row in img
    for i in range(img.shape[1]):
        if (count == 0):
            for i in range(int(img.shape[1] / seedWidth)):
                values.append([])
        # for every index in the row
        elif (count == seedHeight):
            rowCounter += 1
            count = 0

        for j in range(img.shape[0]):
            # red is i=0 in img[n][m][i] multiply by 0.2126
            # green is i=1 in img[n][m][i] multiply by 0.7152
            # blue is i=2 in img[n][m][i] multiply by 0.0722
            j = j

    #test image
    testPic = ['*', ' ', '+', ' ', ' ', ' ', '*', '#', '#', '#']
    obj = picture.Picture(testPic, 5)

    obj.printPicture()
コード例 #23
0
import stdio
import random
import stddraw
import picture as p
import pygame
pygame.init()
pygame.mixer.init()
score = 0
number_of_moves = 10
hmatches = []
vmatches = []
stddraw.setCanvasSize(1300, 980)
stddraw.setFontSize(70)
stddraw.setXscale(0.0, 8.999)
stddraw.setYscale(0.0, 9.999)
pic1 = p.Picture("strawberry.png")
pic2 = p.Picture("lemon.png")
pic3 = p.Picture("orange.png")
pic4 = p.Picture("pear.png")
pic5 = p.Picture("grapes.png")
pic6 = p.Picture("watermelon.png")
pic7 = p.Picture("background.png")
pic8 = p.Picture("heart.png")
pic9 = p.Picture("star.png")
pic10 = p.Picture("win.png")
pic11 = p.Picture("lose.png")
v_combo1 = pygame.mixer.Sound('v_combo1.ogg')
v_combo2 = pygame.mixer.Sound('v_combo2.ogg')
v_combo3 = pygame.mixer.Sound('v_combo3.ogg')
v_combo4 = pygame.mixer.Sound('v_combo4.ogg')
v_combo5 = pygame.mixer.Sound('v_combo5.ogg')
コード例 #24
0
def main():

    print("Enter '1' to select bubbles.")
    print("Enter '2' to select carpet.")
    print("Enter '3' to select gasket.")
    print("Enter '4' to select snowflake.")

    option = eval(input("Which would you like to select?: "))
    pic = None
    done = False

    if option == 1:

        size = eval(input("Please enter the size of the canvas: "))
        depth = eval(input("Please enter the depth: "))

        pic = picture.Picture(size, size)
        pic.setFillColor(255, 140, 0)
        pic.drawRectFill(0, 0, size, size)
        pic.setFillColor(0, 0, 255)
        pic.setOutlineColor(0, 0, 255)

        bubbles(size, depth, 0, 0, size, size, pic)

    if option == 2:

        size = eval(input("Please enter the size of the canvas: "))
        depth = eval(input("Please enter the depth: "))

        pic = picture.Picture(size, size)
        pic.setFillColor(0, 255, 0)
        pic.drawRectFill(0, 0, size, size)
        pic.setFillColor(255, 0, 0)
        pic.setOutlineColor(255, 0, 0)

        carpet(size, depth, size // 2, size // 2, pic)

    if option == 3:

        size = eval(input("Please enter the size of the canvas: "))
        depth = eval(input("Please enter the depth: "))

        pic = picture.Picture(size, size)
        pic.setFillColor(255, 255, 0)
        pic.drawRectFill(0, 0, size, size)
        pic.setFillColor(0, 0, 255)
        pic.setOutlineColor(0, 0, 255)

        gasket(depth, size // 2, 0, 0, size, size, size, pic)

    if option == 4:

        size = eval(input("Please enter the size of the canvas: "))
        depth = eval(input("Please enter the depth: "))

        pic = picture.Picture(size, size)
        pic.setFillColor(138, 43, 226)
        pic.drawRectFill(0, 0, size, size)
        pic.setFillColor(127, 255, 0)
        pic.setOutlineColor(127, 255, 0)

        pic.setPenWidth(2)
        pic.setPosition(size // 5, 2 * (size // 3))

        pic.rotate(300)
        snowflake((2 * size) // 3, depth, pic)
        pic.rotate(120)
        snowflake((2 * size) // 3, depth, pic)
        pic.rotate(120)
        snowflake((2 * size) // 3, depth, pic)

    pic.display()
    input()
    exit(0)
コード例 #25
0
def pic1(x, y):
    stddraw.picture(picture.Picture("pic1.png"), x, y)
    stddraw.show(0.0)
コード例 #26
0
def picwhite(x, y):
    stddraw.picture(picture.Picture("picwhite.png"), x, y)
    stddraw.show(0.0)
コード例 #27
0
ファイル: Jewel.py プロジェクト: Natherex/Candy-Crush-Clone
 def draw(self, x, y):
     """
     draws the Jewel onto the screen at location (x,y)
     """
     image = picture.Picture(self.image)
     sd.picture(image, x+.5, y+.5)
コード例 #28
0
ファイル: pyramid.py プロジェクト: cmccahil/Classwork
#pyramid.py
#get a number width from the user, as well as the number of bricks tall to make
#the pyramid(n).
#
#Colin McCahill
#09/17/15

import picture
width = eval(input("What is the width of the canvas?"))
n = eval(input("How many bricks tall is the pyramid?"))
canvas = picture.Picture(width, width)
canvas.setFillColor(0, 255, 255)
canvas.drawRectFill(0, 0, width, width)
sidelength = width / n

for i in range(0, n):
    for j in range(n - i):
        startY = (width - (i + 1) * (sidelength))
        startX = ((i * (1 / 2) * sidelength) + sidelength * j)
        canvas.setFillColor(255, 255, 0)
        canvas.drawRectFill(startX, startY, sidelength, sidelength)

canvas.display()
input()
コード例 #29
0
 def __init__(self, width, height):
     self.mWidth = width
     self.mHeight = height
     self.mPicture = picture.Picture(self.mWidth, self.mHeight)
     return
コード例 #30
0
def mosaic(folderName = "img_folder",
		   maxAttempts = ct.MAX_ATTEMPTS,
		   paperSize = ct.SZ_75x50,
		   clusterPow = ct.SZ_CLSTR,
		   padding = ct.DEF_PADDING,
		   color = ct.BCKGRND_CLR,
           debug = False):

	_rld()
	_clearLog()
	pictures = []
	attempt = 0
	minChunkSize = 2**clusterPow
	width = int(round(paperSize[0] / minChunkSize))
	height = int(round(paperSize[1] / minChunkSize))

	# pixel chunk is defined by (lines, columns) format, hence (height, width)
	# when resizing to the closest chunk, keep this in mind
	smallestPixelChunk = (height, width)
	pixelChunks = _getPixelChunk(smallestPixelChunk)
	canvasList = []

	print "pixel chunks: " + str(pixelChunks)

	count = 0
	for path, directory, files in os.walk(folderName):
		for f in files:
			if utils.isImage(f):
				count = count + 1
				p = path + "/" + f
				pictures.append(pct.Picture(f, p, Image.open(p), count))

	print str(len(pictures)) + " pictures to form a mosaic gallery"

	resizedPictures = []
	for i in range(len(pictures)):
		if pictures[i].resizeToClosestChunk(pixelChunks, smallestPixelChunk):
			resizedPictures.append(pictures[i])
		else:
			print "ID: " + str(pictures[i].getID()) + " with name " + pictures[i].getName() +\
				  " could not be resized"
	pictures = resizedPictures

	while not _stopCondition(attempt, maxAttempts):
		attempt = attempt + 1
		print "program at #" + str(attempt) + " attempt ..."
		canvas = ic.ImageCanvas(int(minChunkSize), int(minChunkSize**2), smallestPixelChunk)
		canvas.genMosaicCanvas(pictures)
		if canvas.isComplete():
			canvasList.append(canvas)
			canvas.printClusterCanvas("log", attempt)
	print "... " + str(len(canvasList)) + " completed image canvas"

	if len(canvasList) > 0:
		highest = _getHighest(canvasList)
		highest.printClusterCanvas("", "_highest")
		print str(highest.getCanvasRating()) + " is the highest rating of this simulation"

		pixelCanvas = _pasteImagesInCanvas(paperSize, highest, padding, color, debug)
		_savePixelCanvas(pixelCanvas)
	else:
		print "simulation endend without finding a solution for the problem ..."