Example #1
0
def main():
    clear()
    print("Please set up all needed on the email spam tool path, once is done press enter.{0}".format(RESET))
    a = input()
    if a == "":
        from Tools.Email_Spam_Tool import Emailing
    else:
        print("I told you to press enter")
        exit()
Example #2
0
def main():
    init_sim()

    physics = PhysicsSystem(env_size)
    rendering = RenderingSystem(rad)

    while True:
        draw_frame(rendering, physics)
        draw.show(0.0)
        draw.clear()
Example #3
0
def main():
    clear()
    print("Please connect to a nordvpn account, once is done press enter.{0}".
          format(RESET))
    a = input()
    if a == "":
        from Tools.Traffic_Boost_Tool import Traffic
    else:
        print("I told you to press enter")
        exit()
 def save_3(self, dt=0, img = None, path = None):
     self.busy = False
     if img != None:
         self.current_tool.unselect()
         draw.clear(1,1,1,1)
         graphics.set_color_extra(1,1,1,1)
         graphics.call_thrice(graphics.enter_canvas_mode)
         draw.image_extra(img,graphics.canvas_x+1,graphics.canvas_y+1)
         graphics.call_thrice(graphics.exit_canvas_mode)
         #graphics.call_much_later(self.current_tool.select())
         graphics.call_much_later(self.current_tool.canvas_changed())
Example #5
0
def redraw():
    draw.clear()

    for i in range(speed):
        robot.update()

    for l in lines:
        draw.line(*l)

    robot.draw()
    draw.camera = robot.getPos()
    draw.ontimer(redraw, 1000 // target_frames)
Example #6
0
 def on_draw(self, dt=0):
     if self.keys[key.LEFT]: level.camera_x -= 10
     if self.keys[key.RIGHT]: level.camera_x += 10
     if self.keys[key.UP]: level.camera_y += 10
     if self.keys[key.DOWN]: level.camera_y -= 10
         
     draw.clear()
     pyglet.gl.glPushMatrix()
     self.apply_camera()
     self.draw_level()
     pyglet.gl.glPopMatrix()
     self.draw_tools()
 def open_3(self, dt=0, path=None):
     self.busy = False
     if path != None:
         #self.current_tool.unselect()
         draw.clear(1,1,1,1)
         graphics.set_color_extra(1,1,1,1)
         graphics.call_thrice(graphics.enter_canvas_mode)
         graphics.call_thrice(pyglet.gl.glEnable, pyglet.gl.GL_BLEND)
         self.canvas_image = pyglet.image.load(path)
         draw.image_extra(self.canvas_image,graphics.canvas_x+1,graphics.canvas_y+1)
         graphics.call_thrice(pyglet.gl.glDisable, pyglet.gl.GL_BLEND)
         graphics.call_thrice(graphics.exit_canvas_mode)
         #graphics.call_much_later(self.current_tool.select())
         graphics.call_much_later(self.current_tool.canvas_changed)
Example #8
0
 def draw(self):
     draw.clear(0,0,0,1)
     self.batch.draw()
     if self.typing:
         self.countdown -= env.dt
         if self.countdown <= 0:
             self.update_text()
             sound = resources.text_sounds[self.sender_names[self.msg_num]]
             if self.labels[self.msg_num].text[-1] != ' ':
                 player = pyglet.media.ManagedSoundPlayer()
                 player.pause()
                 player.queue(sound)
                 player.volume = settings.sound_volume*0.1
                 player.play()
             self.countdown += self.char_delay
Example #9
0
def kugel_zurueck_setzen():
    """
    setzt die weisse Kugel auf die Ursprungsposition zurueck
    :return:
    """
    k[0].eingelocht = False
    k[0].x = X_STR_2
    k[0].y = Y_MID
    dir = 1
    while True:
        if k[0].y >= 0.75 - kugel.RADIUS or k[
                0].y <= .25 + BORDER + kugel.RADIUS:
            dir *= -1
        if draw.mouse_pressed():
            if not k[0].overlap(k[1:]):
                break
        k[0].y += dir * .001
        tisch()
        draw.show(1)
        draw.clear()
Example #10
0
def main():
    # Choose between ai and 2-player.
    clear()
    print_title()
    two_player = get_two_player()
    if two_player:
        player_x_func = get_human_move
        player_o_func = get_human_move
    else:
        ai_func = get_ai_func()
        move_first = get_move_first()
        player_x_func = get_human_move if move_first else ai_func
        player_o_func = ai_func if move_first else get_human_move

    # Run games until the player is done.
    play_again = True
    standings = {'X': 0, 'O': 0, 'Tie': 0}
    try:
        while play_again:
            winner = play_game(player_x_func, player_o_func)
            standings[winner] += 1
            play_again = play_another()
    except SystemExit:
        pass

    # Tally results and print a farewell message.
    print ''
    print "Thanks for playing! Results:"
    x_score = standings['X']
    o_score = standings['O']
    player_x_string = 'Team X (%s):' % player_x_func.__doc__
    player_o_string = 'Team O (%s):' % player_o_func.__doc__

    if x_score >= o_score:
        print player_x_string, x_score
        print player_o_string, o_score
    else:
        print player_o_string, o_score
        print player_x_string, x_score
    print "Ties:", standings['Tie']
    print ''
Example #11
0
def main():
    filename = sys.argv[1]
    dt = float(sys.argv[2])

    universe = Universe(filename)
    physics = PhysicsSystem()
    rendering = RenderingSystem()

    while True:
        universe._bodies = physics.increaseTime(universe._bodies, dt)
        draw.clear()
        rendering.render(universe._bodies)
        draw.show(10.0)

    # sec = 60
    # secondsWaited = 0.0
    # while secondsWaited < sec:
    #     universe.increaseTime(dt)
    #     universe.draw()
    #     draw.show(0.0)
    #     secondsWaited += dt

    draw.save("/Users/daviddavitadze/Downloads/universe.jpg")
Example #12
0
def play():

    draw.header(title="Guess The Word")

    secret, shadow = secret_word()

    # max errors are 6
    errors = 0
    hits = 0

    while errors < 6:
        char = input("Letter:").strip().upper()

        draw.clear()
        if char in secret:
            shadow = display(secret, shadow, char)
            hits += 1
        else:
            errors += 1

        draw.body(errors)
        draw.yaml({
            "Hits": hits,
            "Errors": errors,
            # "Word": secret,
            # "Shadow": shadow
        })
        if '?' in shadow:
            draw.word(shadow)
        else:
            draw.word(secret)
            break

    if errors < 6:
        print("Win")
    else:
        print("Lose")
 def __init__(self):
     tool.painting_env = self
     
     #set up undo stack
     self.undo_queue = []
     self.max_undo = 10   #arbitrary
     
     #init buttons
     self.save_button = gui.Button(resources.Button, self.save, 
                                     graphics.width-resources.Button.width-3, 5, text='Save')
     self.open_button = gui.Button(resources.Button, self.open, 
                                     self.save_button.x, resources.Button.height+5, text='Open')
     self.undo_button = gui.ImageButton(resources.Rewind, self.undo, 5, graphics.canvas_y+5)
     
     
     self.fill_outline_button_group = gui.ButtonGroup()
     self.outline_button = gui.PolygonButton(
         None, self.set_outline,
         graphics.width-480, 2, fill=False,
         parent_group=self.fill_outline_button_group,
         width=35, height=35
     )
     self.fill_button = gui.PolygonButton(
         None, self.set_fill,
         graphics.width-480, 37, outline=False,
         parent_group=self.fill_outline_button_group,
         width=35, height=35
     )
     self.fill_outline_button = gui.PolygonButton(
         None, self.set_fill_outline,
         graphics.width-480, 72, parent_group=self.fill_outline_button_group,
         width=35, height=35
     )
     self.fill_outline_button.select()
     
     self.color_button_group = gui.ButtonGroup()
     self.color_fill_button = gui.ColorButton(
         graphics.width-380, 10, 35, 35, 
         parent_group = self.color_button_group, which_color=1
     )
     self.color_line_button = gui.ColorButton(
         graphics.width-380, 65, 35, 35, 
         parent_group = self.color_button_group, which_color=0
     )
     self.color_fill_button.select()
     self.swap_button = gui.ImageButton(
         resources.ColorSwitch, self.swap_colors,
         graphics.width-410, graphics.canvas_y/2-resources.ColorSwitch.height/2
     )
     
     self.buttons = [
         self.save_button, self.open_button, self.swap_button, self.undo_button, 
         self.outline_button, self.fill_button, self.fill_outline_button,
         self.color_fill_button, self.color_line_button
     ]
     
     for button in self.buttons:
         graphics.main_window.push_handlers(button)
     
     #init tool control space
     self.toolbar_group = gui.ButtonGroup()
     tool.controlspace.max_x = self.outline_button.x-5
     tool.controlspace.max_y = graphics.canvas_y
     graphics.main_window.push_handlers(tool.controlspace)
     
     #load tools, make toolbar
     self.toolbar = []
     self.labels = []
     self.toolsize = resources.SquareButton.width
     self.load_tools()
     
     #color picker stuff
     self.colorpicker = colorpicker.ColorPicker(
         graphics.width-340,10,15*12,15*6,step_x=15,step_y=15
     )
     graphics.main_window.push_handlers(self.colorpicker)
     
     #white background
     draw.clear(1,1,1,1);
Example #14
0
from draw import clear, take_input_from_player, check_if_finished, draw_board
from winner import who_wins

# Set a while flag
playing = True

game = [
    [" ", " ", " "],
    [" ", " ", " "],
    [" ", " ", " "],
]

player1 = "X"
player2 = "O"

clear()
draw_board(game)
while playing:

    winner = who_wins(game)
    if check_if_finished(game) and not winner:
        take_input_from_player(player1, game)

    winner = who_wins(game)
    if check_if_finished(game) and not winner:
        take_input_from_player(player2, game)

    if winner:
        playing = False

print("The winner is player {}!\n".format(winner))
Example #15
0
def main():
    pygame.init()

    #screen = pygame.display.set_mode((1200, 1200))

    pygame.mouse.set_visible(1)

    pygame.key.set_repeat(1, 100)

    pygame.display.set_caption("Billard")

    draw.set_canvas_size(1000, 600)

    running = True

    c_bande = 0.02
    c_bande_2 = c_bande * 1000 / 600
    
    #setzt Löcher
    holes = [(0.2,0.25),(0.2,0.75),(0.5,0.25),(0.5,0.75),(0.8,0.25),(0.8,0.75)]
    
    #Initialisiert die Kugeln
    liste = [1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15]
    random.shuffle(liste)

    x = 0
    j = 0
    liste_neu = []
    while x != 7:
        if liste[j] < 9:
            liste_neu.append(liste[j])
            j = j + 1
            x = x + 1
        else:
            j = j + 1

    x = 0
    j = 0
    while x != 7:
        if liste[j] >= 9:
            liste_neu.append(liste[j])
            j = j + 1
            x = x + 1
        else:
            j = j + 1

    for i in liste_neu:
        liste.remove(i)


    c = (((8 * ((((((3**(1/2)) / 2) * c_bande)**2) + ((0.5 * c_bande_2)**2))**(1/2)))**2) - ((4 * c_bande_2)**2))**(1/2)

    startwert_1 = 0.65
    startwert_2 = 0.5


    k_0 = bowl.kugel(0.35, 0.5, 0, 0, c_bande * 0.5, 0)
    k_1 = bowl.kugel(startwert_1, startwert_2, 0, 0, c_bande * 0.5, liste_neu[0])
    k_2 = bowl.kugel(startwert_1 + (c / 8), startwert_2 + (c_bande_2 / 2), 0, 0, c_bande * 0.5, liste_neu[1])
    k_3 = bowl.kugel(startwert_1 + (c / 8), startwert_2 - (c_bande_2 / 2), 0, 0, c_bande * 0.5, liste_neu[7])
    k_4 = bowl.kugel(startwert_1 + (c / 4), startwert_2 + c_bande_2, 0, 0, c_bande * 0.5, liste_neu[8])
    k_5 = bowl.kugel(startwert_1 + (c / 4), startwert_2, 0, 0, c_bande * 0.5, 8)
    k_6 = bowl.kugel(startwert_1 + (c / 4), startwert_2 - c_bande_2, 0, 0, c_bande * 0.5, liste_neu[2])
    k_7 = bowl.kugel(startwert_1 + (3*c / 8), startwert_2 + (1.5 * c_bande_2), 0, 0, c_bande * 0.5, liste_neu[3])
    k_8 = bowl.kugel(startwert_1 + (3*c / 8), startwert_2 + (0.5 * c_bande_2), 0, 0, c_bande * 0.5, liste_neu[9])
    k_9 = bowl.kugel(startwert_1 + (3*c / 8), startwert_2 - (0.5 * c_bande_2), 0, 0, c_bande * 0.5, liste_neu[4])
    k_10 = bowl.kugel(startwert_1 + (3*c / 8), startwert_2 - 1.5 * c_bande_2, 0, 0, c_bande * 0.5, liste_neu[10])
    k_11 = bowl.kugel(startwert_1 + (c / 2), startwert_2 + (2 * c_bande_2), 0, 0, c_bande * 0.5, liste_neu[11])
    k_12 = bowl.kugel(startwert_1 + (c / 2), startwert_2 + c_bande_2, 0, 0, c_bande * 0.5, liste_neu[12])
    k_13 = bowl.kugel(startwert_1 + (c / 2), startwert_2, 0, 0, c_bande * 0.5, liste_neu[5])
    k_14 = bowl.kugel(startwert_1 + (c / 2), startwert_2 - c_bande_2, 0, 0, c_bande * 0.5, liste_neu[13])
    k_15 = bowl.kugel(startwert_1 + (c / 2), startwert_2 - (2 * c_bande_2), 0, 0, c_bande * 0.5, liste_neu[6])

    hole_in = []
    k = [k_0, k_1, k_2, k_3, k_4, k_5, k_6, k_7, k_8, k_9, k_10, k_11, k_12, k_13, k_14, k_15]
    
    #Spieler konfigurieren
    player = []
    player.append(spieler.spieler(0))
    player.append(spieler.spieler(1))
    round_counter = 0
    no_ply = 0
    end = False
    while running:
 #       clock.tick(1000000)
        tisch.tisch()

        kugel_geschw_test = 0
        for i in k:
            if i.v_x or i.v_y != 0:
                kugel_geschw_test += 1

        if kugel_geschw_test == 0:
            queue(k_0,)
            k_0.move()

        #eingelochte Kugeln
        for ply in player:
            ply.draw_holeins()
                
                
        if (k_0 in hole_in) and (kugel_geschw_test == 0):
            check = True
            while(check):
                tisch.tisch()
                draw.set_pen_color(color.WHITE)
                draw._thick_line(0.35, 0.25, 0.35, 0.75, 0.001)
                for kugel in k:
                    kugel.draw_kugel()
                draw.show(1)
                if draw.mouse_pressed():
                    (press_x, press_y) = draw.mouse_position()
                    if 0.25 <= press_y <= 0.75:
                        ueberlagerungstest = 0
                        for i in k:
                            dx = i.x - 0.35
                            dy = (i.y - press_y) * 6 / 10
                            dist = ((dx ** 2) + (dy ** 2)) ** 0.5
                            if dist <= (2 * i.r):
                                ueberlagerungstest = ueberlagerungstest + 1
                        if ueberlagerungstest == 0:
                            hole_in.remove(k_0)
                            k_0 = bowl.kugel(0.35, press_y, 0, 0, c_bande * 0.5, 0)
                            k.append(k_0)
                            check = False
                            
        else:
            if draw.mouse_pressed() and k_0.v_x == k_0.v_y == 0:

                (press_x, press_y) = draw.mouse_position()
                k_0.v_x = (press_x - k_0.x) / 25
                k_0.v_y = (press_y - k_0.y) / 25
                round_counter += 1
          
        #Text Spieleranzeige
        if kugel_geschw_test == 0:
            if not (round_counter % 2 == no_ply):
                hole_in = []
            no_ply = round_counter % 2
            draw.set_pen_color(color.BLACK)
            draw.set_font_size(16)
            draw.set_pen_radius(5)
            draw.text(0.2,0.85,"Spieler "+str(no_ply+1)+" ist an der Reihe")
        
            # Bewegungen durchführen und zeichnen
        for kugel_1 in k:
            kugel_1.move()
            # Zeichnen
            kugel_1.draw_kugel()
            # Kollision
            k_tmp = k.copy()
            k_tmp.remove(kugel_1)
            for kugel_2 in k_tmp:
                if kollision_check(kugel_1, kugel_2):
                    kugel_1.kollision(kugel_2) 
            #Abfrage ob Kugel eingelocht
            for hole in holes :
                if strike_check(kugel_1,hole[0],hole[1],c_bande*0.75):
                    k.remove(kugel_1)
                    hole_in.append(kugel_1)
                    
                        
                    #weist die kugel_art den Spielern durch
                    if player[0].kugel_art == None and player[1].kugel_art == None :
                        if kugel_1.number == 8 :
                            end = True
                            ply = player.copy()
                            ply.remove(ply[no_ply])
                            winner = ply[0]
                        if not kugel_1.number == 0:
                            round_counter += 1    
                        player[no_ply].strike(kugel_1)
                        if no_ply == 0 and player[no_ply].kugel_art == 'voll' :
                            player[1].kugel_art = 'halb'
                        if i == 0 and player[no_ply].kugel_art == 'halb' :
                            player[1].kugel_art = 'voll'
                        if no_ply == 1 and player[no_ply].kugel_art == 'voll' :
                            player[0].kugel_art = 'halb'
                        if no_ply == 1 and player[no_ply].kugel_art == 'halb' :
                            player[0].kugel_art = 'voll'
                    #Schaut welche Kugel eingelocht wurde
                    #bestimmt das Resultat für die Spieler
                    else :
                        #Falls Schwarze Kugel versenkt wurde
                        if kugel_1.number == 8 and not (len(player[no_ply].hole_in) == 7):
                            end = True
                            ply = player.copy()
                            ply.remove(player[no_ply])
                            winner = ply[0]
                        elif kugel_1.number == 8 and len(player[no_ply].hole_in) == 7:
                            end = True
                            winner = player[no_ply]
                        #Falls eine Kugel versenkt wurde die nicht weiß oder Schwarz ist  
                        if not ((kugel_1.number > 8 and player[no_ply].kugel_art == 'halb') or (kugel_1.number < 8 and kugel_1.number > 0 and player[no_ply].kugel_art == 'voll'))                   :
                            if no_ply == 0 and not kugel_1.number == 0 :
                                player[1].strike(kugel_1)
                            if no_ply == 1 and not kugel_1.number == 0 :
                                player[0].strike(kugel_1)
                        else:
                            player[no_ply].strike(kugel_1)
                            round_counter += 1
        
        draw.show(1)
        draw.clear()
        #Bricht die while schleife ab, falls ein Spieler gewonnen hat
        if end :
            break
    #Gibt den gewinner an    
    draw.set_pen_color(color.BLACK) 
    draw.set_font_size(20)
    draw.text(0.5,0.5,"Spieler "+ str(winner.num + 1) + " hat gewonnen")
    draw.show()
Example #16
0
unit_w = int(WIDTH / 3)

windowSurfaceObj = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("Tic Tac Toe")
icon = pygame.image.load("content//a2d.jpg")
pygame.display.set_icon(icon)

play = 0
menu_screen = True
select = False
idle = True
idle2 = True
mute = False
p1_wins, p2_wins, ties = 0, 0, 0

grid_array, val, winner, turns = draw.clear(HEIGHT, WIDTH, windowSurfaceObj)

while True:

    if menu_screen and idle:
        volume = draw.menu(WIDTH, HEIGHT, windowSurfaceObj)
        idle = False
    elif menu_screen == False and select == False and idle2:
        pygame.mixer.music.load('content//Smoothie_Samba.mp3')
        pygame.mixer.music.play(-1, 0.0)
        idle2 = False

    for event in pygame.event.get():
        if event.type == QUIT:
            pygame.quit()
            sys.exit()
Example #17
0
def main():
    """
    Hauptprogram
    - erstellt Fenster und Queue
    - laeuft Spielschleife
    :return:
    """

    draw.set_canvas_size(1000, 1000)
    my_cue = cue.cue()
    kugeln_legen()
    #p[0].ist_am_zug = True
    #current_player = p[0]

    # Spielschleife
    while True:

        tisch()  # Tisch & Kugeln werden gezeichnet
        draw.show(1)

        # Schlagen -------------------------------------------------------------------------------
        if kugeln_stehen_still(k):
            for i in p:
                print(i.points)
                print("")
            if p[0].ist_am_zug:
                p[0].ist_am_zug = False
                p[1].ist_am_zug = True
            else:
                p[1].ist_am_zug = False
                p[0].ist_am_zug = True

            if p[0].ist_am_zug:
                current_player = p[0]
            else:
                current_player = p[1]

            print("{} ist am Zug.".format(current_player.name))

            # weisse Kugel setzen
            if k[0].eingelocht:
                k[0].eingelocht = False
                k[0].x = X_STR_2
                k[0].y = Y_MID
                dir = 1
                while True:
                    draw.clear()
                    tisch()
                    draw.show(1)
                    if draw.mouse_pressed():
                        if not k[0].overlap(k[1:]):
                            break
                    k[0].y += dir * 0.001
                    if .25 + BORDER + kugel.RADIUS >= k[0].y or k[
                            0].y >= 0.75 - kugel.RADIUS:
                        dir *= -1

            while True:
                try:
                    winkel = int(
                        input(
                            "In welchen Winkel (degrees) wollen sie schlagen"))
                except:
                    continue
                my_cue.alpha = math.radians(winkel)
                draw.clear()
                tisch()
                my_cue.draw(k[0])
                draw.show(1)
                try:
                    if str(
                            input(
                                "Wollen Sie in wirklich in {} schlagen".format(
                                    winkel))).lower() == "y":
                        break
                except:
                    pass
            while True:
                try:
                    cue_power = float(
                        input("Wie hart wollen sie schlagen [0,2]?"))
                except:
                    continue
                if 0 > cue_power or cue_power > 2:
                    print("DEPP!")
                    continue

                try:
                    if str(
                            input(
                                "Wollen Sie in wirklich mit {} power schlagen".
                                format(cue_power))).lower() == "y":
                        # animationn weg
                        while my_cue.pow < 0.5 + 2 * cue_power:
                            my_cue.pow += 0.02

                            draw.clear()
                            tisch()
                            my_cue.draw(k[0])
                            draw.show(1)
                        # animation hin
                        while my_cue.pow > 1:
                            my_cue.pow -= 0.2 * cue_power

                            draw.clear()
                            tisch()
                            my_cue.draw(k[0])
                            draw.show(1)

                        k[0].v = my_cue.power(k[0], cue_power)
                        break
                except:
                    pass

        # Rand Kollision -------------------------------------------------------------------------
        for i in range(len(k)):
            if not k[i].eingelocht:
                if math.hypot(k[i].v.x, k[i].v.y) > 0.00001:
                    collision_border(k[i], current_player)
                else:
                    k[i].v = vektor.vektor(0, 0)

                # Kugeln Kollision -----------------------------------------------------------------------
        for i in range(len(k) - 1):
            if not k[i].eingelocht:
                next_collision(k[i])
                # collision_kugel(k[i], k[i + 1:])

        k[len(k) - 1].move()
        # Bewegen der Kugeln ---------------------------------------------------------------------
        #        for i in k:
        #            if not i.eingelocht:
        #                i.move()

        # draw.show(1)  # zeigt alle Objekte fuer 1 ms
        draw.clear()  # leert die Zeichenflaeche