private bool MakePlayerMove(Tile start, Tile dest) { Direction d = Board.GetDirection(start, dest); // check whether the direction has already been used // and whether moving was successful var move = GameBoard.MovePiece(start, dest); if (!CurrentMoveChain.Contains(d) && move!=null) { //CurrentMoveChain.Add(d); if (move.CapturedTiles.Keys.Count > 1) { possibleMove = move; GameBoard.MakeMove(move, move.CapturedTiles.Keys.First()); } else { //CurrentPlayerTurnState = PlayerTurnState.Moved; if (move.CapturedTiles.Keys.Any()) { var dir = move.CapturedTiles.Keys.First(); GameBoard.MakeMove(move, dir); } } EndTurn(); Console.WriteLine("Added "+ d.ToString()); return true; } return false; }
private void EndTurn() { CurrentPlayerTurnState = PlayerTurnState.NoMove; SelectedPiece = null; CurrentPlayer = Player.Computer; possibleMove = null; }