-
Notifications
You must be signed in to change notification settings - Fork 0
/
GameInfo.cs
91 lines (76 loc) · 2.86 KB
/
GameInfo.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
namespace Codebreaker.GameAPIs.Client.Models;
/// <summary>
/// Complete information about a single game - including the soltuion and the moves the player made.
/// </summary>
/// <param name="id">The unique identifier of the game</param>
/// <param name="gameType"></param>
/// <param name="playerName"></param>
/// <param name="startTime"></param>
/// <param name="numberCodes"></param>
/// <param name="maxMoves"></param>
public class GameInfo(
Guid id,
string gameType,
string playerName,
DateTime startTime,
int numberCodes,
int maxMoves)
{
/// <summary>
/// Gets the unique identifier of the game.
/// </summary>
public Guid Id { get; private set; } = id;
/// <summary>
/// Gets the type of the game. <see cref="GameType"/>
/// </summary>
public string GameType { get; private set; } = gameType;
/// <summary>
/// Gets the name of the player.
/// </summary>
public string PlayerName { get; private set; } = playerName;
/// <summary>
/// Gets information if the player was authenticated while playing the game.
/// </summary>
public bool PlayerIsAuthenticated { get; set; } = false;
/// <summary>
/// Gets the start time of the game
/// </summary>
public DateTime StartTime { get; private set; } = startTime;
/// <summary>
/// Gets the end time of the game or null if it did not end yet. This value is set from a game guess anylzer after the game was ended.
/// </summary>
public DateTime? EndTime { get; set; }
/// <summary>
/// Gets the duration of the game or null if it did not end yet
/// </summary>
public TimeSpan? Duration { get; set; }
/// <summary>
/// Gets the last move number. This number is set from an game move analyzer after the move was set.
/// </summary>
public int LastMoveNumber { get; set; } = 0;
/// <summary>
/// Gets the number of codes the player needs to fill.
/// </summary>
public int NumberCodes { get; private set; } = numberCodes;
/// <summary>
/// Gets the maximum number of moves the game ends when its not solved.
/// </summary>
public int MaxMoves { get; private set; } = maxMoves;
/// <summary>
/// Did the player win the game?
/// </summary>
public bool IsVictory { get; set; } = false;
/// <summary>
/// A list of possible field values the user has to chose from
/// </summary>
public required IDictionary<string, IEnumerable<string>> FieldValues { get; init; }
/// <summary>
/// This is the solution of the game with string representations of the codes
/// </summary>
public required string[] Codes { get; init; }
/// <summary>
/// A list of moves the player made
/// </summary>
public ICollection<MoveInfo> Moves { get; init; } = [];
public override string ToString() => $"{Id}:{GameType} - {StartTime}";
}