16 Haziran 2013 Pazar

C Sharp Uygulamalar Mayın Tarlası Oyunu



KONU : C Sharp ( C# ) Form da mayın tarlası oyunu hazırlama, mayın tarlası oyunu , c sharp mayın tarlası oyun uygulaması
ETİKETLER : C Sharp Oyun | c sharp oyun örnekleri | c sharp oyun yapma | c sharp oyun kodları | csharp oyun programlama | csharp örnek oyun | csharp örnek projeler | csharp örnek programlar| c sharp örnek kodlar | csharp örnek kodları | c sharp örnekleri | csharp örnek | c sharp oyun programları | c# oyun | c# oyun yapımı | c# oyun programlama | c# oyun kodları | c# oyun örnekleri | | c# oyun örnekleri indir | c# örnek oyun | c# mayın tarlası | c sharp mayın tarlası | c sharp mayın tarlası oyunu | c sharp mayın tarlası oyunu yapma | c# mayın tarlsı yapma | c# mayın tarlası kodları | c# mayın tarlası indir | c sharp mayın tarlası oyna | mayın tarlası oyna.




UYGULAMAYI İNDİR




using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace DinamiKontrol
{
    /// 
    /// Summary description for Form1.
    /// 
    public class Form1 : System.Windows.Forms.Form
    {
        private System.Windows.Forms.MainMenu mainMenu1;
        private System.Windows.Forms.MenuItem menuItem1;
        private System.Windows.Forms.MenuItem menuItem2;
        private System.Windows.Forms.MenuItem menuItem3;
        private System.Windows.Forms.MenuItem menuItem4;
        private System.Windows.Forms.MenuItem menuItem9;
        private System.Windows.Forms.MenuItem menuItem10;
        private System.Windows.Forms.MenuItem menuItem11;
        private int Boyut1;
        private int Boyut2;
        
        private int En;
        private int Boy;
        private ArrayList Butonlar;
        int[] t = new int[225];
        int[] tt = new int[100];
        int sabit = 0,bombasayı=0;
        private int limit;

        public int A;
        public int bBlue;
        public int bRed;
        public int bGreen;
        public bool _Red;
        public bool _Green;
        public bool _Blue;

        private System.Windows.Forms.MenuItem menuItem12;
        private MenuItem menuItem16;
        private Button Başla;
        private Label kalanbomba;
        private IContainer components;

        public Form1()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            this.En = 20;
            this.Boy = 20;
            this.Boyut1 = 8;
            this.Boyut2 = 8;
          


            this.A = 8;
            this.bBlue = 255;
            this.bGreen = 255;
            this.bRed = 255;

            this._Blue = true;
            this._Green = true;
            this._Red = true;

            Butonlar = new ArrayList();

            bombasayısı();
            
        }

        /// 
        /// Clean up any resources being used.
        /// 
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (components != null)
                {
                    components.Dispose();
                }
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code
        /// 
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// 
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
            this.mainMenu1 = new System.Windows.Forms.MainMenu(this.components);
            this.menuItem1 = new System.Windows.Forms.MenuItem();
            this.menuItem2 = new System.Windows.Forms.MenuItem();
            this.menuItem4 = new System.Windows.Forms.MenuItem();
            this.menuItem3 = new System.Windows.Forms.MenuItem();
            this.menuItem9 = new System.Windows.Forms.MenuItem();
            this.menuItem10 = new System.Windows.Forms.MenuItem();
            this.menuItem11 = new System.Windows.Forms.MenuItem();
            this.menuItem16 = new System.Windows.Forms.MenuItem();
            this.menuItem12 = new System.Windows.Forms.MenuItem();
            this.Başla = new System.Windows.Forms.Button();
            this.kalanbomba = new System.Windows.Forms.Label();
            this.SuspendLayout();
            // 
            // mainMenu1
            // 
            this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
            this.menuItem1});
            // 
            // menuItem1
            // 
            this.menuItem1.Index = 0;
            this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
            this.menuItem2,
            this.menuItem3,
            this.menuItem12});
            this.menuItem1.Text = "Ayarlar";
            // 
            // menuItem2
            // 
            this.menuItem2.Index = 0;
            this.menuItem2.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
            this.menuItem4});
            this.menuItem2.Text = "Kare Boyutu";
            // 
            // menuItem4
            // 
            this.menuItem4.Index = 0;
            this.menuItem4.Text = "20";
            this.menuItem4.Click += new System.EventHandler(this.YenidenCiz);
            // 
            // menuItem3
            // 
            this.menuItem3.Index = 1;
            this.menuItem3.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
            this.menuItem9,
            this.menuItem10,
            this.menuItem11,
            this.menuItem16});
            this.menuItem3.Text = "Tahta Boyutu";
            // 
            // menuItem9
            // 
            this.menuItem9.Index = 0;
            this.menuItem9.Text = "6X6";
            this.menuItem9.Click += new System.EventHandler(this.YenidenCiz2);
            // 
            // menuItem10
            // 
            this.menuItem10.Index = 1;
            this.menuItem10.Text = "8X8";
            this.menuItem10.Click += new System.EventHandler(this.YenidenCiz2);
            // 
            // menuItem11
            // 
            this.menuItem11.Index = 2;
            this.menuItem11.Text = "10X10";
            this.menuItem11.Click += new System.EventHandler(this.YenidenCiz2);
            // 
            // menuItem16
            // 
            this.menuItem16.Index = 3;
            this.menuItem16.Text = "15X15";
            this.menuItem16.Click += new System.EventHandler(this.YenidenCiz2);
            // 
            // menuItem12
            // 
            this.menuItem12.Index = 2;
            this.menuItem12.Text = "Renk";
            this.menuItem12.Click += new System.EventHandler(this.menuItem12_Click);
            // 
            // Başla
            // 
            this.Başla.Location = new System.Drawing.Point(30, 0);
            this.Başla.Name = "Başla";
            this.Başla.Size = new System.Drawing.Size(130, 20);
            this.Başla.TabIndex = 0;
            this.Başla.Text = "Başla";
            this.Başla.UseVisualStyleBackColor = true;
            this.Başla.Click += new System.EventHandler(this.YenidenCiz3);
            // 
            // kalanbomba
            // 
            this.kalanbomba.Location = new System.Drawing.Point(0, 0);
            this.kalanbomba.Name = "kalanbomba";
            this.kalanbomba.Size = new System.Drawing.Size(30, 20);
            this.kalanbomba.TabIndex = 1;
            // 
            // Form1
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.CausesValidation = false;
            this.ClientSize = new System.Drawing.Size(483, 256);
            this.Controls.Add(this.kalanbomba);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.MaximizeBox = false;
            this.Menu = this.mainMenu1;
            this.Name = "Form1";
            this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
            this.Text = "Mayın Tarlası";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.MouseClick += new System.Windows.Forms.MouseEventHandler(this.tb_MouseDown);
            this.ResumeLayout(false);

        }
        #endregion

        /// 
        /// The main entry point for the application.
        /// 
        [STAThread]
        static void Main()
        {
            Application.Run(new Form1());
        }
      
        private void Form1_Load(object sender, System.EventArgs e)
        {
            TahtaCiz(Boyut1, Boyut2, En, Boy);
        }
        private void TahtaCiz(int Boyut1, int Boyut2, int En, int Boy)
        {
          
            this.Controls.Add(Başla);
            Başla.TabStop = false;
            int satir = 0;
            int sutun = 0;
            
            for (int i = 0; i < Boyut1 * Boyut2; i++)
            {
                if (i % Boyut2 == 0)
                {
                    satir++;
                    sutun = 0;
                }
                Button tb = new Button();
                tb.Name = i.ToString();
                tb.TabIndex = i;
                tb.Text = "";
                tb.Size = new System.Drawing.Size(En, Boy);
                Point p = new System.Drawing.Point(tb.Size.Width + (sutun - 1) * tb.Width,20+tb.Size.Height + (satir - 2) * tb.Height);
                tb.Location = p;
                tb.FlatStyle = FlatStyle.Standard;
               // tb.Click += new System.EventHandler(this.buttonClick);
                tb.MouseDown += new MouseEventHandler(this.tb_MouseDown);
       
                Butonlar.Add(tb);
                this.Controls.Add(tb);
                //if(i==1)
                this.ClientSize = new Size(tb.Width * Boyut2, 20+tb.Height * Boyut1);
                sutun++;
             
           
            }

            for (int h = 0; h < Boyut1 * Boyut2; h++)
            {
                ((Button)Butonlar[h]).TabStop = false;

            }   
            Butonlar.TrimToSize();
            RenkAyarla();
        }

        private void Temizle()
        {
            this.Controls.Clear();
            for (int g = 0; g < 225; g++)
                t[g] = 0;
        }

        public void RenkAyarla()
        {
            int satir = 0;
            int sutun = 0;

            for (int i = 0; i < Boyut1 * Boyut2; i++)
            {
                if (i % Boyut2 == 0)
                {
                    satir++;
                    sutun = 0;
                }
                if (_Red)
                    bRed = (((int)(255 / Boyut1 * A)) * satir + ((int)(255 / Boyut2 * A)) * sutun) % 255;
                if (_Green)
                    bGreen = (((int)(255 / Boyut1 * A)) * satir + ((int)(255 / Boyut2 * A)) * sutun) % 255;
                if (_Blue)
                    bBlue = (((int)(255 / Boyut1 * A)) * satir + ((int)(255 / Boyut2 * A)) * sutun) % 255;

                ((Button)Butonlar[i]).BackColor = Color.FromArgb(bRed, bGreen, bBlue);
                Başla.BackColor = Color.FromArgb(bRed, bGreen, bBlue);
                sutun++;
            }

            satir = 0;
            sutun = 0;
        }

        private void YenidenCiz(object sender, System.EventArgs e)
        {
            sabit = 0;
            Temizle();
            Butonlar.Clear();
            MenuItem mi = (MenuItem)sender;
            this.En = Convert.ToInt32(mi.Text);
            this.Boy = Convert.ToInt32(mi.Text);       
            TahtaCiz(Boyut1, Boyut2, En, Boy);
            this.Başla.Size = new System.Drawing.Size(Boyut2 * En-30, Boy);
            bombasayısı();
           
        }
        private void YenidenCiz3(object sender, System.EventArgs e)
        {
            sabit = 0;
            Temizle();
            Butonlar.Clear();
            this.A = Math.Max(Boyut1, Boyut2);
            TahtaCiz(Boyut1, Boyut2, En, Boy);
            this.Başla.Size = new System.Drawing.Size(Boyut2*En-30, Boy);
            bombasayısı();


           
        }
        private void YenidenCiz2(object sender, System.EventArgs e)
        {
            sabit = 0;
            Temizle();
            Butonlar.Clear();
            MenuItem mi = (MenuItem)sender;
            string str = mi.Text.ToLower();
            int iX = str.IndexOf('x');
            this.Boyut1 = Convert.ToInt32(str.Substring(0, iX));
            this.Boyut2 = Convert.ToInt32(str.Substring(iX + 1, str.Length - iX - 1));
            this.A = Math.Max(Boyut1, Boyut2);            
            TahtaCiz(Boyut1, Boyut2, En, Boy);
            this.Başla.Size = new System.Drawing.Size(Boyut2 * En-30, Boy);
            bombasayısı();
            
        }

        private void menuItem12_Click(object sender, System.EventArgs e)
        {
            renk renkForm = new renk();
            renkForm.Gradyan = Math.Max(Boyut1, Boyut2);
            renkForm.anaFrm = this;
            renkForm.checkBox1.Checked = this._Red;
            renkForm.checkBox2.Checked = this._Green;
            renkForm.checkBox3.Checked = this._Blue;
            renkForm.trackBar1.Value = this.A;
            renkForm.Show();
        }
        

        private void tb_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            if (sabit != 1000)
            {
                Button b = (Button)sender;
                Label f = new Label();


                if (e.Button == MouseButtons.Right)
                {
                    f.Location = b.Location;
                    f.Size = new System.Drawing.Size(20, 20);
                    f.TextAlign = ContentAlignment.MiddleCenter;
                    f.Font = new Font("Arial", 10);
                    f.BackColor = Color.Blue;
                    b.Location = f.Location;
                    b.Visible = false;
                    b.Enabled = false;

                    if (b.Text != "X")
                    {
                        b.Visible = true;
                        b.Enabled = true;
                        if (Boyut1 > 10)
                            b.ForeColor = System.Drawing.SystemColors.ControlLightLight;
                        b.Text = "X";
                        int s = int.Parse(b.Name);
                        
                            bombasayı--;
                            kalanbomba.Text=bombasayı.ToString();
                    }
                    else
                    {
                        b.Visible = true;
                        b.Enabled = true;
                        b.Text = "";
                        int s = int.Parse(b.Name);
                       
                            bombasayı++; 
                            kalanbomba.Text=bombasayı.ToString();
                    }
                }
                if (b.Text != "X")
                    if (e.Button == MouseButtons.Left)
                    {
                        if (Boyut1 > 10)
                            f.ForeColor = System.Drawing.SystemColors.ControlLightLight;
                        f.Location = b.Location;
                        f.Size = new System.Drawing.Size(20, 20);
                        f.TextAlign = ContentAlignment.MiddleCenter;
                        f.Font = new Font("Arial", 10);
                        f.BackColor = Color.Blue;
                        b.Location = f.Location;
                        b.Visible = false;
                        b.Enabled = false;
                        int a = int.Parse(b.Name);

                        if (t[a] == 8)
                        {
                            bomba();
                        }
                        else
                            if(t[a]!=0)
                            f.Text = t[a].ToString();
                        this.Controls.Add(f);

                        int[] bosyer = new int[1000];
                        int[] digerbos = new int[100];
                        int[] aa = new int[225];
                        int p = 1, u = 0, pp = 0, kk = 1;

                        if (t[a] == 0)
                        {
                            int m = 0,w=0;
                            aa[0] = a;
                            bosyer[0] = a;
                            for (int y = 0; y < 30; y++)
                            {

                                bos(aa[pp]);
                                pp++;
                                
                                for (int k = 0; k < limit; k++)
                                {
                                    bosyer[kk] = tt[k];
                                    kk++;
                                    if (t[tt[k]] == 0)
                                    {
                                       
                                        for ( w = 0; w < p; w++)
                                            if (aa[w] == tt[k])
                                                m = 1;
                                        if (m == 0)
                                        {
                                            aa[p] = tt[k];
                                            p++;
                                        }
                                        w = 0; m = 0;
                                    }
                                }
                                if (pp == p)
                                    y = 30;
                            }
                            int tlimit = kk;
                            int j = 0;
                            int j1 = 2;
                            int ff = 0;

                            aa[0] = bosyer[0];
                            for (int h = 0; h < tlimit; h++)
                            {
                                for (j = 0; j < j1 - 1; j++)
                                    if (aa[j] == bosyer[h])
                                        ff++;

                                if (ff == 0)
                                { aa[j1 - 1] = bosyer[h]; j1++; }
                                ff = 0;
                            }
                            tlimit = j1 - 1;
                            for (int c = 0; c < tlimit; c++)
                                tt[c] = aa[c];
                            limit = tlimit;

                            for (int k = 0; k < tlimit; k++)
                            {
                                Label g = new Label();
                                g.Location = ((Button)Butonlar[tt[k]]).Location;
                                ((Button)Butonlar[tt[k]]).Visible = false;
                                g.Size = new System.Drawing.Size(20, 20);
                                g.TextAlign = ContentAlignment.MiddleCenter;
                                g.Font = new Font("Arial", 10);
                                if(Boyut1>10)
                                g.ForeColor = System.Drawing.SystemColors.ControlLightLight;
                                if(t[tt[k]]!=0)
                                g.Text = t[tt[k]].ToString();
                                g.BackColor = Color.Blue;
                                this.Controls.Add(g);
                                
                            }
                        } 
                    }
            }
            if (bombasayı == 0) hepsiniac();
        }
        private void hepsiniac()
        {
            int a, b, d;
            a = this.Boyut1;
            b = this.Boyut2;
            d = a * b;

            for (int i = 0; i < d; i++)
            {
                if (t[i] != 8)
                {
                    Label g = new Label();
                    g.Location = ((Button)Butonlar[i]).Location;
                    ((Button)Butonlar[i]).Visible = false;
                    g.Size = new System.Drawing.Size(20, 20);
                    g.TextAlign = ContentAlignment.MiddleCenter;
                    g.Font = new Font("Arial", 10);
                    g.Text = t[i].ToString();
                    g.BackColor = Color.Aqua;
                    this.Controls.Add(g);
                    ((Button)Butonlar[i]).Visible = false;
                  
                }

            }
            for (int h = 0; h < d; h++)
                ((Button)Butonlar[h]).Enabled = false;
        }
        private void bomba()
        {
            int  a, b, d;
            a = this.Boyut1;
            b = this.Boyut2;
            d = a * b;
            
            for (int i = 0; i < d; i++)
            {
                if (t[i] == 8)
                {
                    Label g = new Label();
                    g.Location = ((Button)Butonlar[i]).Location;
                    ((Button)Butonlar[i]).Visible = false;
                    g.Size = new System.Drawing.Size(20, 20);
                    g.TextAlign = ContentAlignment.MiddleCenter;
                    g.Font = new Font("Arial", 10);
                    g.Text = "X";
                    g.BackColor = Color.Red;
                    this.Controls.Add(g);
                   // PictureBox pic = new PictureBox();
                   // pic.Size = new System.Drawing.Size(20, 20);
                   // pic.Image = Image.FromFile("c:\\Documents and Settings\\fatih.koksal\\Desktop\\DinamiKontrol\\mayin2.bmp");
                    ((Button)Butonlar[i]).Visible=false;
                 //   pic.Location = ((Button)Butonlar[i]).Location;
                 //   this.Controls.Add(pic); 
                }
 
            }
            for (int h = 0; h < d; h++)
               ((Button)Butonlar[h]).Enabled = false;
          //  MessageBox.Show("oyun bitti");
           sabit = 1000;
        }
   

        private void bos(int baslama)
        {
            limit = 0;
            int j1 = 0, j2 = 0, b,f, d,a,i;
            a = this.Boyut1;
            b = this.Boyut2;
            for (int h = 0; h < 50; h++)
                tt[h] = 0;
               
               f=0;
               i = baslama;
                
                if (t[i] == 0)
                {
                    tt[j2++] = i;
                    if (i % b == 0 & i / b == 0)
                    {
                        if (t[i + 1] != 8) tt[j2++] = i + 1;
                        if (t[i + b] != 8) tt[j2++] = i + b;
                        if (t[i + b + 1] != 8) tt[j2++] = i + b + 1;
                    }
                    else
                        if (i % b == b - 1 & i / b == 0)
                        {
                            if (t[i - 1] != 8) tt[j2++] = i - 1;
                            if (t[i + b - 1] != 8) tt[j2++] = i + b - 1;
                            if (t[i + b] != 8) tt[j2++] = i + b;
                        }
                        else
                            if (i % b == 0 & i / b == b - 1)
                            {
                                if (t[i - b] != 8) tt[j2++] = i - b;
                                if (t[i - b + 1] != 8) tt[j2++] = i - b + 1;
                                if (t[i + 1] != 8) tt[j2++] = i + 1;
                            }
                            else
                                if (i % b == b - 1 & i / b == b - 1)
                                {
                                    if (t[i - 1] != 8) tt[j2++] = i - 1;
                                    if (t[i - b - 1] != 8) tt[j2++] = i - b - 1;
                                    if (t[i - b] != 8) tt[j2++] = i - b;
                                }
                                else
                                    if (i % b == 0)
                                    {
                                        if (t[i - b] != 8) tt[j2++] = i - b;
                                        if (t[i - b + 1] != 8) tt[j2++] = i - b + 1;
                                        if (t[i + 1] != 8) tt[j2++] = i + 1;
                                        if (t[i + b] != 8) tt[j2++] = i + b;
                                        if (t[i + b + 1] != 8) tt[j2++] = i + b + 1;
                                    }
                                    else
                                        if (i % b == b - 1)
                                        {
                                            if (t[i - b] != 8) tt[j2++] = i - b;
                                            if (t[i - b - 1] != 8) tt[j2++] = i - b - 1;
                                            if (t[i - 1] != 8) tt[j2++] = i - 1;
                                            if (t[i + b - 1] != 8) tt[j2++] = i + b - 1;
                                            if (t[i + b] != 8) tt[j2++] = i + b;
                                        }
                                        else
                                            if (i / b == 0)
                                            {
                                                if (t[i - 1] != 8) tt[j2++] = i - 1;
                                                if (t[i + b - 1] != 8) tt[j2++] = i + b - 1;
                                                if (t[i + b] != 8) tt[j2++] = i + b;
                                                if (t[i + b + 1] != 8) tt[j2++] = i + b + 1;
                                                if (t[i + 1] != 8) tt[j2++] = i + 1;
                                            }
                                            else
                                                if (i / b == b - 1)
                                                {
                                                    if (t[i - 1] != 8) tt[j2++] = i - 1;
                                                    if (t[i - b - 1] != 8) tt[j2++] = i - b - 1;
                                                    if (t[i - b] != 8) tt[j2++] = i - b;
                                                    if (t[i - b + 1] != 8) tt[j2++] = i - b + 1;
                                                    if (t[i + 1] != 8) tt[j2++] = i + 1;
                                                }
                                                else
                                                {
                                                    if (t[i - 1] != 8) tt[j2++] = i - 1;
                                                    if (t[i - b - 1] != 8) tt[j2++] = i - b - 1;
                                                    if (t[i - b] != 8) tt[j2++] = i - b;
                                                    if (t[i - b + 1] != 8) tt[j2++] = i - b + 1;
                                                    if (t[i + 1] != 8) tt[j2++] = i + 1;
                                                    if (t[i + b + 1] != 8) tt[j2++] = i + b + 1;
                                                    if (t[i + b] != 8) tt[j2++] = i + b;
                                                    if (t[i + b - 1] != 8) tt[j2++] = i + b - 1;
                                                }
                
            }

       limit = j2;
    
        }
        private void bombasayısı()
        {
            Random r = new Random();
            int bomba, n = 0, a, b, c, d;
            a = this.Boyut1;
            b = this.Boyut2;
            d = a * b;
            c = (a * b )/ 5;
            bombasayı = c;
            kalanbomba.Text = bombasayı.ToString();
            this.Controls.Add(this.kalanbomba);
            int[] aynı = new int[c];
            for (int m = 0; m < c; m++)
            {
                bomba = r.Next(d);
                aynı[n] = bomba;
                n++;
                for (int j = 0; j < n - 1; j++)
                    if (aynı[n - 1] == aynı[j])
                        { 
                        n--; 
                        m--; 
                    }
            }
            for (int j = 0; j < c; j++)
                t[aynı[j]] = 8;  
            for (int i = 0; i < d; i++)
            {
                if (t[i] == 8)
                {
                    if (i % b == 0 & i / b == 0)
                    {
                        if (t[i + 1] != 8) t[i + 1]++;
                        if (t[i + b] != 8) t[i + b]++;
                        if (t[i + b + 1] != 8) t[i + b + 1]++;
                    }
                    else
                        if (i % b == b - 1 & i / b == 0)
                        {
                            if (t[i - 1] != 8) t[i - 1]++;
                            if (t[i + b - 1] != 8) t[i + b - 1]++;
                            if (t[i + b] != 8) t[i + b]++;
                        }
                        else
                            if (i % b == 0 & i / b == b - 1)
                            {
                                if (t[i - b] != 8) t[i - b]++;
                                if (t[i - b + 1] != 8) t[i - b + 1]++;
                                if (t[i + 1] != 8) t[i + 1]++;
                            }
                            else
                                if (i % b == b - 1 & i / b == b - 1)
                                {
                                    if (t[i - 1] != 8) t[i - 1]++;
                                    if (t[i - b - 1] != 8) t[i - b - 1]++;
                                    if (t[i - b] != 8) t[i - b]++;
                                }
                                else
                                    if (i % b == 0)
                                    {
                                        if (t[i - b] != 8) t[i - b]++;
                                        if (t[i - b + 1] != 8) t[i - b + 1]++;
                                        if (t[i + 1] != 8) t[i + 1]++;
                                        if (t[i + b] != 8) t[i + b]++;
                                        if (t[i + b + 1] != 8) t[i + b + 1]++;
                                    }
                                    else
                                        if (i % b == b - 1)
                                        {
                                            if (t[i - b] != 8) t[i - b]++;
                                            if (t[i - b - 1] != 8) t[i - b - 1]++;
                                            if (t[i - 1] != 8) t[i - 1]++;
                                            if (t[i + b - 1] != 8) t[i + b - 1]++;
                                            if (t[i + b] != 8) t[i + b]++;
                                        }
                                        else
                                            if (i / b == 0)
                                            {
                                                if (t[i - 1] != 8) t[i - 1]++;
                                                if (t[i + b - 1] != 8) t[i + b - 1]++;
                                                if (t[i + b] != 8) t[i + b]++;
                                                if (t[i + b + 1] != 8) t[i + b + 1]++;
                                                if (t[i + 1] != 8) t[i + 1]++;
                                            }
                                            else
                                                if (i / b == b - 1)
                                                {
                                                    if (t[i - 1] != 8) t[i - 1]++;
                                                    if (t[i - b - 1] != 8) t[i - b - 1]++;
                                                    if (t[i - b] != 8) t[i - b]++;
                                                    if (t[i - b + 1] != 8) t[i - b + 1]++;
                                                    if (t[i + 1] != 8) t[i + 1]++;
                                                }
                                                else
                                                {
                                                    if (t[i - 1] != 8) t[i - 1]++;
                                                    if (t[i - b - 1] != 8) t[i - b - 1]++;
                                                    if (t[i - b] != 8) t[i - b]++;
                                                    if (t[i - b + 1] != 8) t[i - b + 1]++;
                                                    if (t[i + 1] != 8) t[i + 1]++;
                                                    if (t[i + b + 1] != 8) t[i + b + 1]++;
                                                    if (t[i + b] != 8) t[i + b]++;
                                                    if (t[i + b - 1] != 8) t[i + b - 1]++;
                                                }
                }
            }
          

        }
    }

}


UYGULAMAYI İNDİR

Hiç yorum yok :

Yorum Gönderme