private async Task AutoPlay() { var game = await GetGame(); if (game.Status != GameStatus.Playing) { return; } // Call victoria engine var board = _adapter.FromGameMoves(_context.GameMove.ToArray()); var cordinate = _engine.FindBestMove(board, Color.White, TimeSpan.FromSeconds(10)); var autoMove = _adapter.ToGameMove(cordinate, Color.White); // Call simple alpha-beta algorithm //AutoPlayMove[][] board = _adapter.GameMovesToAutoPlayMoves(_context.GameMove.ToArray()); //AutoPlayMove decision = _autoPlayService.MakeDecision(board); //var autoMove = _adapter.AutoPlayMovesToGameMove(decision); _context.GameMove.Add(autoMove); if (await Judge(autoMove)) { game.Status = GameStatus.WhiteSideWon; } else { game.NextPlayer = game.BlackSidePlayer; } await _context.SaveChangesAsync(); var message = new WebSocketMessage() { Type = "GameMove", Payload = autoMove }; await _socket.BroadcastMessage(message); message = new WebSocketMessage() { Type = "Game", Payload = game }; await _socket.BroadcastMessage(message); }