1. Tictactoe

    Mensajes [1] - Enviado el Martes 20 de Mayo de 2008 a las 14:14hs

    Hola queria hacer un tictactoe/tateti, en el cual juege un usuario contra la maquina y esa maquina aprenda de las jugadas del usuario hasta q llegue el momento en el que la maquina no pueda ser derrotada... si me pueden ayudar, dejo codigo que hasta ahora hize...

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

    namespace WindowsApplication1
    {
    ??? public partial class Form1 : Form
    ??? {
    ?? ? ?? Button x;
    ??? ? ? int z = 1;
    ? ??? ? bool sw;
    ?? ?? ? int[] vec = new int[10];
    ?? ?? ? int[][] buenas = new int[10][];
    ?? ?? ? int[][] malas = new int[10][];

    ??? ??? public Form1()
    ??? ??? {
    ??? ??? ??? InitializeComponent();
    ??? ??? }

    ??? ??? public void lala()
    ??? ??? {

    ??? ?? ?? /*****CREACION DINAMICA DE LOS BOTONES****/
    ??? ??? ??? ??? int a = 0, g = 0;
    ??? ??? ??? ??? for (int i = 0; i < 3; i++)
    ??? ??? ?? {
    ??? ??? ??? ??? for (int j = 0; j < 3; j++)
    ??? ??? ??? ??? {
    ??? ??? ??? ?? ? ?? x = new Button();
    ??? ? ??? ? ??? ??? x.Visible = true;
    ??? ??? ??? ? ? ??? x.Left = a;
    ??? ?? ?? ? ??? ??? x.Height = 75;
    ??? ?? ?? ? ??? ??? x.Top = g;
    ??? ??? ??? ??? ??? x.Text = z.ToString();
    ??? ??? ??? ??? ??? this.Controls.Add(x);
    ??? ??? ??? ??? ??? vec[z] = z;
    ??? ??? ??? ??? ??? x.Click += new EventHandler(tateti_Click);
    ??? ??? ??? ??? ??? a += 75;
    ??? ??? ??? ??? ??? z += 1;
    ???? ??? ??? ??? }
    ??? ??? ??? a = 0;
    ??? ??? ??? g += 75;
    ??? ??? }
    }

    public void tateti_Click(object sender, EventArgs e)
    {
    ??? ??? Button a = (Button)sender;
    ??? ??? buenas[i] = new int[9];
    ??? ??? malas[i] = new int[9];
    ??? ??? if (sw == true)
    ??? ?? {

    ??? ??? ??? a.Text = "x";
    ??? ??? ??? a.Enabled = false;
    ??? ??? ??? sw = false;

    ??? ?? }
    ??? else
    ??? ??? {??? ?
    ??? ??? /* if() Si la jugada esta guardada*/
    ??? ??? /* Random b = new Random();
    ??? ??? int N = b.Next(1,9);*/

    ??? ??? a.Text = "0";
    ??? ??? a.Enabled = false;
    ??? ??? sw = true;
    ??? ??? }
    }

    private void Form1_Load(object sender, EventArgs e)
    {

    }


    /* Radio Buttons para Saber si es player 1 o player 2*/


    ??? private void radioButton1_CheckedChanged(object sender, EventArgs e)
    ??? {
    ? ??? ? sw = true;
    ??? ??? radioButton1.Visible = false;
    ??? ??? radioButton2.Visible = false;
    ??? ? ? lala();
    ??? }

    ??? private void radioButton2_CheckedChanged(object sender, EventArgs e)
    ??? {
    ??? ??? sw = false;
    ??? ? ? radioButton1.Visible = false;
    ??? ? ? radioButton2.Visible = false;
    ??? ? ? lala();
    ??? }
    }
    }

    ?


responder

Para poder responder a este tema tenes que ingresar. Si no tenes una cuenta podes registrarse gratis..

publicidad

API DE FACEBOOK
GOOGLE CALENDAR API
GOOGLE MAPS API