Finish game

This commit is contained in:
Andrew Cooper
2023-01-21 22:24:20 +11:00
parent 051f3eb5d5
commit 62db3a9c9a
10 changed files with 81 additions and 36 deletions

View File

@@ -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;
}