-
Notifications
You must be signed in to change notification settings - Fork 2
/
Result.cs
44 lines (37 loc) · 960 Bytes
/
Result.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
using Deadline;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public class Result
{
public long Quality;
public GameState State;
public List<SolutionAction> Actions = new List<SolutionAction>();
public const long WorstQuality = -1000000000;
public Result(GameState state)
{
this.State = state;
}
public Result(GameState state, List<SolutionAction> act)
{
this.State = state;
Actions = act.ToList();
// calculate quality
CalculateQuality();
}
public long CalculateQuality()
{
Quality = WorstQuality;
return Quality;
}
public void FixAndValidate()
{
// created result may be invalid so this is an optional safe guard
}
public Result PickBetter(Result other)
{
return CalculateQuality() >= other.CalculateQuality() ? this : other;
}
}