public void GetPaths_ToTwoHoles_Found() { var field = Field.Create(0, 0, 0, @" .......... .......... .......... ...XXX.... ....X..... "); var targets = new int[] { 0, 0, 0, 0, 0x28 }; var candidates = new List <MoveCandiate>(); foreach (var candidate in MoveGenerator.GetPaths(field, Block.J, targets, 4)) { candidates.Add(candidate); Console.WriteLine(candidate.Field.ToString().Replace("|", Environment.NewLine)); Console.WriteLine(candidate.Path); Console.WriteLine(); } var act = candidates.Select(c => c.Field.ToString()).ToArray(); var exp = new string[] { "..........|..........|..........|.X.XXX....|.XXXX.....", "..........|..........|......X...|...XXXX...|....XXX...", }; CollectionAssert.AreEqual(exp, act); }
public void GetPaths_LongPath_LongValidPath() { var field = Field.Create(0, 0, 0, @" .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......X.. XXXXXXXX.. XXXXXXX..."); var targets = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0080 }; var candidates = new List <MoveCandiate>(); foreach (var candidate in MoveGenerator.GetPaths(field, Block.J, targets, 20)) { candidates.Add(candidate); Console.WriteLine(candidate.Field.ToString().Replace("|", Environment.NewLine)); Console.WriteLine(candidate.Path); Console.WriteLine(); } var act = candidates.Select(c => c.Path.ToString()).ToArray(); var exp = new string[] { "down,down,down,down,down,down,down,down,down,down,down,down,down,down,down,left,left,left,turnleft,turnleft,right,right,right,right,right,right,right,turnright,right,down,down,down,left", }; CollectionAssert.AreEqual(exp, act); }