private async Task MovePiece(Coord from, Coord to) { board.Move(new Move(from, to)); seachBoard.Move(new Move(from, to)); viewBoard.InvalidateVisual(); if (board.IsOver()) { ShowResult(); return; } searching = true; var move = await Task.Run(() => { return(searchEngine.SeachABestMove(seachBoard, AiFlag)); }); board.Move(move); seachBoard.Move(move); viewBoard.InvalidateVisual(); searching = false; if (board.IsOver()) { ShowResult(); } }
private void OnReceiveOk() => gameWindow.Dispatcher.Invoke(() => { waitOk = false; board.Move(waitMove); viewBoard.InvalidateVisual(); turnSelf = false; if (board.IsOver()) { ShowResult(); } Console.WriteLine("Receive OK"); });