Exemple #1
0
        private int NextStep()
        {
            string str = _gui.GetNextStep();

            string[] strs = str.Split(new char[] { ' ' });
            if (strs.Length < 2 ||
                !int.TryParse(strs[0], out _x) ||
                !int.TryParse(strs[1], out _y) ||
                _x <posMin || _y <posMin || _x> posMax || _y> posMax)
            {
                return(tryAgainCode);
            }

            --_x; --_y;
            if (_lastX != -1 && _lastY != -1 &&
                (_lastX != _x / size || _lastY != _y / size))
            {
                return(tryAgainCode);
            }

            int result = Set(_x, _y, _player);

            if (result != -1)
            {
                return(result);
            }

            return(tryAgainCode);
        }