Beispiel #1
0
def check_drop():
    from Main import random_object
    global Gameboard
    global Gameboard_size
    drop_found = False
    for tmpy in range(2, Gameboard_size + 1):
        #Start at the bottom so that elements above will
        #drop down when the ones below them do so
        y = Gameboard_size - tmpy
        for x in range(0, Gameboard_size):
            obj = Gameboard[x][y]
            if obj is None:
                if y is 0:
                    newobj = random_object()
                    move_element(newobj, x, 0)
                    drop_found = True
                continue
            if Gameboard[x][y + 1] is None:
                drop_found = True
                move_element(obj, x, y + 1)
                Gameboard[x][y] = None
                if y is 0:
                    newobj = random_object()
                    move_element(newobj, x, 0)
    return drop_found
Beispiel #2
0
def random_Gameboard():
    from Main import random_object
    global Gameboard_size
    global Gameboard
    global image_size
    global game_started
    for x in range(0, Gameboard_size):
        for y in range(0, Gameboard_size):
            obj = random_object()
            Gameboard[x][y] = obj
    ## Don't let any matches exist when the board is created
    check_adjacency(3)
    fill_empty_spaces(3)
    game_started = True