示例#1
0
 public Map ToMap(int seedValue)
 {
     var f = new bool[width, height];
     foreach (var cell in filled)
         f[cell.x, cell.y] = true;
     var us = units.Select(u => u.ToUnit()).ToList();
     var g = new LinearGenerator(seedValue);
     var unitsSeq = Enumerable
         .Range(0, sourceLength)
         .Select(i => us[g.Next() % us.Count])
         .Reverse()
         .Aggregate(ImmutableStack<Unit>.Empty, (stack, unit) => stack.Push(unit));
     return new Map(id, f, unitsSeq, new Scores(0, 0));
 }
示例#2
0
 public void Test()
 {
     var gen = new LinearGenerator(17);
     foreach (var expected in new[] {0, 24107, 16552, 12125, 9427, 13152, 21440, 3383, 6873, 16117})
         Assert.AreEqual(expected, gen.Next());
 }