Ejemplo n.º 1
0
 public AI(Grid g)
 {
     this.Chain = new List<Point>();
     this.Grid = g;
     this.RNG = new Random();
     this.ShipsDestroyed = 0;
 }
Ejemplo n.º 2
0
 static void DoAI()
 {
     var g = new Grid();
     var ai = new AI(g);
     ai.Grid.DisplayGrid();
     while (!ai.Grid.AllShipsDestroyed)
     {
         //ai.Grid.DisplayGrid();
         ai.Target();
         //System.Threading.Thread.Sleep(50);
     }
     ai.Grid.DisplayGrid();
     Console.WriteLine();
     Console.WriteLine("YOU WON!!!!!!!!!! YEAH!");
     Console.WriteLine();
     Console.ReadKey();
 }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            DoAI();

            var grid = new Grid();

            while (!grid.AllShipsDestroyed)
            {
                grid.DisplayGrid(true);
                string x; string y;
                do
                {
                    Console.WriteLine("Enter coordinates (x, y):");
                    Console.Write("(");
                    x = Console.ReadKey().KeyChar.ToString();
                    Console.Write(", ");
                    y = Console.ReadKey().KeyChar.ToString();
                    Console.Write(")");
                    Console.WriteLine();
                } while (!("0123456789".Contains(x) && "0123456789".Contains(y)));

                if ("asdfsdf".All(char.IsDigit))
                {

                }
                int aNumber = 0;
                if (!int.TryParse(Console.ReadLine(), out aNumber))
                {

                }

                grid.Target(int.Parse(x), int.Parse(y));
            }

            grid.DisplayGrid();
            Console.WriteLine();
            Console.WriteLine("YOU WON!!!!!!!!!! YEAH!");
            Console.WriteLine();

            Console.ReadKey();
        }