none
[Ayuda][C#] Crear un jugador en Memorama RRS feed

  • Pregunta

  • Hola he desarrolado en c# un memorama de 16 botones con imagenes, pero se me dio la condicion de que fuera para 2 jugadores, entonces mi duda es.... como lo creo y si lo creo debe llevar un contador y al finalizar el juego me debe decir quien de los 2 jugadores gana

    Aqui esta el codigo

    using System;
    using System.Drawing;
    using System.Collections;
    using System.ComponentModel;
    using System.Windows.Forms;
    using System.Data;
    
    namespace adivina
    {
    	/// <summary>
    	/// Descripción breve de Form1.
    	/// </summary>
    	public class Form1 : System.Windows.Forms.Form
    	{
    		Random abc=new Random();
    		public string cc, kk;
    		public int a, b, c, d, x, f, g, res, bb, aa=0, dd, opor, h;
    		public int[] btn1=new int[8];
    		public int[] btn2=new int[17];
    		public string[] ima=new string[8];
    		private System.Windows.Forms.Label lbPuntajeGr;
    		private System.Windows.Forms.TextBox tbPuntuacionGr;
    		private System.Windows.Forms.Button btBoton1Gr;
    		private System.Windows.Forms.Button btBoton2Gr;
    		private System.Windows.Forms.Button btBoton3Gr;
    		private System.Windows.Forms.Button btBoton4Gr;
    		private System.Windows.Forms.Button btBoton5Gr;
    		private System.Windows.Forms.Button btBoton6Gr;
    		private System.Windows.Forms.Button btBoton7Gr;
    		private System.Windows.Forms.Button btBoton8Gr;
    		private System.Windows.Forms.Button btBoton9Gr;
    		private System.Windows.Forms.Button btBoton10Gr;
    		private System.Windows.Forms.Button btBoton11Gr;
    		private System.Windows.Forms.Button btBoton12Gr;
    		private System.Windows.Forms.GroupBox gbMemoramaGr;
    		private System.Windows.Forms.Button bt13;
    		private System.Windows.Forms.Button bt14;
    		private System.Windows.Forms.Button bt15;
    		private System.Windows.Forms.Button bt16;
    		private System.Windows.Forms.Button btNuevoGr;
    		private System.Windows.Forms.Label lbMovimientosGr;
    		private System.Windows.Forms.Button button1;
    		
    		/// <summary>
    		/// Variable del diseñador requerida.
    		/// </summary>
    		private System.ComponentModel.Container components = null;
    
    		public Form1()
    		{
    			//
    			// Necesario para admitir el Diseñador de Windows Forms
    			//
    			InitializeComponent();
    
    			//
    			// TODO: agregar código de constructor después de llamar a InitializeComponent
    			//
    		}
    
    		/// <summary>
    		/// Limpiar los recursos que se estén utilizando.
    		/// </summary>
    		protected override void Dispose( bool disposing )
    		{
    			if( disposing )
    			{
    				if (components != null) 
    				{
    					components.Dispose();
    				}
    			}
    			base.Dispose( disposing );
    		}
    
    		#region Código generado por el Diseñador de Windows Forms
    		/// <summary>
    		/// Método necesario para admitir el Diseñador. No se puede modificar
    		/// el contenido del método con el editor de código.
    		/// </summary>
    		private void InitializeComponent()
    		{
                System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
                this.btBoton1Gr = new System.Windows.Forms.Button();
                this.btBoton2Gr = new System.Windows.Forms.Button();
                this.btBoton3Gr = new System.Windows.Forms.Button();
                this.btBoton4Gr = new System.Windows.Forms.Button();
                this.btBoton5Gr = new System.Windows.Forms.Button();
                this.btBoton6Gr = new System.Windows.Forms.Button();
                this.btBoton7Gr = new System.Windows.Forms.Button();
                this.btBoton8Gr = new System.Windows.Forms.Button();
                this.btBoton9Gr = new System.Windows.Forms.Button();
                this.btBoton10Gr = new System.Windows.Forms.Button();
                this.btBoton11Gr = new System.Windows.Forms.Button();
                this.btBoton12Gr = new System.Windows.Forms.Button();
                this.bt13 = new System.Windows.Forms.Button();
                this.bt14 = new System.Windows.Forms.Button();
                this.lbPuntajeGr = new System.Windows.Forms.Label();
                this.tbPuntuacionGr = new System.Windows.Forms.TextBox();
                this.gbMemoramaGr = new System.Windows.Forms.GroupBox();
                this.bt15 = new System.Windows.Forms.Button();
                this.bt16 = new System.Windows.Forms.Button();
                this.btNuevoGr = new System.Windows.Forms.Button();
                this.lbMovimientosGr = new System.Windows.Forms.Label();
                this.button1 = new System.Windows.Forms.Button();
                this.gbMemoramaGr.SuspendLayout();
                this.SuspendLayout();
                // 
                // btBoton1Gr
                // 
                this.btBoton1Gr.BackColor = System.Drawing.Color.Transparent;
                this.btBoton1Gr.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btBoton1Gr.BackgroundImage")));
                this.btBoton1Gr.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
                this.btBoton1Gr.Font = new System.Drawing.Font("Microsoft Sans Serif", 2.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.btBoton1Gr.ForeColor = System.Drawing.Color.Transparent;
                this.btBoton1Gr.Location = new System.Drawing.Point(16, 16);
                this.btBoton1Gr.Name = "btBoton1Gr";
                this.btBoton1Gr.Size = new System.Drawing.Size(152, 136);
                this.btBoton1Gr.TabIndex = 0;
                this.btBoton1Gr.Text = "1";
                this.btBoton1Gr.UseVisualStyleBackColor = false;
                this.btBoton1Gr.Click += new System.EventHandler(this.bt1_Click);
                // 
                // btBoton2Gr
                // 
                this.btBoton2Gr.BackColor = System.Drawing.Color.Transparent;
                this.btBoton2Gr.BackgroundImage = global::adivina.Properties.Resources._21;
                this.btBoton2Gr.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
                this.btBoton2Gr.Font = new System.Drawing.Font("Microsoft Sans Serif", 2.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.btBoton2Gr.ForeColor = System.Drawing.Color.Transparent;
                this.btBoton2Gr.Location = new System.Drawing.Point(176, 16);
                this.btBoton2Gr.Name = "btBoton2Gr";
                this.btBoton2Gr.Size = new System.Drawing.Size(152, 136);
                this.btBoton2Gr.TabIndex = 1;
                this.btBoton2Gr.Text = "2";
                this.btBoton2Gr.UseVisualStyleBackColor = false;
                this.btBoton2Gr.Click += new System.EventHandler(this.bt2_Click);
                // 
                // btBoton3Gr
                // 
                this.btBoton3Gr.BackColor = System.Drawing.Color.Transparent;
                this.btBoton3Gr.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btBoton3Gr.BackgroundImage")));
                this.btBoton3Gr.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
                this.btBoton3Gr.Font = new System.Drawing.Font("Microsoft Sans Serif", 2.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.btBoton3Gr.ForeColor = System.Drawing.Color.Transparent;
                this.btBoton3Gr.Location = new System.Drawing.Point(336, 16);
                this.btBoton3Gr.Name = "btBoton3Gr";
                this.btBoton3Gr.Size = new System.Drawing.Size(152, 136);
                this.btBoton3Gr.TabIndex = 2;
                this.btBoton3Gr.Text = "3";
                this.btBoton3Gr.UseVisualStyleBackColor = false;
                this.btBoton3Gr.Click += new System.EventHandler(this.bt3_Click);
                // 
                // btBoton4Gr
                // 
                this.btBoton4Gr.BackColor = System.Drawing.Color.Transparent;
                this.btBoton4Gr.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btBoton4Gr.BackgroundImage")));
                this.btBoton4Gr.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
                this.btBoton4Gr.Font = new System.Drawing.Font("Microsoft Sans Serif", 2.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.btBoton4Gr.ForeColor = System.Drawing.Color.Transparent;
                this.btBoton4Gr.Location = new System.Drawing.Point(496, 16);
                this.btBoton4Gr.Name = "btBoton4Gr";
                this.btBoton4Gr.Size = new System.Drawing.Size(144, 136);
                this.btBoton4Gr.TabIndex = 3;
                this.btBoton4Gr.Text = "4";
                this.btBoton4Gr.UseVisualStyleBackColor = false;
                this.btBoton4Gr.Click += new System.EventHandler(this.bt4_Click);
                // 
                // btBoton5Gr
                // 
                this.btBoton5Gr.BackColor = System.Drawing.Color.Transparent;
                this.btBoton5Gr.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btBoton5Gr.BackgroundImage")));
                this.btBoton5Gr.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
                this.btBoton5Gr.Font = new System.Drawing.Font("Microsoft Sans Serif", 2.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.btBoton5Gr.ForeColor = System.Drawing.Color.Transparent;
                this.btBoton5Gr.Location = new System.Drawing.Point(16, 160);
                this.btBoton5Gr.Name = "btBoton5Gr";
                this.btBoton5Gr.Size = new System.Drawing.Size(152, 136);
                this.btBoton5Gr.TabIndex = 4;
                this.btBoton5Gr.Text = "5";
                this.btBoton5Gr.UseVisualStyleBackColor = false;
                this.btBoton5Gr.Click += new System.EventHandler(this.bt5_Click);
                // 
                // btBoton6Gr
                // 
                this.btBoton6Gr.BackColor = System.Drawing.Color.Transparent;
                this.btBoton6Gr.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btBoton6Gr.BackgroundImage")));
                this.btBoton6Gr.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
                this.btBoton6Gr.Font = new System.Drawing.Font("Microsoft Sans Serif", 2.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.btBoton6Gr.ForeColor = System.Drawing.Color.Transparent;
                this.btBoton6Gr.Location = new System.Drawing.Point(176, 160);
                this.btBoton6Gr.Name = "btBoton6Gr";
                this.btBoton6Gr.Size = new System.Drawing.Size(152, 136);
                this.btBoton6Gr.TabIndex = 5;
                this.btBoton6Gr.Text = "6";
                this.btBoton6Gr.UseVisualStyleBackColor = false;
                this.btBoton6Gr.Click += new System.EventHandler(this.bt6_Click);
                // 
                // btBoton7Gr
                // 
                this.btBoton7Gr.BackColor = System.Drawing.Color.Transparent;
                this.btBoton7Gr.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btBoton7Gr.BackgroundImage")));
                this.btBoton7Gr.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
                this.btBoton7Gr.Font = new System.Drawing.Font("Microsoft Sans Serif", 2.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.btBoton7Gr.ForeColor = System.Drawing.Color.Transparent;
                this.btBoton7Gr.Location = new System.Drawing.Point(336, 160);
                this.btBoton7Gr.Name = "btBoton7Gr";
                this.btBoton7Gr.Size = new System.Drawing.Size(152, 136);
                this.btBoton7Gr.TabIndex = 6;
                this.btBoton7Gr.Text = "7";
                this.btBoton7Gr.UseVisualStyleBackColor = false;
                this.btBoton7Gr.Click += new System.EventHandler(this.bt7_Click);
                // 
                // btBoton8Gr
                // 
                this.btBoton8Gr.BackColor = System.Drawing.Color.Transparent;
                this.btBoton8Gr.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btBoton8Gr.BackgroundImage")));
                this.btBoton8Gr.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
                this.btBoton8Gr.Font = new System.Drawing.Font("Microsoft Sans Serif", 2.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.btBoton8Gr.ForeColor = System.Drawing.Color.Transparent;
                this.btBoton8Gr.Location = new System.Drawing.Point(496, 160);
                this.btBoton8Gr.Name = "btBoton8Gr";
                this.btBoton8Gr.Size = new System.Drawing.Size(144, 136);
                this.btBoton8Gr.TabIndex = 7;
                this.btBoton8Gr.Text = "8";
                this.btBoton8Gr.UseVisualStyleBackColor = false;
                this.btBoton8Gr.Click += new System.EventHandler(this.bt8_Click);
                // 
                // btBoton9Gr
                // 
                this.btBoton9Gr.BackColor = System.Drawing.Color.Transparent;
                this.btBoton9Gr.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btBoton9Gr.BackgroundImage")));
                this.btBoton9Gr.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
                this.btBoton9Gr.Font = new System.Drawing.Font("Microsoft Sans Serif", 2.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.btBoton9Gr.ForeColor = System.Drawing.Color.Transparent;
                this.btBoton9Gr.Location = new System.Drawing.Point(16, 304);
                this.btBoton9Gr.Name = "btBoton9Gr";
                this.btBoton9Gr.Size = new System.Drawing.Size(152, 136);
                this.btBoton9Gr.TabIndex = 8;
                this.btBoton9Gr.Text = "9";
                this.btBoton9Gr.UseVisualStyleBackColor = false;
                this.btBoton9Gr.Click += new System.EventHandler(this.bt9_Click);
                // 
                // btBoton10Gr
                // 
                this.btBoton10Gr.BackColor = System.Drawing.Color.Transparent;
                this.btBoton10Gr.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btBoton10Gr.BackgroundImage")));
                this.btBoton10Gr.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
                this.btBoton10Gr.Font = new System.Drawing.Font("Microsoft Sans Serif", 2.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.btBoton10Gr.ForeColor = System.Drawing.Color.Transparent;
                this.btBoton10Gr.Location = new System.Drawing.Point(176, 304);
                this.btBoton10Gr.Name = "btBoton10Gr";
                this.btBoton10Gr.Size = new System.Drawing.Size(152, 136);
                this.btBoton10Gr.TabIndex = 9;
                this.btBoton10Gr.Text = "10";
                this.btBoton10Gr.UseVisualStyleBackColor = false;
                this.btBoton10Gr.Click += new System.EventHandler(this.bt10_Click);
                // 
                // btBoton11Gr
                // 
                this.btBoton11Gr.BackColor = System.Drawing.Color.Transparent;
                this.btBoton11Gr.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btBoton11Gr.BackgroundImage")));
                this.btBoton11Gr.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
                this.btBoton11Gr.Font = new System.Drawing.Font("Microsoft Sans Serif", 2.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.btBoton11Gr.ForeColor = System.Drawing.Color.Transparent;
                this.btBoton11Gr.Location = new System.Drawing.Point(336, 304);
                this.btBoton11Gr.Name = "btBoton11Gr";
                this.btBoton11Gr.Size = new System.Drawing.Size(152, 136);
                this.btBoton11Gr.TabIndex = 10;
                this.btBoton11Gr.Text = "11";
                this.btBoton11Gr.UseVisualStyleBackColor = false;
                this.btBoton11Gr.Click += new System.EventHandler(this.bt11_Click);
                // 
                // btBoton12Gr
                // 
                this.btBoton12Gr.BackColor = System.Drawing.Color.Transparent;
                this.btBoton12Gr.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btBoton12Gr.BackgroundImage")));
                this.btBoton12Gr.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
                this.btBoton12Gr.Font = new System.Drawing.Font("Microsoft Sans Serif", 2.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.btBoton12Gr.ForeColor = System.Drawing.Color.Transparent;
                this.btBoton12Gr.Location = new System.Drawing.Point(496, 304);
                this.btBoton12Gr.Name = "btBoton12Gr";
                this.btBoton12Gr.Size = new System.Drawing.Size(144, 136);
                this.btBoton12Gr.TabIndex = 11;
                this.btBoton12Gr.Text = "12";
                this.btBoton12Gr.UseVisualStyleBackColor = false;
                this.btBoton12Gr.Click += new System.EventHandler(this.bt12_Click);
                // 
                // bt13
                // 
                this.bt13.BackColor = System.Drawing.Color.Transparent;
                this.bt13.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("bt13.BackgroundImage")));
                this.bt13.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
                this.bt13.Font = new System.Drawing.Font("Microsoft Sans Serif", 2.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.bt13.ForeColor = System.Drawing.Color.Transparent;
                this.bt13.Location = new System.Drawing.Point(16, 448);
                this.bt13.Name = "bt13";
                this.bt13.Size = new System.Drawing.Size(152, 144);
                this.bt13.TabIndex = 12;
                this.bt13.Text = "13";
                this.bt13.UseVisualStyleBackColor = false;
                this.bt13.Click += new System.EventHandler(this.bt13_Click);
                // 
                // bt14
                // 
                this.bt14.BackColor = System.Drawing.Color.Transparent;
                this.bt14.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("bt14.BackgroundImage")));
                this.bt14.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
                this.bt14.Font = new System.Drawing.Font("Microsoft Sans Serif", 2.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.bt14.ForeColor = System.Drawing.Color.Transparent;
                this.bt14.Location = new System.Drawing.Point(176, 448);
                this.bt14.Name = "bt14";
                this.bt14.Size = new System.Drawing.Size(152, 144);
                this.bt14.TabIndex = 13;
                this.bt14.Text = "14";
                this.bt14.UseVisualStyleBackColor = false;
                this.bt14.Click += new System.EventHandler(this.button14_Click);
                // 
                // lbPuntajeGr
                // 
                this.lbPuntajeGr.BackColor = System.Drawing.Color.Transparent;
                this.lbPuntajeGr.Font = new System.Drawing.Font("Comic Sans MS", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.lbPuntajeGr.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
                this.lbPuntajeGr.Location = new System.Drawing.Point(8, 432);
                this.lbPuntajeGr.Name = "lbPuntajeGr";
                this.lbPuntajeGr.Size = new System.Drawing.Size(100, 23);
                this.lbPuntajeGr.TabIndex = 15;
                this.lbPuntajeGr.Text = "Puntaje";
                // 
                // tbPuntuacionGr
                // 
                this.tbPuntuacionGr.Location = new System.Drawing.Point(16, 456);
                this.tbPuntuacionGr.Name = "tbPuntuacionGr";
                this.tbPuntuacionGr.Size = new System.Drawing.Size(80, 20);
                this.tbPuntuacionGr.TabIndex = 16;
                // 
                // gbMemoramaGr
                // 
                this.gbMemoramaGr.BackColor = System.Drawing.Color.Transparent;
                this.gbMemoramaGr.Controls.Add(this.bt13);
                this.gbMemoramaGr.Controls.Add(this.bt14);
                this.gbMemoramaGr.Controls.Add(this.bt15);
                this.gbMemoramaGr.Controls.Add(this.bt16);
                this.gbMemoramaGr.Controls.Add(this.btBoton9Gr);
                this.gbMemoramaGr.Controls.Add(this.btBoton10Gr);
                this.gbMemoramaGr.Controls.Add(this.btBoton11Gr);
                this.gbMemoramaGr.Controls.Add(this.btBoton12Gr);
                this.gbMemoramaGr.Controls.Add(this.btBoton8Gr);
                this.gbMemoramaGr.Controls.Add(this.btBoton5Gr);
                this.gbMemoramaGr.Controls.Add(this.btBoton6Gr);
                this.gbMemoramaGr.Controls.Add(this.btBoton7Gr);
                this.gbMemoramaGr.Controls.Add(this.btBoton1Gr);
                this.gbMemoramaGr.Controls.Add(this.btBoton2Gr);
                this.gbMemoramaGr.Controls.Add(this.btBoton3Gr);
                this.gbMemoramaGr.Controls.Add(this.btBoton4Gr);
                this.gbMemoramaGr.Location = new System.Drawing.Point(168, 24);
                this.gbMemoramaGr.Name = "gbMemoramaGr";
                this.gbMemoramaGr.Size = new System.Drawing.Size(664, 600);
                this.gbMemoramaGr.TabIndex = 17;
                this.gbMemoramaGr.TabStop = false;
                // 
                // bt15
                // 
                this.bt15.BackColor = System.Drawing.Color.Transparent;
                this.bt15.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("bt15.BackgroundImage")));
                this.bt15.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
                this.bt15.Font = new System.Drawing.Font("Microsoft Sans Serif", 2.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.bt15.ForeColor = System.Drawing.Color.Transparent;
                this.bt15.Location = new System.Drawing.Point(336, 448);
                this.bt15.Name = "bt15";
                this.bt15.Size = new System.Drawing.Size(152, 144);
                this.bt15.TabIndex = 18;
                this.bt15.Text = "15";
                this.bt15.UseVisualStyleBackColor = false;
                this.bt15.Click += new System.EventHandler(this.bt15_Click);
                // 
                // bt16
                // 
                this.bt16.BackColor = System.Drawing.Color.Transparent;
                this.bt16.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("bt16.BackgroundImage")));
                this.bt16.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
                this.bt16.Font = new System.Drawing.Font("Microsoft Sans Serif", 2.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.bt16.ForeColor = System.Drawing.Color.Transparent;
                this.bt16.Location = new System.Drawing.Point(496, 448);
                this.bt16.Name = "bt16";
                this.bt16.Size = new System.Drawing.Size(144, 144);
                this.bt16.TabIndex = 19;
                this.bt16.Text = "16";
                this.bt16.UseVisualStyleBackColor = false;
                this.bt16.Click += new System.EventHandler(this.bt16_Click);
                // 
                // btNuevoGr
                // 
                this.btNuevoGr.Font = new System.Drawing.Font("Comic Sans MS", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.btNuevoGr.Location = new System.Drawing.Point(33, 126);
                this.btNuevoGr.Name = "btNuevoGr";
                this.btNuevoGr.Size = new System.Drawing.Size(88, 58);
                this.btNuevoGr.TabIndex = 19;
                this.btNuevoGr.Text = "Nuevo Juego";
                this.btNuevoGr.Click += new System.EventHandler(this.bt18_Click);
                // 
                // lbMovimientosGr
                // 
                this.lbMovimientosGr.BackColor = System.Drawing.Color.Transparent;
                this.lbMovimientosGr.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
                this.lbMovimientosGr.Location = new System.Drawing.Point(0, 200);
                this.lbMovimientosGr.Name = "lbMovimientosGr";
                this.lbMovimientosGr.Size = new System.Drawing.Size(168, 23);
                this.lbMovimientosGr.TabIndex = 20;
                // 
                // button1
                // 
                this.button1.Location = new System.Drawing.Point(928, 392);
                this.button1.Name = "button1";
                this.button1.Size = new System.Drawing.Size(75, 23);
                this.button1.TabIndex = 21;
                this.button1.Text = "salir";
                this.button1.Click += new System.EventHandler(this.button1_Click);
                // 
                // Form1
                // 
                this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
                this.BackgroundImage = global::adivina.Properties.Resources.Wallpaper_by_Sabski;
                this.ClientSize = new System.Drawing.Size(847, 658);
                this.Controls.Add(this.gbMemoramaGr);
                this.Controls.Add(this.button1);
                this.Controls.Add(this.lbMovimientosGr);
                this.Controls.Add(this.btNuevoGr);
                this.Controls.Add(this.tbPuntuacionGr);
                this.Controls.Add(this.lbPuntajeGr);
                this.Name = "Form1";
                this.Text = "Memorama";
                this.Load += new System.EventHandler(this.Form1_Load);
                this.gbMemoramaGr.ResumeLayout(false);
                this.ResumeLayout(false);
                this.PerformLayout();
    
    		}
    		#endregion
    
    		/// <summary>
    		/// Punto de entrada principal de la aplicación.
    		/// </summary>
    		[STAThread]
    		static void Main() 
    		{
    			Application.Run(new Form1());
    		}
    
    //INICIO DE METODOS
    		//METODO DE JUEGO NUEVO
    		public void nuevo()
    		{
    			int pp=0;	
    			for(int i=0; i<8; i++)
    				btn1[i]=0;
    			//Asignacion de una imagen en la matriz 
    			//llamando al metodo posiciones()
    			pp=posiciones();
    			btn2[0]=pp;
    			btn1[pp]=btn1[pp]+1;
    			
    			pp=posiciones();
    			btn2[1]=pp;
    			btn1[pp]=btn1[pp]+1;
    
    			
    			pp=posiciones();
    			btn2[2]=pp;
    			btn1[pp]=btn1[pp]+1;
    
    			pp=posiciones();
    			btn2[3]=pp;
    			btn1[pp]=btn1[pp]+1;
    
    			pp=posiciones();
    			btn2[4]=pp;
    			btn1[pp]=btn1[pp]+1;
    
    			pp=posiciones();
    			btn2[5]=pp;
    			btn1[pp]=btn1[pp]+1;
    
    			pp=posiciones();
    			btn2[6]=pp;
    			btn1[pp]=btn1[pp]+1;
    
    			pp=posiciones();
    			btn2[7]=pp;
    			btn1[pp]=btn1[pp]+1;
    
    			pp=posiciones();
    			btn2[8]=pp;
    			btn1[pp]=btn1[pp]+1;
    
    			pp=posiciones();
    			btn2[9]=pp;
    			btn1[pp]=btn1[pp]+1;
    			
    			pp=posiciones();
    			btn2[10]=pp;
    			btn1[pp]=btn1[pp]+1;
    
    			pp=posiciones();
    			btn2[11]=pp;
    			btn1[pp]=btn1[pp]+1;
    
    			pp=posiciones();
    			btn2[12]=pp;
    			btn1[pp]=btn1[pp]+1;
    
    			pp=posiciones();
    			btn2[13]=pp;
    			btn1[pp]=btn1[pp]+1;
    
    			pp=posiciones();
    			btn2[14]=pp;
    			btn1[pp]=btn1[pp]+1;
    
    			pp=posiciones();
    			btn2[15]=pp;
    			btn1[pp]=btn1[pp]+1;
     
    			
    			btBoton1Gr.Image=System.Drawing.Bitmap.FromFile(@"21.jpg");
    			btBoton2Gr.Image=System.Drawing.Bitmap.FromFile(@"21.jpg");
    			btBoton3Gr.Image=System.Drawing.Bitmap.FromFile(@"21.jpg");
    			btBoton4Gr.Image=System.Drawing.Bitmap.FromFile(@"21.jpg");
    			btBoton5Gr.Image=System.Drawing.Bitmap.FromFile(@"21.jpg");
    			btBoton6Gr.Image=System.Drawing.Bitmap.FromFile(@"21.jpg");
    			btBoton7Gr.Image=System.Drawing.Bitmap.FromFile(@"21.jpg");
    			btBoton8Gr.Image=System.Drawing.Bitmap.FromFile(@"21.jpg");
    			btBoton9Gr.Image=System.Drawing.Bitmap.FromFile(@"21.jpg");
    			btBoton10Gr.Image=System.Drawing.Bitmap.FromFile(@"21.jpg");
    			btBoton11Gr.Image=System.Drawing.Bitmap.FromFile(@"21.jpg");
    			btBoton12Gr.Image=System.Drawing.Bitmap.FromFile(@"21.jpg");
    			bt13.Image=System.Drawing.Bitmap.FromFile(@"21.jpg");
    			bt14.Image=System.Drawing.Bitmap.FromFile(@"21.jpg");
    			bt15.Image=System.Drawing.Bitmap.FromFile(@"21.jpg");
    			bt16.Image=System.Drawing.Bitmap.FromFile(@"21.jpg");
    			lbPuntajeGr.Visible=true;
    			lbMovimientosGr.Visible=true;
    			tbPuntuacionGr.Visible=true;
    			tbPuntuacionGr.ReadOnly=true;
    			opor=0;
    			kk=Convert.ToString(opor);
    			lbMovimientosGr.Text="Movimientos: " +kk;
    			res=0;
    			cc=Convert.ToString(res);
    			tbPuntuacionGr.Text=cc;
    			gbMemoramaGr.Enabled=true;
    
    			btBoton1Gr.Enabled=true; 
    			btBoton2Gr.Enabled=true;
    			btBoton3Gr.Enabled=true; 
    			btBoton4Gr.Enabled=true; 
    			btBoton5Gr.Enabled=true; 
    			btBoton6Gr.Enabled=true; 
    			btBoton7Gr.Enabled=true; 
    			btBoton8Gr.Enabled=true; 
    			btBoton9Gr.Enabled=true; 
    			btBoton10Gr.Enabled=true; 
    			btBoton11Gr.Enabled=true; 
    			btBoton12Gr.Enabled=true; 
    			bt13.Enabled=true; 
    			bt14.Enabled=true; 
    			bt15.Enabled=true; 
    			bt16.Enabled=true;
    		}
    		//METODO DEL TIEMPO
    		
    		public void tiempo()
    		{
    			//este metodo hace la operacion 
    			//para que no se volteen muy 
    			//rapido las imagenes
    			for(c=0; c<10000; c++)
    				for(x=0; x<16000; x++)
    				{
    					f=35764*778;
    					g=7467*585;
    				}
    		}
    		//METODO DE LAS IMAGENES
    		public void imagenes()
    		{
    			//ruta de las imagenes
    			//asignandolas en una matriz
    			ima[0]=(@"1.jpg");
    			ima[1]=(@"2.jpg");
    			ima[2]=(@"3.jpg");
    			ima[3]=(@"4.jpg");
    			ima[4]=(@"5.jpg");
    			ima[5]=(@"6.jpg");
    			ima[6]=(@"7.jpg");
    			ima[7]=(@"8.jpg");
    		}
    		//METODO POSICIONES DE LAS IMAGENES
    		private int posiciones()
    		{
    			//asignacion de las posiciones de las imagenes
    			//y verificar que no halla mas de 2 imagenes en el memorama
    			int p=0;
    			p=abc.Next(8);
    			while(btn1[p]>=2)
    				p=abc.Next(8);
    			return (p);		  
    		}
    		//INICIAR EN DEFAULT
    		public void pordef()
    		{
    			btBoton1Gr.Visible=false;
    			btBoton2Gr.Visible=false;
    			btBoton3Gr.Visible=false;
    			btBoton4Gr.Visible=false;
    			btBoton5Gr.Visible=false;
    			btBoton6Gr.Visible=false;
    			btBoton7Gr.Visible=false;
    			btBoton8Gr.Visible=false;
    			btBoton9Gr.Visible=false;
    			btBoton10Gr.Visible=false;
    			btBoton11Gr.Visible=false;
    			btBoton12Gr.Visible=false;
    			bt13.Visible=false;
    			bt14.Visible=false;
    			bt15.Visible=false;
    			bt16.Visible=false;
    			tbPuntuacionGr.Visible=false;
    			lbPuntajeGr.Visible=false;
    			lbMovimientosGr.Visible=false;
    		}
    		//ACTIVAR BOTONES
    		public void activate()
    		{
    			btBoton1Gr.Visible=true;
    			btBoton2Gr.Visible=true;
    			btBoton3Gr.Visible=true;
    			btBoton4Gr.Visible=true;
    			btBoton5Gr.Visible=true;
    			btBoton6Gr.Visible=true;
    			btBoton7Gr.Visible=true;
    			btBoton8Gr.Visible=true;
    			btBoton9Gr.Visible=true;
    			btBoton10Gr.Visible=true;
    			btBoton11Gr.Visible=true;
    			btBoton12Gr.Visible=true;
    			bt13.Visible=true;
    			bt14.Visible=true;
    			bt15.Visible=true;
    			bt16.Visible=true;
    		} 
    		//METODO DE VOLTEAR LAS IMAGANES
    		public void voltear()
    		{
    			
    			opor+=1;
    			kk=Convert.ToString(opor);
    			lbMovimientosGr.Text="Movimientos: " +kk;
    			if(aa==2)
    			{
    				//verificacion si dio 2 o mas clicks en el mismo boton
    				if(bb==dd)
    				{
    					//si fuera cierto espera espera a que presione otro boton diferente
    					aa=1;
    				}
    			}
    			if(aa==2)
    			{
    				//En caso de que no se cumpliera la 1ra condicion pasa a esta otra
    				if(btn2[bb]!=btn2[dd])
    				{
    					//verifica el valor de las matrices y si 
    					//fueran diferentes voltea las imagenes
    					aa=0;
    					switch(bb)
    					{
    						case 0: {btBoton1Gr.Image=System.Drawing.Bitmap.FromFile(@"21.jpg"); break;}
    						case 1: {btBoton2Gr.Image=System.Drawing.Bitmap.FromFile(@"21.jpg"); break;}
    						case 2: {btBoton3Gr.Image=System.Drawing.Bitmap.FromFile(@"21.jpg"); break;}
    						case 3: {btBoton4Gr.Image=System.Drawing.Bitmap.FromFile(@"21.jpg"); break;}
    						case 4: {btBoton5Gr.Image=System.Drawing.Bitmap.FromFile(@"21.jpg"); break;}
    						case 5: {btBoton6Gr.Image=System.Drawing.Bitmap.FromFile(@"21.jpg"); break;}
    						case 6: {btBoton7Gr.Image=System.Drawing.Bitmap.FromFile(@"21.jpg"); break;}
    						case 7: {btBoton8Gr.Image=System.Drawing.Bitmap.FromFile(@"21.jpg"); break;}
    						case 8: {btBoton9Gr.Image=System.Drawing.Bitmap.FromFile(@"21.jpg"); break;}
    						case 9: {btBoton10Gr.Image=System.Drawing.Bitmap.FromFile(@"21.jpg"); break;}
    						case 10: {btBoton11Gr.Image=System.Drawing.Bitmap.FromFile(@"21.jpg"); break;}
    						case 11: {btBoton12Gr.Image=System.Drawing.Bitmap.FromFile(@"21.jpg"); break;}
    						case 12: {bt13.Image=System.Drawing.Bitmap.FromFile(@"21.jpg"); break;}
    						case 13: {bt14.Image=System.Drawing.Bitmap.FromFile(@"21.jpg"); break;}
    						case 14: {bt15.Image=System.Drawing.Bitmap.FromFile(@"21.jpg"); break;}
    						case 15: {bt16.Image=System.Drawing.Bitmap.FromFile(@"21.jpg"); break;}
    					}
    					switch(dd)
    					{
    						case 0: {btBoton1Gr.Image=System.Drawing.Bitmap.FromFile(@"21.jpg"); break;}
    						case 1: {btBoton2Gr.Image=System.Drawing.Bitmap.FromFile(@"21.jpg"); break;}
    						case 2: {btBoton3Gr.Image=System.Drawing.Bitmap.FromFile(@"21.jpg"); break;}
    						case 3: {btBoton4Gr.Image=System.Drawing.Bitmap.FromFile(@"21.jpg"); break;}
    						case 4: {btBoton5Gr.Image=System.Drawing.Bitmap.FromFile(@"21.jpg"); break;}
    						case 5: {btBoton6Gr.Image=System.Drawing.Bitmap.FromFile(@"21.jpg"); break;}
    						case 6: {btBoton7Gr.Image=System.Drawing.Bitmap.FromFile(@"21.jpg"); break;}
    						case 7: {btBoton8Gr.Image=System.Drawing.Bitmap.FromFile(@"21.jpg"); break;}
    						case 8: {btBoton9Gr.Image=System.Drawing.Bitmap.FromFile(@"21.jpg"); break;}
    						case 9: {btBoton10Gr.Image=System.Drawing.Bitmap.FromFile(@"21.jpg"); break;}
    						case 10: {btBoton11Gr.Image=System.Drawing.Bitmap.FromFile(@"21.jpg"); break;}
    						case 11: {btBoton12Gr.Image=System.Drawing.Bitmap.FromFile(@"21.jpg"); break;}
    						case 12: {bt13.Image=System.Drawing.Bitmap.FromFile(@"21.jpg"); break;}
    						case 13: {bt14.Image=System.Drawing.Bitmap.FromFile(@"21.jpg"); break;}
    						case 14: {bt15.Image=System.Drawing.Bitmap.FromFile(@"21.jpg"); break;}
    						case 15: {bt16.Image=System.Drawing.Bitmap.FromFile(@"21.jpg"); break;}
    					}
    				}
    				else
    				{
    					//en caso de que fueran iguales los valores de las matrices
    					//se deshabilitan las imagenes para que no de otro click 
    					//sobre ellas
    					if(aa==2)
    					{
    						switch(bb)
    						{
    							case 0: {btBoton1Gr.Enabled=false; break;}
    							case 1: {btBoton2Gr.Enabled=false; break;}
    							case 2: {btBoton3Gr.Enabled=false; break;}
    							case 3: {btBoton4Gr.Enabled=false; break;}
    							case 4: {btBoton5Gr.Enabled=false; break;}
    							case 5: {btBoton6Gr.Enabled=false; break;}
    							case 6: {btBoton7Gr.Enabled=false; break;}
    							case 7: {btBoton8Gr.Enabled=false; break;}
    							case 8: {btBoton9Gr.Enabled=false; break;}
    							case 9: {btBoton10Gr.Enabled=false; break;}
    							case 10: {btBoton11Gr.Enabled=false; break;}
    							case 11: {btBoton12Gr.Enabled=false; break;}
    							case 12: {bt13.Enabled=false; break;}
    							case 13: {bt14.Enabled=false; break;}
    							case 14: {bt15.Enabled=false; break;}
    							case 15: {bt16.Enabled=false; break;}
    						}
    						switch(dd)
    						{
    							case 0: {btBoton1Gr.Enabled=false; break;}
    							case 1: {btBoton2Gr.Enabled=false; break;}
    							case 2: {btBoton3Gr.Enabled=false; break;}
    							case 3: {btBoton4Gr.Enabled=false; break;}
    							case 4: {btBoton5Gr.Enabled=false; break;}
    							case 5: {btBoton6Gr.Enabled=false; break;}
    							case 6: {btBoton7Gr.Enabled=false; break;}
    							case 7: {btBoton8Gr.Enabled=false; break;}
    							case 8: {btBoton9Gr.Enabled=false; break;}
    							case 9: {btBoton10Gr.Enabled=false; break;}
    							case 10: {btBoton11Gr.Enabled=false; break;}
    							case 11: {btBoton12Gr.Enabled=false; break;}
    							case 12: {bt13.Enabled=false; break;}
    							case 13: {bt14.Enabled=false; break;}
    							case 14: {bt15.Enabled=false; break;}
    							case 15: {bt16.Enabled=false; break;}
    						}
    					}
    					//incrementacion del marcador
    					//een caso de que las imagenes fueran iguales
    					res+=10;
    					cc=Convert.ToString(res);
    					tbPuntuacionGr.Text=cc;
    					if(res==80)
    					{
    						//si el marcador llega a 80 el juego se termina
    					
    						MessageBox.Show("JUEGO TERMINADO", "");
    						
    						btBoton1Gr.Enabled=true;
    						btBoton2Gr.Enabled=true;
    						btBoton3Gr.Enabled=true;
    						btBoton4Gr.Enabled=true;
    						btBoton5Gr.Enabled=true;
    						btBoton6Gr.Enabled=true;
    						btBoton7Gr.Enabled=true;
    						btBoton8Gr.Enabled=true;
    						btBoton9Gr.Enabled=true;
    						btBoton10Gr.Enabled=true;
    						btBoton11Gr.Enabled=true;
    						btBoton12Gr.Enabled=true;
    						bt13.Enabled=true;
    						bt14.Enabled=true;
    						bt15.Enabled=true;
    						bt16.Enabled=true;
    						tiempo();
    						tiempo();
    						gbMemoramaGr.Enabled=false;
    					}
    					aa=0;
    				}
    			}
    		}
    
    //FIN DE METODOS
    		private void Form1_Load(object sender, System.EventArgs e)
    		{
    			pordef();
    		}
    		private void bt18_Click(object sender, System.EventArgs e)
    		{
    			activate();
    			imagenes();
    			nuevo();
    		}
    		
    //Eventos de los botones del juego
    		//"aa" es igual al numero de clicks que se den
    		//si "aa==1" espera a que de el otro click
    		//si "aa==2" manda a llamar al a los metodos que compararan el valor de las matrices
    		//cuando "aa==1" se asigna la variable "bb y bb cacha el valor de la matriz"
    		//cuando "aa==2" se asigna la variable "dd y dd cacha el valor de la matriz"
    
    		public void bt1_Click(object sender, System.EventArgs e)
    		{
    			aa+=1;
    			if(aa==1)
    				bb=0;
    			btBoton1Gr.Image=System.Drawing.Bitmap.FromFile(ima[btn2[0]]);
    			if(aa==2)
    			{
    				dd=0;
    				btBoton1Gr.Refresh();
    				tiempo();
    				voltear();
    			}
    		}
    
    		public void bt2_Click(object sender, System.EventArgs e)
    		{
    			aa+=1;
    			if(aa==1)
    				bb=1;
    			btBoton2Gr.Image=System.Drawing.Bitmap.FromFile(ima[btn2[1]]);
    			if(aa==2)
    			{
    				dd=1;
    				btBoton2Gr.Refresh();			
    				tiempo();
    				voltear();
    			}
    		}
    
    		public void bt3_Click(object sender, System.EventArgs e)
    		{
    			aa+=1;
    			if(aa==1)
    				bb=2;
    			btBoton3Gr.Image=System.Drawing.Bitmap.FromFile(ima[btn2[2]]);
    			if(aa==2)
    			{
    				dd=2;
    				btBoton3Gr.Refresh();			
    				tiempo();
    				voltear();
    			}
    		}
    
    		public void bt4_Click(object sender, System.EventArgs e)
    		{
    			aa+=1;
    			if(aa==1)
    				bb=3;
    			btBoton4Gr.Image=System.Drawing.Bitmap.FromFile(ima[btn2[3]]);
    			if(aa==2)
    			{
    				dd=3;
    				btBoton4Gr.Refresh();			
    				tiempo();
    				voltear();
    			}
    		}
    
    		public void bt5_Click(object sender, System.EventArgs e)
    		{
    			aa+=1;
    			if(aa==1)
    				bb=4;
    			btBoton5Gr.Image=System.Drawing.Bitmap.FromFile(ima[btn2[4]]);
    			if(aa==2)
    			{
    				dd=4;
    				btBoton5Gr.Refresh();
    				tiempo();
    				voltear();
    			}
    		}
    
    		public void bt6_Click(object sender, System.EventArgs e)
    		{
    			aa+=1;
    			if(aa==1)
    				bb=5;
    			btBoton6Gr.Image=System.Drawing.Bitmap.FromFile(ima[btn2[5]]);
    			if(aa==2)
    			{
    				dd=5;
    				btBoton6Gr.Refresh();			
    				tiempo();
    				voltear();
    			}
    		}
    
    		public void bt7_Click(object sender, System.EventArgs e)
    		{
    			aa+=1;
    			if(aa==1)
    				bb=6;
    			btBoton7Gr.Image=System.Drawing.Bitmap.FromFile(ima[btn2[6]]);
    			if(aa==2)
    			{
    				dd=6;
    				btBoton7Gr.Refresh();			
    				tiempo();
    				voltear();
    			}
    		}
    
    		public void bt8_Click(object sender, System.EventArgs e)
    		{
    			aa+=1;
    			if(aa==1)
    				bb=7;
    			btBoton8Gr.Image=System.Drawing.Bitmap.FromFile(ima[btn2[7]]);
    			if(aa==2)
    			{
    				dd=7;
    				btBoton8Gr.Refresh();
    				tiempo();
    				voltear();
    			}
    		}
    
    		public void bt9_Click(object sender, System.EventArgs e)
    		{
    			aa+=1;
    			if(aa==1)
    				bb=8;
    			btBoton9Gr.Image=System.Drawing.Bitmap.FromFile(ima[btn2[8]]);
    			if(aa==2)
    			{
    				dd=8;
    				btBoton9Gr.Refresh();			
    				tiempo();
    				voltear();
    			}
    		}
    
    		public void bt10_Click(object sender, System.EventArgs e)
    		{
    			aa+=1;
    			if(aa==1)
    				bb=9;
    			btBoton10Gr.Image=System.Drawing.Bitmap.FromFile(ima[btn2[9]]);
    			if(aa==2)
    			{
    				dd=9;
    				btBoton10Gr.Refresh();			
    				tiempo();
    				voltear();
    			}
    		}
    
    		public void bt11_Click(object sender, System.EventArgs e)
    		{
    			aa+=1;
    			if(aa==1)
    				bb=10;
    			btBoton11Gr.Image=System.Drawing.Bitmap.FromFile(ima[btn2[10]]);
    			if(aa==2)
    			{
    				dd=10;
    				btBoton11Gr.Refresh();			
    				tiempo();
    				voltear();
    			}
    		}
    
    		public void bt12_Click(object sender, System.EventArgs e)
    		{
    			aa+=1;
    			if(aa==1)
    				bb=11;
    			btBoton12Gr.Image=System.Drawing.Bitmap.FromFile(ima[btn2[11]]);
    			if(aa==2)
    			{
    				dd=11;
    				btBoton12Gr.Refresh();			
    				tiempo();
    				voltear();
    			}
    		}
    
    		public void bt13_Click(object sender, System.EventArgs e)
    		{
    			aa+=1;
    			if(aa==1)
    				bb=12;
    			bt13.Image=System.Drawing.Bitmap.FromFile(ima[btn2[12]]);
    			if(aa==2)
    			{
    				dd=12;
    				bt13.Refresh();			
    				tiempo();
    				voltear();
    			}
    		}
    
    		public void button14_Click(object sender, System.EventArgs e)
    		{
    			aa+=1;
    			if(aa==1)
    				bb=13;
    			bt14.Image=System.Drawing.Bitmap.FromFile(ima[btn2[13]]);
    			if(aa==2)
    			{
    				dd=13;
    				bt14.Refresh();			
    				tiempo();
    				voltear();
    			}
    		}
    
    		public void bt15_Click(object sender, System.EventArgs e)
    		{
    			aa+=1;
    			if(aa==1)
    				bb=14;
    			bt15.Image=System.Drawing.Bitmap.FromFile(ima[btn2[14]]);
    			if(aa==2)
    			{
    				dd=14;
    				bt15.Refresh();			
    				tiempo();
    				voltear();
    			}
    		}
    
    		public void bt16_Click(object sender, System.EventArgs e)
    		{
    			aa+=1;
    			if(aa==1)
    				bb=15;
    			bt16.Image=System.Drawing.Bitmap.FromFile(ima[btn2[15]]);
    			if(aa==2)
    			{
    				dd=15;
    				bt16.Refresh();			
    				tiempo();
    				voltear();
    			}
    		}
    
    		private void button1_Click(object sender, System.EventArgs e)
    		{
    			Close();
    		}	
    	}
    }
    
    Perdone si es mucho codigo

    lunes, 3 de octubre de 2011 14:08

Respuestas

  • jaja, pues lo perdono, porque sí es mucho código.

    Lo que yo haría:  Una clase llamada Jugador.  Esta clase tendría el contador de parejas hechas.  Luego tendría una colección o arreglo de 2 jugadorees (o en general, de N jugadores, donde N == colección.Count) e iteraría entre los elementos cada vez que el jugador actual falla.  Ejemplo:

    class Jugador
    {
        private int m_parejas;
        private int m_id;
    
        public Jugador(int id)
        {
            m_id = id;
        }
    
        public int Parejas
        {
            get
            {
                return m_parejas;
            }
            set
            {
                m_parejas = value;
            }
        }
        public int ID
        {
            get
            {
                return m_id;
            }
        }
        //Agregar otras propiedades según le convenga.  Tal vez un nombre?
    }
    
    //Necesita un arreglo o colección a nivel de formulario que contiene
    //la lista de jugadores.
    private Jugador[] jugadores = new Jugador[] { new Jugador(1), new Jugador(2) };
    //Luego necesita una variable a nivel de formulario que "sepa" quién es el jugador activo.
    //Necesita saber la posición del jugador en el arreglo de jugadores:
    private int jugadorActual;
    
    //Setee la variable en Form_Load() o cuando se inicia/reinicia un juego.
    jugadorActual = 0;
    
    //En el código que verifica si el jugador logró un par, debe
    //cambiar de jugador actual si no se logró un par.
    jugadorActual = (jugadorActual + 1) % jugadores.Length;
    
    //En el mismo bloque, debe actualizar la cuenta de parejas si el jugador
    //logra una pareja:
    jugadores[jugadorActual].Parejas++;
    
    

    Espero le sirva.


    Jose R. MCP
    lunes, 3 de octubre de 2011 14:23
    Moderador