|
|
@ -189,10 +189,10 @@ namespace Models.Game
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Ends the game.
|
|
|
|
/// Ends the game.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
private void EndGame()
|
|
|
|
private void EndGame(int? pts)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_isRunning = false;
|
|
|
|
_isRunning = false;
|
|
|
|
GameEnded?.Invoke(this, new GameEndedEventArgs(CurrentPlayer));
|
|
|
|
GameEnded?.Invoke(this, new GameEndedEventArgs(CurrentPlayer, pts));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
@ -204,7 +204,17 @@ namespace Models.Game
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (Turn == 20)
|
|
|
|
if (Turn == 20)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
EndGame();
|
|
|
|
foreach(var cells in UsedMap.Boards)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
GameRules.IsZoneValidAndAddToZones(cells, UsedMap);
|
|
|
|
|
|
|
|
AddToRopePath(cells, GameRules.EveryAdjacentCells(cells, UsedMap.Boards));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
int? points = GameRules.FinalCalculusOfZones(UsedMap.Zones);
|
|
|
|
|
|
|
|
for (int i = 0; i < UsedMap.RopePaths.Count; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
points += GameRules.ScoreRopePaths(UsedMap.RopePaths[i]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
EndGame(points);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|