private ShotConfig ConfigureShot() { ShotConfig shotConfig = new ShotConfig(); shotConfig.RowNumber = _userInterface.GetShotRow(); shotConfig.ColumnNumber = _userInterface.GetShotColumn(); return(shotConfig); }
public void Play() { do { ShotConfig shotConfig = ConfigureShot(); Shot.Result shotResult = Shoot(shotConfig); _userInterface.PrintShotResult(shotResult); _userInterface.PrintNumberOfShipsOnBoard(_board.ShipsOnBoard); _userInterface.PrintBoardStatus(_board); } while (!_board.IsClear); }
private Shot.Result Shoot(ShotConfig shotConfig) { BoardField targetField = _board.GetField(shotConfig.RowNumber, shotConfig.ColumnNumber); Shot.Result shotResult = targetField.Shoot(); if (shotResult == Shot.Result.Destroyed) { _board.DecreaseShipsNumber(); } _statistics.IncreaseShots(); if (shotResult != Shot.Result.Missed) { _statistics.IncreaseShotsOnTarget(); } return(shotResult); }