summaryrefslogtreecommitdiff
path: root/Events/GameFinishedEvent.cs
diff options
context:
space:
mode:
authorRamaekers,Aldrik A.N <a.ramaekers@student.fontys.nl>2020-09-16 09:42:04 +0200
committerRamaekers,Aldrik A.N <a.ramaekers@student.fontys.nl>2020-09-16 09:42:04 +0200
commitf6f3bbbc5b7741ad0db3c88a398cfc3943988529 (patch)
treef9f3aca3cc688369607060336b699b8f711eb360 /Events/GameFinishedEvent.cs
parent5a045404f3c49022abeb75c27dfe6f82d35928f7 (diff)
Diffstat (limited to 'Events/GameFinishedEvent.cs')
-rw-r--r--Events/GameFinishedEvent.cs50
1 files changed, 50 insertions, 0 deletions
diff --git a/Events/GameFinishedEvent.cs b/Events/GameFinishedEvent.cs
new file mode 100644
index 0000000..22cf26a
--- /dev/null
+++ b/Events/GameFinishedEvent.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Chess.Events
+{
+ public enum GameFinishedReason
+ {
+ CheckMate,
+ InsufficientMaterial,
+ Stalemate,
+
+ /// <summary>
+ /// Not implemented from here on.
+ /// </summary>
+ Resignation,
+ Move75,
+ Repetition,
+ Agreement,
+ }
+
+ public class GameFinishedEvent : EventArgs
+ {
+ public Player Winner { get; }
+ public GameFinishedReason Reason { get; set; }
+
+ public GameFinishedEvent(Player winner, GameFinishedReason reason)
+ {
+ Winner = winner;
+ Reason = reason;
+ }
+
+ public string GetWinnerName()
+ {
+ if (Winner != null)
+ {
+ return Winner.IsWhite ? "White" : "Black";
+ }
+
+ return "";
+ }
+
+ public string GetFinishReason()
+ {
+ return Reason.ToString();
+ }
+ }
+}