الانتقال إلى المحتوى
View in the app

A better way to browse. Learn more.

مجموعة مستخدمي أوراكل العربية

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

لغه سي شارب تصميم لعبه Tic Tac Toe

Featured Replies

بتاريخ:

اريد كود بلغه سي شاررب بحيث يتم تصميم لعبه الاكس او يتم اللعب مع الجهاز بشكل توماتيكي لو تكرمتو باعطائي الكود لاني صممت هذا الكود لكن انا اقوم بعمليه اللعب وحدي فقط وانا اريد الكود بيني وبين الجهاز

 

 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
 
namespace tic_tak_toe__x_and_o__
{
    public partial class Form1 : Form
    {
        Button[,]bttn=new Button[3,3];
        enum gametype { x, o };
        gametype currengame = gametype.x;
        int count = 0;
 
        
        public Form1()
        {
            InitializeComponent();
 
            bttn[0, 0] = btn00; bttn[0, 1] = btn01; bttn[0, 2] = btn02;
 
            bttn[1, 0] = btn10; bttn[1, 1] = btn11; bttn[1, 2] = btn12;
 
            bttn[2, 0] = btn20; bttn[2, 1] = btn21; bttn[2, 2] = btn22;
            clearall();
            
        }
 
        private void clearall()
        {
            foreach (Button b in bttn)
               b.Text="";
 
            count = 0;
        }
 
        private void Form1_Load(object sender, EventArgs e)
        {
 
        }
 
        private void buttnplay_Click(object sender, EventArgs e)
        {
            Button btn = sender as Button;
            if (btn.Text != "") return;
            btn.Text = currengame.ToString();
            count = count + 1;
            if (iswin())
            {
                MessageBox.Show("Carp you've won");
            clearall();
            return;
 
            }
            if (count == 9)
            {
                MessageBox.Show("tie");
                clearall();
            }
            switchGame();
        }
 
        private bool iswin()
        {
            for (int r = 0; r <= 2; r++)
            {
                int samegame = 0;
                for (int c = 0; c <= 2; c++)
                {
                    if (bttn[r, c].Text == currengame.ToString()) samegame = samegame + 1;
                }
                if (samegame == 3)
                {
                    return true;
                }
            }
           
                for (int c = 0; c <= 2; c++)
                {
                    int samegame = 0;
                    for (int r = 0; r <= 2; r++)
                    {
                        if (bttn[r, c].Text == currengame.ToString()) samegame = samegame + 1;
                    }
                    if (samegame == 3)
                    {
                        return true;
                    }
                }
                if (bttn[0, 0].Text == currengame.ToString() &&
                    bttn[1, 1].Text == currengame.ToString() &&
                    bttn[2, 2].Text == currengame.ToString()) return true;
 
 
                if (bttn[0, 2].Text == currengame.ToString() &&
                    bttn[1, 1].Text == currengame.ToString() &&
                    bttn[2, 0].Text == currengame.ToString()) return true;
                return false;
            }
       
        private void switchGame()
        {
            if (currengame == gametype.x)
                currengame = gametype.o;
            else
                currengame = gametype.x;
        }
 
        private void button8_Click(object sender, EventArgs e)
        {
 
        }
    }
}
 
بتاريخ:

المنتدى خاص باوراكل

انضم إلى المناقشة

يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.

زائر
أضف رد على هذا الموضوع...

برجاء الإنتباه

بإستخدامك للموقع فأنت تتعهد بالموافقة على هذه البنود: سياسة الخصوصية

Account

Navigation

البحث

إعداد إشعارات المتصفح الفورية

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.