This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from pynput import mouse | |
| from time import sleep | |
| import pynput | |
| mouse_positions = [] | |
| def get_mouse_clicks(max_clicks=4): | |
| counter = 0 | |
| def on_click(x, y, button, pressed): | |
| nonlocal counter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # pip install pymupdf | |
| import fitz # PyMuPDF | |
| import io | |
| from PIL import Image | |
| def extract_images_from_pdf(pdf_path, output_folder): | |
| # Open the PDF file | |
| pdf_file = fitz.open(pdf_path) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from flask import Flask | |
| app = Flask(__name__) | |
| @app.route('/') | |
| def hello_world(): | |
| return 'Hello, World!' | |
| app.run(host="0.0.0.0", port="8000") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pygad | |
| import threading | |
| class PygadThread(threading.Thread): | |
| def __init__(self): | |
| super().__init__() | |
| def run(self): | |
| ga_instance = pygad.GA(num_generations=200000, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def fitness_func(solution, solution_idx): | |
| global SCREEN, playery, pipeHeight, playerx, upperPipes, lowerPipes, GAME_SPRITES, playerVelY, playerFlapAccv, playerFlapped, playerMaxVelY, playerAccY, playerHeight, GROUNDY, nearest_upper_pipe, nearest_lower_pipe | |
| if solution < 0: | |
| return -8888 | |
| if solution > GROUNDY - 25: | |
| return -9999 | |
| fitness_ground = abs(solution - GROUNDY) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import random # For generating random numbers | |
| import sys # We will use sys.exit to exit the program | |
| import pygame | |
| from pygame.locals import * # Basic pygame imports | |
| import pygad | |
| import threading | |
| class PygadThread(threading.Thread): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import socket | |
| import pickle | |
| import numpy | |
| import pygad | |
| import nn | |
| import gann | |
| import kivy.app | |
| import kivy.uix.button |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import socket | |
| import pickle | |
| import numpy | |
| import threading | |
| import pygad | |
| import nn | |
| import gann | |
| class RecvThread(threading.Thread): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import kivy.app | |
| import kivy.uix.button | |
| import kivy.uix.label | |
| import kivy.uix.boxlayout | |
| import kivy.uix.textinput | |
| import threading | |
| class ClientApp(kivy.app.App): | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ClientApp(kivy.app.App): | |
| def build(self): | |
| self.create_socket_btn = kivy.uix.button.Button(text="Create Socket") | |
| self.server_ip = kivy.uix.textinput.TextInput(hint_text="Server IPv4 Address", text="localhost") | |
| self.server_port = kivy.uix.textinput.TextInput(hint_text="Server Port Number", text="10000") | |
| self.server_info_boxlayout = kivy.uix.boxlayout.BoxLayout(orientation="horizontal") | |
| self.server_info_boxlayout.add_widget(self.server_ip) |
NewerOlder