# data[].attributes.attachment_link.readable_text
import numpy as np
import pygame
import sys
import math
import random

BLUE = (0, 0, 255)
BLACK = (0, 0, 0)
RED = (255, 0, 0)
YELLOW = (255, 255, 0)

ROW_COUNT = 6
COLUMN_COUNT = 7

def create_board():
    return np.zeros((ROW_COUNT, COLUMN_COUNT))

def drop_piece(board, row, col, piece):
    board[row][col] = piece

def is_valid_location(board, col):
    return board[ROW_COUNT-1][col] == 0

def get_next_open_row(board, col):
    for r in range(ROW_COUNT):
        if board[r][col] == 0:
            return r

def print_board(board):
    print(np.flip(board, 0))

def winning_move(board, piece):
    for c in range(COLUMN_COUNT-3):
        for r in range(ROW_COUNT):
            if board[r][c] == piece and board[r][c+1] == piece and board[r][c+2] == piece and board[r][c+3] == piece:
                return True
    for c in range(COLUMN_COUNT):
        for r in range(ROW_COUNT-3):
            if board[r][c] == piece and board[r+1][c] == piece and board[r+2][c] == piece and board[r+3][c] == piece:
                return True
    for c in range(COLUMN_COUNT-3):
        for r in range(ROW_COUNT-3):
            if board[r][c] == piece and board[r+1][c+1] == piece and board[r+2][c+2] == piece and board[r+3][c+3] == piece:
                return True
    for c in range(COLUMN_COUNT-3):
        for r in range(3, ROW_COUNT):
            if board[r][c] == piece and board[r-1][c+1] == piece and board[r-2][c+2] == piece and board[r-3][c+3] == piece:
                return True

def draw_board(board):
    for c in range(COLUMN_COUNT):
        for r in range(ROW_COUNT):
            pygame.draw.rect(screen, BLUE, (c*SQUARESIZE, r*SQUARESIZE + SQUARESIZE, SQUARESIZE, SQUARESIZE))
            pygame.draw.circle(screen, BLACK, (int(c*SQUARESIZE + SQUARESIZE/2), int(r*SQUARESIZE + SQUARESIZE + SQUARESIZE/2)), RADIUS)
    for c in range(COLUMN_COUNT):
        for r in range(ROW_COUNT):
            if board[r][c] == 1:
                pygame.draw.circle(screen, RED, (int(c*SQUARESIZE + SQUARESIZE/2), height - int(r*SQUARESIZE + SQUARESIZE/2)), RADIUS)
            elif board[r][c] == 2:
                pygame.draw.circle(screen, YELLOW, (int(c*SQUARESIZE + SQUARESIZE/2), height - int(r*SQUARESIZE + SQUARESIZE/2)), RADIUS)
    pygame.display.update()

def animate_drop(board, row, col, piece):
    color = RED if piece == 1 else YELLOW
    for r in range(row + 1):
        draw_board(board)
        pygame.draw.circle(screen, color, (int(col * SQUARESIZE + SQUARESIZE / 2), int(r * SQUARESIZE + SQUARESIZE / 2)), RADIUS)
        pygame.display.update()
        pygame.time.wait(50)

def is_board_full(board):
    for c in range(COLUMN_COUNT):
        if is_valid_location(board, c):
            return False
    return True

def show_start_screen():
    start_screen = pygame.Surface(screen.get_size())
    start_screen.fill(BLACK)
    title_font = pygame.font.SysFont("monospace", 75)
    text_surface = title_font.render("Puissance 4", True, YELLOW)
    text_rect = text_surface.get_rect(center=(width // 2, height // 2 - 100))
    start_screen.blit(text_surface, text_rect)
    instructions_font = pygame.font.SysFont("monospace", 50)
    instructions_text = instructions_font.render("Cliquez pour commencer", True, YELLOW)
    instructions_rect = instructions_text.get_rect(center=(width // 2, height // 2 + 100))
    start_screen.blit(instructions_text, instructions_rect)
    screen.blit(start_screen, (0, 0))
    pygame.display.update()
    waiting = True
    while waiting:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                sys.exit()
            if event.type == pygame.MOUSEBUTTONDOWN:
                waiting = False

def show_message(message, color):
    pygame.draw.rect(screen, BLACK, (0, 0, width, SQUARESIZE))
    label = myfont.render(message, True, color)
    screen.blit(label, (40, 10))
    pygame.display.update()

def ai_move(board, piece):
    valid_locations = [c for c in range(COLUMN_COUNT) if is_valid_location(board, c)]
    col = random.choice(valid_locations)
    row = get_next_open_row(board, col)
    drop_piece(board, row, col, piece)
    return col, row

board = create_board()
print_board(board)
game_over = False
turn = 0

pygame.init()

pygame.mixer.music.load("/home/vadim/Desktop/Tetris-Th��me-Officiel.wav")
pygame.mixer.music.play(-1)  

SQUARESIZE = 100
width = COLUMN_COUNT * SQUARESIZE
height = (ROW_COUNT + 1) * SQUARESIZE
size = (width, height)

RADIUS = int(SQUARESIZE / 2 - 5)

screen = pygame.display.set_mode(size)

show_start_screen()
draw_board(board)
pygame.display.update()

myfont = pygame.font.SysFont("monospace", 75)

while not game_over:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            sys.exit()
        
        if event.type == pygame.MOUSEMOTION:
            pygame.draw.rect(screen, BLACK, (0, 0, width, SQUARESIZE))
            posx = event.pos[0]
            if turn == 0:
                pygame.draw.circle(screen, RED, (posx, int(SQUARESIZE / 2)), RADIUS)
            else:
                pygame.draw.circle(screen, YELLOW, (posx, int(SQUARESIZE / 2)), RADIUS)
            pygame.display.update()
        
        if event.type == pygame.MOUSEBUTTONDOWN:
            pygame.draw.rect(screen, BLACK, (0, 0, width, SQUARESIZE))
            if turn == 0:
                posx = event.pos[0]
                col = int(math.floor(posx / SQUARESIZE))

                if is_valid_location(board, col):
                    row = get_next_open_row(board, col)
                    animate_drop(board, row, col, 1)
                    drop_piece(board, row, col, 1)

                    if winning_move(board, 1):
                        show_message("Player 1 wins!!", RED)
                        game_over = True
            else:
                col, row = ai_move(board, 2)  # L'IA joue son tour
                animate_drop(board, row, col, 2)
                drop_piece(board, row, col, 2)

                if winning_move(board, 2):
                    show_message("Player 2 (AI) wins!!", YELLOW)
                    game_over = True

            if not game_over and is_board_full(board):
                show_message("Match Nul!!", BLACK)
                game_over = True

            print_board(board)
            draw_board(board)

            turn += 1
            turn = turn % 2

            if game_over:
                pygame.time.wait(3000)

# data[].attributes.attachment_link.readable_text
import random
import string
import tkinter as tk
from tkinter import messagebox

def generate_password():
    letters = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
    digits = random.choices(string.digits, k=3)
    special_chars = random.choices(string.punctuation, k=2)
    
    # M��langer les lettres, chiffres et caract��res sp��ciaux
    password_list = letters + digits + special_chars
    random.shuffle(password_list)
    
    # Convertir la liste en cha��ne de caract��res
    password = ''.join(password_list)
    
    return password

def display_password():
    password = generate_password()
    password_entry.delete(0, tk.END)
    password_entry.insert(0, password)
    messagebox.showinfo("Mot de passe g��n��r��", f"Votre mot de passe est : {password}")

# Cr��ation de l'interface graphique
root = tk.Tk()
root.title("G��n��rateur de Mot de Passe")

frame = tk.Frame(root, padx=20, pady=20)
frame.pack(padx=10, pady=10)

label = tk.Label(frame, text="G��n��rateur de Mot de Passe", font=("Arial", 16))
label.pack(pady=10)

password_entry = tk.Entry(frame, width=30, font=("Arial", 14))
password_entry.pack(pady=10)

generate_button = tk.Button(frame, text="G��n��rer", command=display_password, font=("Arial", 14))
generate_button.pack(pady=10)

root.mainloop()

# data[].attributes.body
do

msgbox"SOS SOS SOS SOS SOS SOS SOS SOS "

loop

# data[].attributes.body
Écrivez se que vous voulez améliorer dans les commentaires 😉

# data[].attributes.headline
J'ai pensait a ouvrir un 2ème serveur Minecraft , je le fait

# data[].attributes.subject
J'ai pensait a ouvrir un 2ème serveur Minecraft , je le fait

# data[].attributes.body
1. Oui!!!!!!!!!!!!!!
2.Non,merci
3. ferme ta G*ule
4. Oui ,si tu veux 😑😑😑😑😑

# data[].attributes.attachment_link.description
Cracked servers let non-premium players play with any username they want. They are also called offline-mode servers. This is a list of the best Cracked servers for version 1.9.4.

# data[].attributes.attachment_link.readable_text
myLanguage

Language

Deutsch

English

Español

Français

Polski

Português

Русский

DO YOU REALLY WANT TO THROW THIS ITEM ?

Do not show this message again

DO YOU REALLY WANT TO CANCEL
YOUR CRAFTING?

Do not show this message again

No Aliasing

Safe Throw

Safe Cancel

Auto Feed

Spectator

Quest Alert

Tooltips

# data[].attributes.attachment_link.description
Survive the cold and hunger by collecting resources and crafting tools! Explore the biomes, fight some dragons and find a treasure chest!

# data[].attributes.attachment_caption
Discord - A New Way to Chat with Friends & Communities

# data[].attributes.body
Profil+Num : gaming_boster

# data[].attributes.attachment_link.title
Discord - A New Way to Chat with Friends & Communities

# data[].attributes.attachment_link.description
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.

# data[].attributes.attachment_link.description
Essayez notre plate-forme d’apprentissage à distance gratuitement. Edu propose des écoles en ligne, des cours gratuits et payants, des interrogations en temps réel, des classes privées et bien d’autres fonctionnalités encore...

# data[].attributes.body
il y a beaucoup d'utilisation pour cette commande:

# data[].attributes.attachment_link.description
Roblox is the ultimate virtual universe that lets you create, share experiences with friends, and be anything you can imagine. Join millions of people and discover an infinite variety of immersive experiences created by a global community!

# data[].attributes.body
/give <target> minecraft:light{BlockStateTag: {level:"<int>"}}

# data[].attributes.attachment_link.title
TLauncher — Скачать лаунчер Майнкрафт

# data[].attributes.attachment_link.description
Если вы хотите найти лучший лаунчер Майнкрафт, то рекомендуем скачать TLauncher, который самый лучший среди конкурентов!

# data[].attributes.body
/setblock <X Y Z> (BLOC)

# data[].attributes.body
/fill <X Y Z> <X Y Z> (BLOC )

# data[].attributes.body
Survie :/gamemode 0
Créatif :/gamemode 1
Aventure :/gamemode 2

# data[].attributes.body
/give (personne) minecraft:(bloc)