Skip to content
TheChatArchiveThe Chat Archive
gpt-3.5-turbo-0301· openaiHugging Face Suzhen/CodeChat

مرحبا

  1. User

    مرحبا

  2. Assistant

    مرحبا بك! كيف يمكنني مساعدتك اليوم؟

  3. User

    اكتب كود بلغة C للعبة

  4. Assistant

    هذا مثال بسيط عن لعبة حجر ورقة مقص في لغة C:

    #include <stdio.h> 
    #include <stdlib.h> 
    #include <time.h> // تضمين المكتبة المسئولة عن الأوقات العشوائية
    
    int main() 
    { 
        int playerChoice, computerChoice; 
        srand(time(0)); // عرف توقيت بدء البرنامج  
    
        printf("Choose 1 for rock, 2 for paper and 3 for scissors\n"); //تعليمات اللعبة
        scanf("%d", &playerChoice); // ادخال خيار اللاعب
        
        computerChoice = rand() % 3 + 1; // اختيار عشوائي لخيار الكمبيوتر بين 1 و3
    
        if (playerChoice == computerChoice) 
        {
            printf("Tie!"); // في حالة التعادل بين اللاعب والكمبيوتر
        } 
        else if ((playerChoice == 1 && computerChoice == 3) || (playerChoice == 2 && computerChoice == 1) || (playerChoice == 3 && computerChoice == 2)) 
        {
            printf("You win!"); // في حالة فوز اللاعب
        } 
        else 
        {
            printf("Computer wins!"); // في حالة فوز الكمبيوتر
        } 
    
        return 0;
    } 
    

    نأمل أن يكون هذا مفيداً!

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.