Exemple #1
0
        private bool validInput(string msg, ref int[] start, ref int[] target)
        {
            if (msg.Length < 4)
            {
                return(false);
            }

            msg = msg.ToUpper();
            string startMsg  = msg.Substring(0, 2);
            string targetMsg = msg.Substring(2, 2);

            if (ClientUtil.stringToCoord(startMsg, ref start) == false || ClientUtil.stringToCoord(targetMsg, ref target) == false)
            {
                return(false);
            }

            return(true);
        }
        protected override void playMove(string input)
        {
            string move = MainClass.playBotMove(input);

            int[] start = new int[2], target = new int[2];
            if (ClientUtil.stringToCoord(move.Substring(0, 2), ref start) == false || ClientUtil.stringToCoord(move.Substring(2, 2), ref target) == false)
            {
                return;
            }

            if (botColor == Game.PlayerColor.Black)
            {
                ClientUtil.rotateCoords(boardHeight, ref start, ref target);
            }

            move = ClientUtil.moveToString(start, target);
            MainThread.fireEventAtMainThread(() => { theClientController.onOutgoingLocalMsg(move, botColor); });
        }