public MoveResult Move(PlayerToken playerToken) { var diceResult = _dice.Roll(); if (!ValidateMove(playerToken, diceResult)) { return new MoveResult { NewSquare = playerToken.GetCurrentSquare(), Status = MoveStatus.Rejected } } ; playerToken.Move(diceResult); if (IsPlayerWon(playerToken)) { return new MoveResult { NewSquare = playerToken.GetCurrentSquare(), Status = MoveStatus.GameWon } } ; return(new MoveResult { NewSquare = playerToken.GetCurrentSquare(), Status = MoveStatus.Moved }); }
private bool IsPlayerWon(PlayerToken playerToken) { return(playerToken.GetCurrentSquare() == _gameSettings.WinnerSquare); }
private bool ValidateMove(PlayerToken playerToken, int diceResult) { return(playerToken.GetCurrentSquare() + diceResult <= _gameSettings.WinnerSquare); }