public void TestNorth() { Cell <bool> seed = Honeycomb <bool> .Create(true); Honeycomb <bool> bhc = seed.Honeycomb; Cell <bool> cell = bhc.AddNorth(seed, false); Assert.AreEqual(2, bhc.Count); Assert.AreEqual(cell, seed.North); Assert.AreEqual(seed, cell.South); }
private Honeycomb <bool> CreateHex19(out Cell <bool>[] tops, out Cell <bool>[] bottoms) { Cell <bool> seed = Honeycomb <bool> .Create(true); Honeycomb <bool> bhc = seed.Honeycomb; Cell <bool> cell; // 15 columns - col[0] -> col[14] // seed is top of col11 - tops[11] tops = new Cell <bool> [15]; bottoms = new Cell <bool> [15]; // create tops 1->13 starting from seed - tops[11] // tops 12->13 - going east from seed tops[11] = seed; // top of col 12 is SE of top of col 11 tops[12] = bhc.AddSouthEast(tops[11], false); // top of col 13 is NE of top of col 12 tops[13] = bhc.AddNorthEast(tops[12], false); // fill columns 11->13 - going south each time // col 11 - 8 cells, need to create 7 more cell = bhc.AddSouth(tops[11], false); cell = bhc.AddSouth(cell, false); cell = bhc.AddSouth(cell, false); cell = bhc.AddSouth(cell, false); cell = bhc.AddSouth(cell, false); cell = bhc.AddSouth(cell, false); cell = bhc.AddSouth(cell, false); bottoms[11] = cell; // col 12 - 5 cells, need to create 4 more cell = bhc.AddSouth(tops[12], false); cell = bhc.AddSouth(cell, false); cell = bhc.AddSouth(cell, false); cell = bhc.AddSouth(cell, false); bottoms[12] = cell; // col 13 - 5 cells, need to create 4 more cell = bhc.AddSouth(tops[13], false); cell = bhc.AddSouth(cell, false); cell = bhc.AddSouth(cell, false); cell = bhc.AddSouth(cell, false); bottoms[13] = cell; // col 14 is one cell to the NE of the bottom of col 13 tops[14] = bhc.AddNorthEast(bottoms[13], false); bottoms[14] = tops[14]; // tops 10->1 going west from seed - tops[11] // top of col 10 is S then SW of top of col 11 tops[10] = bhc.AddSouthWest(tops[11].South, false); // col 10 - 10 cells, need to add 9 more cell = bhc.AddSouth(tops[10], false); cell = bhc.AddSouth(cell, false); cell = bhc.AddSouth(cell, false); cell = bhc.AddSouth(cell, false); cell = bhc.AddSouth(cell, false); cell = bhc.AddSouth(cell, false); cell = bhc.AddSouth(cell, false); cell = bhc.AddSouth(cell, false); cell = bhc.AddSouth(cell, false); bottoms[10] = cell; // top of col 9 is S then SW of top of col 10 tops[9] = bhc.AddSouthWest(tops[10].South, false); // col 9 - 9 cells, need to add 8 more cell = bhc.AddSouth(tops[9], false); cell = bhc.AddSouth(cell, false); cell = bhc.AddSouth(cell, false); cell = bhc.AddSouth(cell, false); cell = bhc.AddSouth(cell, false); cell = bhc.AddSouth(cell, false); cell = bhc.AddSouth(cell, false); cell = bhc.AddSouth(cell, false); bottoms[9] = cell; // top of col 8 is SW of top of col 9 tops[8] = bhc.AddSouthWest(tops[9], false); // col 8 - 8 cells, need to add 7 more cell = bhc.AddSouth(tops[8], false); cell = bhc.AddSouth(cell, false); cell = bhc.AddSouth(cell, false); cell = bhc.AddSouth(cell, false); cell = bhc.AddSouth(cell, false); cell = bhc.AddSouth(cell, false); cell = bhc.AddSouth(cell, false); bottoms[8] = cell; // top of col 7 is SW of top of col 8 tops[7] = bhc.AddSouthWest(tops[8], false); // col 7 - 4 cells, need to add 3 more cell = bhc.AddSouth(tops[7], false); cell = bhc.AddSouth(cell, false); cell = bhc.AddSouth(cell, false); bottoms[7] = cell; // top of col 6 is SW of top of col 7 tops[6] = bhc.AddSouthWest(tops[7], false); // col 6 - 3 cells, need to add 2 more cell = bhc.AddSouth(tops[6], false); cell = bhc.AddSouth(cell, false); bottoms[6] = cell; // top of col 5 is NW of top of col 6 tops[5] = bhc.AddNorthWest(tops[6], false); // col 5 - 3 cells, need to add 2 more cell = bhc.AddSouth(tops[5], false); cell = bhc.AddSouth(cell, false); bottoms[5] = cell; // top of col 4 is NW of top of col 5 tops[4] = bhc.AddNorthWest(tops[5], false); // col 4 - 4 cells, need to add 3 more cell = bhc.AddSouth(tops[4], false); cell = bhc.AddSouth(cell, false); cell = bhc.AddSouth(cell, false); bottoms[4] = cell; // top of col 3 is NW of top of col 4 tops[3] = bhc.AddNorthWest(tops[4], false); // col 3 - 4 cells, need to add 3 more cell = bhc.AddSouth(tops[3], false); cell = bhc.AddSouth(cell, false); cell = bhc.AddSouth(cell, false); bottoms[3] = cell; // top of col 2 is NW of top of col 3 tops[2] = bhc.AddNorthWest(tops[3], false); // col 2 - 4 cells, need to add 3 more cell = bhc.AddSouth(tops[2], false); cell = bhc.AddSouth(cell, false); cell = bhc.AddSouth(cell, false); bottoms[2] = cell; // top of col 1 is NW of top of col 2 tops[1] = bhc.AddNorthWest(tops[2], false); // col 1 - 4 cells, need to add 3 more and mind the gap in the middle cell = bhc.AddSouth(tops[1], false); // gap! // bottom of col 1 is SW of bottom of col 2 bottoms[1] = bhc.AddSouthWest(bottoms[2], false); cell = bhc.AddNorth(bottoms[1], false); // col 0 is one cell SW of bottom of col 1 tops[0] = bhc.AddSouthWest(bottoms[1], false); bottoms[0] = tops[0]; return(bhc); }