private void MakeMove(Types.Move move) { _currentGame = Game.makeMove(move, _currentGame); PostMakeMoveOrNewGame(); if (!_isHumanMove && !Game.isFinished(_currentGame)) { var UISyncContext = TaskScheduler.FromCurrentSynchronizationContext(); Task.Factory.StartNew(() => { return AI.runComputerMove(_currentGame); }).ContinueWith(cpuMove => { MakeMove(cpuMove.Result); }, UISyncContext); } }
public DotsAndBoxesGameViewModel(Types.Game game) { _currentGame = game; }
public void StartNewGame() { _currentGame = new Types.Game(_selectedSize, _selectedSize, FSharpList<Types.Move>.Empty); PostMakeMoveOrNewGame(); NotifyOfPropertyChange(() => Dots); }