mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2026-01-02 00:00:14 -08:00
Finish game
This commit is contained in:
@@ -28,19 +28,18 @@ internal class Reign
|
||||
|
||||
_io.Write(year.Status);
|
||||
|
||||
if (year.GetPlayerActions())
|
||||
var result = year.GetPlayerActions() ?? year.EvaluateResults() ?? IsAtEndOfTerm();
|
||||
if (result.IsGameOver)
|
||||
{
|
||||
_io.WriteLine();
|
||||
_io.WriteLine();
|
||||
year.EvaluateResults();
|
||||
_yearNumber++;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_io.WriteLine();
|
||||
_io.Write(Goodbye);
|
||||
_io.WriteLine(result.Message);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private Result IsAtEndOfTerm()
|
||||
=> _yearNumber == MaxTerm
|
||||
? Result.GameOver(EndCongratulations(MaxTerm))
|
||||
: Result.Continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user