You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.6 KiB
63 lines
1.6 KiB
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace FiveLetters.Model
|
|
{
|
|
public class FiveLettersResult
|
|
{
|
|
|
|
public DateTime DateStart { get; }
|
|
public string TaskGuid { get; }
|
|
public string User { get; }
|
|
public EResultGameType Result { get; set; }
|
|
public List<FiveLettersItemResult> Attempts { get; set; }
|
|
|
|
public FiveLettersResult(string user, string taskGuid)
|
|
{
|
|
Attempts = new List<FiveLettersItemResult>();
|
|
User = user;
|
|
TaskGuid = taskGuid;
|
|
DateStart = DateTime.Now;
|
|
}
|
|
|
|
internal void AddAttempt(List<FiveLettersItemLetterResult> result)
|
|
{
|
|
var res = new FiveLettersItemResult(result);
|
|
if (Result != EResultGameType.InProcess)
|
|
{
|
|
return;
|
|
}
|
|
|
|
Attempts.Add(res);
|
|
}
|
|
|
|
public HashSet<char> GetLettersFullMatch()
|
|
{
|
|
HashSet<char> fm = new HashSet<char>();
|
|
foreach (var att in Attempts)
|
|
{
|
|
var attFm = att.GetLettersFullMatch();
|
|
foreach (char ch in attFm)
|
|
{
|
|
fm.Add(ch);
|
|
}
|
|
}
|
|
return fm;
|
|
}
|
|
|
|
public HashSet<char> GetLettersPartialMatch()
|
|
{
|
|
HashSet<char> fm = new HashSet<char>();
|
|
foreach (var att in Attempts)
|
|
{
|
|
var attFm = att.GetLettersPartialMatch();
|
|
foreach (char ch in attFm)
|
|
{
|
|
fm.Add(ch);
|
|
}
|
|
}
|
|
return fm;
|
|
}
|
|
|
|
}
|
|
}
|
|
|