Kosam5 / 5tools

web5
1 stars 0 forks source link

Jac #1

Open Kosam5 opened 5 months ago

Kosam5 commented 5 months ago

import pygame from pygame.locals import * import random from cards import distribute_cards, handle_card from pieces import pieces from board import board_size

تهيئة Pygame

pygame.init()

إعدادات الشاشة

screen = pygame.display.set_mode((800, 600)) pygame.display.set_caption("Jackaroo")

الألوان

WHITE = (255, 255, 255) BLACK = (0, 0, 0) RED = (255, 0, 0) GREEN = (0, 255, 0) BLUE = (0, 0, 255)

players = ["المالك سعود", "Player 2", "Player 3", "Player 4"] current_player = 0

إعداد اللعبة

dealer_index = 0 hands = distribute_cards(dealer_index, players) current_player = (dealer_index + 1) % 4

الحلقة الرئيسية للعبة

running = True while running: for event in pygame.event.get(): if event.type == pygame.QUIT: running = False

    if event.type == pygame.KEYDOWN:
        if event.key == pygame.K_SPACE:
            if hands[players[current_player]]:
                card = hands[players[current_player]].pop(0)
                print(f"{players[current_player]} drew card: {card}")
                handle_card(players[current_player], card, pieces, board_size, screen)
                current_player = (current_player + 1) % 4
            else:
                dealer_index = (dealer_index + 1) % 4
                hands = distribute_cards(dealer_index, players)
                current_player = (dealer_index + 1) % 4

# تحديث الشاشة
screen.fill(WHITE)
pygame.display.flip()

pygame.quit()