當前位置: 首頁>>代碼示例>>C#>>正文


C# AI.startTurn方法代碼示例

本文整理匯總了C#中AI.startTurn方法的典型用法代碼示例。如果您正苦於以下問題:C# AI.startTurn方法的具體用法?C# AI.startTurn怎麽用?C# AI.startTurn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在AI的用法示例。


在下文中一共展示了AI.startTurn方法的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.startTurn方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。