Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="goban"></param>
        /// <returns></returns>
        public Vector2D GetPlays(List <List <byte> > goban)
        {
            string param = "";

            for (int indexX = 0; indexX < goban.Count; indexX++)
            {
                for (int indexY = 0; indexY < goban[indexX].Count; indexY++)
                {
                    if (goban[indexX][indexY] == 0)
                    {
                        param += "&" + indexX + "." + indexY + "=0";
                    }
                    else if (goban[indexX][indexY] == 3)
                    {
                        param += "&" + indexX + "." + indexY + "=-1";
                    }
                    else
                    {
                        param += "&" + indexX + "." + indexY + "=" + (gameController.WhoIsPlayingBool() ? gameController.GetCase(new Vector2D(indexX, indexY)) == 1 ? "1" : "-1" : gameController.GetCase(new Vector2D(indexX, indexY)) == 2 ? "1" : "-1");
                    }
                }
            }

            api.CallWithGetParams("?" + shift(param));

            ApiBotResult result = api.GetResultBot();

            if (result == null)
            {
                throw new System.Exception("Result of the api is null");
            }

            return(new Vector2D(result.x, result.y));

            //System.Random rng = new System.Random();
            //Vector2D temp;
            //do
            //{
            //    temp = new Vector2D(rng.Next(goban.Count), rng.Next(goban.Count));
            //}
            //while (goban[temp.X][temp.Y] != 0);
            //return temp;
        }