Exemplo n.º 1
0
        public int UpdateBoard(Board.Game board)
        {
            if (!IsInitialized())
            {
                logger_.Info("Engine is not initialized.");
                return(-1);
            }

            if (IsRunning())
            {
                logger_.Info("Engine is running. Please stop the runner before updaing the board.");
                return(-1);
            }

            System.Runtime.Serialization.Json.DataContractJsonSerializer ser =
                new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(Board.Game));
            MemoryStream ms = new MemoryStream();

            ser.WriteObject(ms, board);
            ms.Position = 0;

            StreamReader sr   = new StreamReader(ms);
            string       json = sr.ReadToEnd();

            return(engine_.UpdateBoard(json));
        }
Exemplo n.º 2
0
 public ActionGetBestMove(int sequence, Board.Game game)
     : base(sequence, "GetBestMove")
 {
     this.game = game;
 }
 public ActionUpdateBoard(int sequence, Board.Game game)
     : base(sequence, "UpdateBoard")
 {
     this.game = game;
 }