示例#1
0
        public async Task <object> MakeMove(object moveData)
        {
            var move = await _validator.MakeMove(moveData);

            var userMoved = (GameState)moveData;
            var response  = await _ai.GetMoveAsync(userMoved, new ChessAI.Settings
            {
                IsWhite     = !(Settings as ChessSettings).IsWhite,
                Miliseconds = 10,
                MinLevel    = level
            });

            await _validator.MakeMove(userMoved.GetWithMove(response.Item1, response.Item2));

            await Task.Run(() => {
                MoveReceived?.Invoke(response);
            });

            return(move);
        }
        public async Task <object> MakeMove(object moveData)
        {
            var move = await _validator.MakeMove(moveData);

            var userMoved = (GameState)moveData;

            RemoteManager.SendData(new RemoteData {
                State = GameStateQuery.Move,
                Move  = new Tuple <BPosition, BPosition>(userMoved.LastMove.Item1, userMoved.LastMove.Item2)
            },
                                   _connection);
            return(move);
        }
 public async Task <object> MakeMove(object moveData)
 {
     return(await _validator.MakeMove(moveData));
 }