-
Notifications
You must be signed in to change notification settings - Fork 0
/
FuturesPositioner.cs
46 lines (42 loc) · 1.25 KB
/
FuturesPositioner.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
using System.Collections.Generic;
using System.Linq;
using lib.GraphImpl;
using lib.Structures;
using MoreLinq;
using NUnit.Framework;
namespace lib.Ai
{
public class FuturesPositioner
{
private readonly Map map;
private readonly Graph graph;
private readonly MineDistCalculator minDists;
private readonly IList<int> path;
public FuturesPositioner(Map map, Graph graph, IList<int> path, MineDistCalculator minDists)
{
this.map = map;
this.graph = graph;
this.path = path;
this.minDists = minDists;
}
public Future[] GetFutures()
{
var minesOnPath = path.Where(id => map.Mines.Contains(id)).ToList();
var nonMinesOnPath = path.Where(id => !map.Mines.Contains(id)).ToList();
return minesOnPath
.Select(
mine => new Future(
mine,
nonMinesOnPath.MaxBy(site => minDists.GetDist(mine, site) + graph.Vertexes[site].Edges.Count / 10)))
.ToArray();
}
}
[TestFixture]
public class FuturesPositioner_Should
{
[Test]
public void DoSomething_WhenSomething()
{
}
}
}