Ejemplo n.º 1
0
        private void PlaceFromOnline()
        {
            GomokuSocket.On("NextStepIs", (data) =>
            {
                int Row = (int)((JObject)data)["row"];
                int Col = (int)((JObject)data)["col"];

                if ((int)((JObject)data)["player"] == 0) //1 is Me, 0 is Other;
                {
                    return;
                }

                this.Dispatcher.Invoke(() =>
                {
                    Check(false, CaroButt[Row, Col]);
                });

                PlayBoard.Place(Row, Col);

                if (Board.CurrentMode == PlayMode.MachineVsOnline)
                {
                    Thread AIThread = new Thread(PlayBoard.AIPlace); //Create a new thread to run AI algorithm
                    AIThread.Start();
                }
            });
        }