Exemple #1
0
def offset(point):
    # para contar el puntaje de los puntitos que come el pacman
    "Return offset of point in tiles."
    x = (floor(point.x, 20) + 200) / 20
    y = (180 - floor(point.y, 20)) / 20
    index = int(x + y * 20)
    return index
Exemple #2
0
def offset(point):
    "Return offset of point in tiles."
    #utiliza un floor para poder tener un minimo!
    x = (floor(point.x, 20) + 200) / 20
    y = (180 - floor(point.y, 20)) / 20
    index = int(x + y * 20)
    return index
def offset(point):
    """ Return the offset of the point based on the tiles on the game board.
    """
    x = (floor(point.x, 20) + 200) / 20
    y = (180 - floor(point.y, 20)) / 20
    index = int(x + y * 20)
    return index
Exemple #4
0
def tap(x, y):
    x = floor(x, 50)
    y = floor(y, 50)

    if bombs[x, y]:
        end()
        return

    pairs = [(x, y)]

    while pairs:
        x, y = pairs.pop()
        stamp(x, y, counts[x, y])
        display[x, y] = True

        if counts[x, y] != 0:
            break

        for i in (-50, 0, 50):
            for j in (-50, 0, 50):
                if i == j == 0:
                    continue
                pair = x + i, y + j
                if display[pair]:
                    continue
                if counts[pair] == 0:
                    pairs.append(pair)
Exemple #5
0
def tap(x, y):
    global a
    "Respond to screen click at `x` and `y` coordinates."
    x = floor(x, 50)
    y = floor(y, 50)
    a = a - 1
    print("move:" + str(a))
    if a == 0:
        print("gameover")
        sys.exit()

    if bombs[x, y]:
        end()

        return
    pairs = [(x, y)]

    while pairs:
        x, y = pairs.pop()
        stamp(x, y, counts[x, y])
        shown[x, y] = True

        if counts[x, y] == 0:
            for i in (-50, 0, 50):
                for j in (-50, 0, 50):
                    pair = x + i, y + j
                    if not shown[pair]:
                        pairs.append(pair)
Exemple #6
0
def offset(
        point
):  #Regresa la posición del tablero dadas las coordenadas del vector
    "Return offset of point in tiles."
    x = (floor(point.x, 20) + 200) / 20
    y = (180 - floor(point.y, 20)) / 20
    index = int(x + y * 20)
    return index
Exemple #7
0
 def chao_da_celula(self, x, y):
     """ Dadas coordenadas do Turtle (x,y), retorna as coordenadas do início de uma célula.
         Por exemplo, na celula da origem com tamanho 20, a coordenada Turtle (10,10)
         representa o meio da célula. A chamada de função 'chao_da_celula(10, 10)' retorna
         as coordenadas de início dessa célula (0,0)
         Dica: para entender, veja o exemplo da função: 'uso_do_floor()''
     """
     chao_x = int(floor(x, self._tam_celula))
     chao_y = int(floor(y, self._tam_celula))
     return chao_x, chao_y
def offset(point):

    "Return offset of point in tiles."

    x = (floor(point.x, 20) + 200) / 20

    y = (180 - floor(point.y, 20)) / 20

    index = int(x + y * 20)

    return index
Exemple #9
0
def tap(x, y):
    x = floor(x, 100)
    y = floor(y, 100)
    mark = vector(x, y)

    for neighbor in neighbors:
        spot = mark + neighbor

        if spot in tiles and tiles[spot] is None:
            number = tiles[mark]
            tiles[spot] = number
            square(spot, number)
            tiles[mark] = None
            square(mark, None)
def tap(x, y):
    "Swap tile and empty square."
    x = floor(x, 100)
    y = floor(y, 100)
    mark = vector(x, y)

    for neighbor in neighbors:
        spot = mark + neighbor

        if spot in tiles and tiles[spot] is None:
            number = tiles[mark]
            tiles[spot] = number
            square(spot, number)  # second times call
            tiles[mark] = None
            square(mark, None)  # for emptying balti
Exemple #11
0
def tap(x,y):
    x = floor(x, 200)
    y = floor(y, 200)
    tile = vector(x, y)
    index = len(guesses)

    if tile != pattern[index]:
        print("Wrong")
        correct=False

    guesses.append(tile)
    flash(tile)

    if len(guesses) == len(pattern):
        grow()
Exemple #12
0
def tap(x, y):
    "Swap tile and empty square."
    x = floor(x, 100)
    y = floor(y, 100)
    sign = vector(x, y)

    for neighbor in neighbors:
        spot = sign + neighbor

        if spot in tile and tile[spot] is None:
            number = tile[sign]
            tile[spot] = number
            square(spot, number)
            tile[sign] = None
            square(sign, None)
Exemple #13
0
def tap(x, y):  # 사용자의 입력을 받았을 때의 동작을 설정하는 함수
    "Swap tile and empty square."  # 빈 정사각형과 타일을 바꾼다.
    x = floor(x, 100)
    y = floor(y, 100)
    mark = vector(x, y)

    for neighbor in neighbors:  # 인접 타일 swap을 위한 for문
        spot = mark + neighbor

        if spot in tiles and tiles[spot] is None:  # 인접타일이 빈 정사각형일 때 swap
            number = tiles[mark]
            tiles[spot] = number
            square(spot, number)
            tiles[mark] = None
            square(mark, None)
Exemple #14
0
def tap(x, y):
    #Troque a telha e o quadrado vazio
    print x
    print y
    x = floor(x, 100)
    y = floor(y, 100)
    mark = vector(x, y)
    print mark
    for neighbor in neighbors:
        spot = mark + neighbor

        if spot in tiles and tiles[spot] is None:
            number = tiles[mark]
            tiles[spot] = number
            square(spot, number)
            tiles[mark] = None
            square(mark, None)
def tap(x, y):
    onscreenclick(None)
    x = floor(x, 200)
    y = floor(y, 200)
    tile = vector(x, y)
    index = len(guesses)

    if tile != pattern[index]:
        exit()

    guesses.append(tile)
    flash(tile)

    if len(guesses) == len(pattern):
        grow()

    onscreenclick(tap)
Exemple #16
0
def tap(x, y):  
    "Respond to screen tap."
    onscreenclick(None)
    x = floor(x, 200)  #reconising the x coordinate of typed position
    y = floor(y, 200)  #reconising the y coordinate of typed position
    tile = vector(x, y)  #storing the coordinates to tile vector
    index = len(guesses)  #storing the length of the guesses list

    if tile != pattern[index]:  #If the your guessed tile not matching the pattern then exit the game
        exit()

    guesses.append(tile)  #storing your guess to the list
    flash(tile)  #after tapping the respective tile will flash

    if len(guesses) == len(pattern):  #calling grow function if both the list length will same
        grow()

    onscreenclick(tap)
def tap(x, y):
    "Respond to screen tap."
    onscreenclick(None)
    x = floor(x, 200)
    y = floor(y, 200)
    tile = vector(x, y)
    index = len(guesses)

    if tile != pattern[index]:
        exit()

    guesses.append(tile)
    flash(tile)

    if len(guesses) == len(pattern):
        grow()

    onscreenclick(tap)
Exemple #18
0
def tap(x, y):
    "Respond to screen tap."
    #print("X: "+str(x)+" Y: "+str(y))
    onscreenclick(None)
    x = floor(x, 200)
    y = floor(y, 200)
    tile = vector(x, y)
    index = len(guesses)

    if tile != pattern[index]:
        print("Wrong")
        #exit()

    guesses.append(tile)
    flash(tile)

    if len(guesses) == len(pattern):
        grow()
    print("I am in tap")
    onscreenclick(tap)
    def tap(self, x, y):
        "Respond to screen tap."
        onscreenclick(None)
        x = floor(x, 200)
        y = floor(y, 200)
        tile = vector(x, y)
        index = len(self.guesses)

        if tile != self.pattern[index]:
            root = Tk()
            w = 500  # width for the Tk root
            h = 500  # height for the Tk root

            # get screen width and height
            ws = root.winfo_screenwidth()  # width of the screen
            hs = root.winfo_screenheight()  # height of the screen

            # calculate x and y coordinates for the Tk root window
            x = (ws / 2) - (w / 2)
            y = (hs / 2) - (h / 2)

            # set the dimensions of the screen
            # and where it is placed
            root.geometry('%dx%d+%d+%d' % (w, h, x, y))
            root.title("Simon Says Test")
            global leng
            if leng < 4:
                Label(root, text="ID").place(x=250, y=250)
            else:
                Label(root, text="Not ID").place(x=250, y=250)
            Button(root, text="Next", command=exit).place(x=250, y=400)

        self.guesses.append(tile)
        self.flash(tile)

        if len(self.guesses) == len(self.pattern):
            self.grow()

        onscreenclick(self.tap)
def tap(x, y):
    "Respond to screen click at `x` and `y` coordinates."
    x = floor(x, 50)
    y = floor(y, 50)

    if bombs[x, y]:
        end()
        return

    pairs = [(x, y)]

    while pairs:
        x, y = pairs.pop()
        stamp(x, y, counts[x, y])
        shown[x, y] = True

        if counts[x, y] == 0:
            for i in (-50, 0, 50):
                for j in (-50, 0, 50):
                    pair = x + i, y + j
                    if not shown[pair]:
                        pairs.append(pair)
def tap(x: int, y: int):
    "Respond to screen click at `x` and `y` coordinates."
    x = floor(x, 50)
    y = floor(y, 50)

    if bombs[x, y]:
        end()
        return

    pairs = [(x, y)]

    while pairs:
        x, y = pairs.pop()
        stamp(x, y, counts[x, y])
        shown[x, y] = True

        if counts[x, y] == 0:
            for i in (-50, 0, 50):
                for j in (-50, 0, 50):
                    pair = x + i, y + j
                    if not shown[pair]:
                        pairs.append(pair)
def tap(x, y):
    "Swapping tile and empty square."
    x = floor(x, 100)
    y = floor(y, 100)
    mark = vector(x, y)  #storing the passed values into marks

    for neighbor in neighbors:
        spot = mark + neighbor  #finding the empty spot from neighours list.

        if spot in tiles and tiles[
                spot] is None:  #if the neighour of tile you pressed is empty then only we go for swapping
            number = tiles[
                mark]  #storing the tile mark number to the number variable
            tiles[
                spot] = number  #then we assign the number into the spot tile(empty tile)
            square(
                spot, number
            )  #calling square function for making square in spot position and fill the number
            tiles[
                mark] = None  #we assign the none into the mark tile(tile in which we tapped)
            square(
                mark, None
            )  #calling square function for making square in mark position and fill the number none
Exemple #23
0
def offset(point):
    x = (floor(point.x, 20) + 200) / 20
    y = (180 - floor(point.y, 20)) / 20
    index = int(x + y * 20)
    return index
Exemple #24
0
def delocamento(pontos):
    x = (floor(pontos.x, 20) + 200) / 20
    y = (180 - floor(pontos.y, 20)) / 20
    index = int(x + y * 20)
    return index
Exemple #25
0
def offset(point):
    "Devuelve el desplazamiento del punto en mosaicos."
    x = (floor(point.x, 20) + 200) / 20
    y = (180 - floor(point.y, 20)) / 20
    index = int(x + y * 20)
    return index
Exemple #26
0
def tap(x, y):
    "Swap tile and empty square."
    global current_digit_number
    temp = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
    x = int(floor(x, 50))
    y = int(floor(y, 50))
    mark = vector(x, y)
    #print("tap", x, y)

    if (y >= 250 and y < 300 and x >= -250 and x < 250):
        # fill color to white
        update_number()
        current_digit_number = number[mark]
        current_digit_vector = mark
        square(mark, number[mark], 'black', 'yellow')
        number_change[(x, y)] = 1
        #print("current digit number", current_digit_number)
    elif (y >= -250 and y < 200 and x >= -250 and x < 200):
        if checkIfUnchangedPos(mark):
            return
        initTilesChange()
        #print("tiles_change", tiles_change)
        tiles[mark] = current_digit_number
        #square(mark, tiles[mark], 'black', 'pink')
        #tiles_change[(x,y)] = [1,'black', 'pink']
        copyList((x, y), [1, 'black', 'pink'])
        #print("tiles_change tap", tiles_change)

        i, j = vec2rowcol(mark)
        row = 'row' + str(j)
        col = 'col' + str(i)
        squ = 'square' + str(int(j / 3)) + str(int(i / 3))
        for vec in block[row]:
            if (tiles[vec] == current_digit_number) and (tiles[vec]
                                                         is not None):
                #square(vec, tiles[vec], 'red', 'pink')
                #tiles_change[(vec.x,vec.y)] = [1, 'red', 'pink']
                copyList((vec.x, vec.y), [1, 'red', 'pink'])
            else:
                #square(vec, tiles[vec], 'black', 'pink')
                #"tiles_change[(vec.x,vec.y)] = [1, 'black', 'pink']
                copyList((vec.x, vec.y), [1, 'black', 'pink'])
            if tiles[vec] is not None:
                temp[tiles[vec]] = 1
        #print("tiles_change row", tiles_change)
        for vec in block[col]:
            if (tiles[vec] == current_digit_number) and (tiles[vec]
                                                         is not None):
                #square(vec, tiles[vec], 'red', 'pink')
                #tiles_change[(vec.x,vec.y)] = [1,'red', 'pink']
                copyList((vec.x, vec.y), [1, 'red', 'pink'])
            else:
                #square(vec, tiles[vec], 'black', 'pink')
                #tiles_change[(vec.x,vec.y)] = [1,'black', 'pink']
                copyList((vec.x, vec.y), [1, 'black', 'pink'])
            if tiles[vec] is not None:
                temp[tiles[vec]] = 1
        for vec in block[squ]:
            if (tiles[vec] == current_digit_number) and (tiles[vec]
                                                         is not None):
                #tiles_change[(vec.x,vec.y)] = [1, 'red', 'pink']
                copyList((vec.x, vec.y), [1, 'red', 'pink'])
            else:
                #tiles_change[(vec.x,vec.y)] = [1, 'black', 'pink']
                copyList((vec.x, vec.y), [1, 'black', 'pink'])
            if tiles[vec] is not None:
                temp[tiles[vec]] = 1
        update_tiles()

        for vec in number:
            if (number[vec] is not None) and temp[number[vec]] != 0:
                square(vec, number[vec], 'black', 'grey')
                number_change[(vec.x, vec.y)] = 1
    else:
        initTilesChange()
        update_tiles()
Exemple #27
0
def square(x, y):
                            "Draw square using path at (x, y)."
    path.up()
    path.goto(x, y)
    path.down()
    path.begin_fill()

    for count in range(4):
        path.forward(20)
        path.left(90)

    path.end_fill()

def offset(point):
                                             "Return offset of point in tiles."
    x = (floor(point.x, 20) + 200) / 20
    y = (180 - floor(point.y, 20)) / 20
    index = int(x + y * 20)
    return index

def valid(point):
                                            "Return True if point is valid in tiles." #Define walls and borders
    index = offset(point)

    if tiles[index] == 0:
        return False

    index = offset(point + 19)

    if tiles[index] == 0:
        return False
def offset(point):
    """Return tile index, from the grid cordinates"""
    x = (floor(point.x, 20) + 200) / 20
    y = (180 - floor(point.y, 20)) / 20
    index = int(x + y * 20)
    return index
Exemple #29
0
 def determine_board_pos(self, point):  # static method for check_move
     x = (floor(point.x, 20) + 200) / 20
     y = (180 - floor(point.y, 20)) / 20
     board_pos = int(x + y * 20)
     return board_pos
 def get_offset(self, position):
     x = (floor(position.x, 20) + 200) / 20
     y = (180 - floor(position.y, 20)) / 20
     offset = int(x + y * 20)
     return offset
Exemple #31
0
def offset(point): #Función para posicionar los puntos, pacman y fantasmas, ajustando sus coordenadas para que queden dentro del path
    "Return offset of point in tiles."
    x = (floor(point.x, 20) + 200) / 20
    y = (180 - floor(point.y, 20)) / 20
    index = int(x + y * 20)
    return index
Exemple #32
0
def yemOlustur(konum):
    "Return offset of point in tiles."
    x = (floor(konum.x, 20) + 200) / 20
    y = (180 - floor(konum.y, 20)) / 20
    index = int(x + y * 20)
    return index
Exemple #33
0
def offset(point):
    "Return offset of point in tiles."
    x = (floor(point.x, 20) + 200) / 20
    y = (180 - floor(point.y, 20)) / 20
    index = int(x + y * 20)
    return index