当前位置: 首页>>代码示例>>C#>>正文


C# AI.end方法代码示例

本文整理汇总了C#中AI.end方法的典型用法代码示例。如果您正苦于以下问题:C# AI.end方法的具体用法?C# AI.end怎么用?C# AI.end使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AI的用法示例。


在下文中一共展示了AI.end方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

    public static void Main(string[] args)
    {
        if (args.Length == 0)
        {
            Bb.maxX = 5;
            Bb.maxY = 5;

            Point[] starts = { new Point() };
            Func<Point, bool> isGoal = p => p.x == 4 && p.y == 4;
            BitArray passable = new BitArray(new bool[] {
                true, false, true, true, true,
                true, true, true, false, true,
                true, true, true, false, true,
                true, false, false, false, true,
                true, true, true, true, true,
            });

            var path = Pather.AStar(starts, isGoal, passable, (c, n) => n.x == 0 ? 1 : 0, p => 0);
            foreach (Point p in path)
            {
                Console.WriteLine(p);
            }
        }

        if (args.Length < 1)
        {
            System.Console.WriteLine("Please enter a hostname");
            return;
        }

        IntPtr connection = Client.createConnection();

        AI ai = new AI(connection);
        if (Client.serverConnect(connection, args[0], "19000") == 0)
        {
            System.Console.WriteLine("Unable to connect to server");
            return;
        }

        if (Client.serverLogin(connection, ai.username(), ai.password()) == 0)
            return;

        if (args.Length < 2)
            Client.createGame(connection);
        else
            Client.joinGame(connection, Int32.Parse(args[1]), "player");

        while (Client.networkLoop(connection) != 0)
        {
            if (ai.startTurn())
                Client.endTurn(connection);
            else
                Client.getStatus(connection);
        }

        Client.networkLoop(connection); //Grab end game state
        Client.networkLoop(connection); //Grab log
        ai.end();
    }
开发者ID:BobBuehler,项目名称:megaminerai12,代码行数:59,代码来源:Main.cs

示例2: Main

  public static void Main(string[] args)
  {
    if(args.Length < 1)
    {
      System.Console.WriteLine("Please enter a hostname");
      return;
    }

    IntPtr connection = Client.createConnection();

    AI ai = new AI(connection);
    if((Client.serverConnect(connection, args[0], "19000")) == 0)
    {
      System.Console.WriteLine("Unable to connect to server");
      return;
    }
    if((Client.serverLogin(connection, ai.username(), ai.password())) == 0)
    {
      return;
    }

    if(args.Length < 2)
    {
      Client.createGame(connection);
    }
    else
    {
      Client.joinGame(connection, Int32.Parse(args[1]));
    }
    while(Client.networkLoop(connection) != 0)
    {
      if(ai.startTurn())
      {
        Client.endTurn(connection);
      }
      else
      {
        Client.getStatus(connection);
      }
    }
    Client.networkLoop(connection); //Grab end game state
    Client.networkLoop(connection); //Grab log
    ai.end();
    return;
  }
开发者ID:NortySpock,项目名称:Megaminer-7,代码行数:45,代码来源:Main.CS

示例3: Main

    public static void Main(string[] args)
    {
        if (args.Length < 1)
        {
            System.Console.WriteLine("Please enter a hostname");

            Bb.Width = 5;
            Bb.Height = 5;

            var passable = new BitArray(new bool[] {
                true, false, true, true, true,
                true, false, true, true, true,
                true, false, false, false, true,
                true, false, true, true, true,
                true, true, true, true, true
            });

            var start = new Point(0, 0);
            var goal = new Point(2, 0);

            var path = Pather.AStar(
                new[] { start },
                passable.ToFunc(),
                p => p.Equals(goal),
                (p1, p2) => p2.y == 0 ? 10 : 1,
                p => 0);

            path.ForEach(p => Console.WriteLine(p));
            Console.WriteLine("Done");

            return;
        }

        IntPtr connection = Client.createConnection();

        AI ai = new AI(connection);
        if (Client.serverConnect(connection, args[0], "19000") == 0)
        {
            System.Console.WriteLine("Unable to connect to server");
            return;
        }

        if (Client.serverLogin(connection, ai.username(), ai.password()) == 0)
            return;

        if (args.Length < 2)
            Client.createGame(connection);
        else
            Client.joinGame(connection, Int32.Parse(args[1]), "player");

        while (Client.networkLoop(connection) != 0)
        {
            if (ai.startTurn())
                Client.endTurn(connection);
            else
                Client.getStatus(connection);
        }

        Client.networkLoop(connection); //Grab end game state
        Client.networkLoop(connection); //Grab log
        ai.end();
    }
开发者ID:BobBuehler,项目名称:megaminerai13,代码行数:62,代码来源:Main.cs


注:本文中的AI.end方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。