예제 #1
0
 public void Dispose()
 {
     Parent   = null;
     Location = null;
     Block    = null;
     Children = null;
 }
예제 #2
0
        public static IEnumerable <Block> GetNextBlockOptions(Node input)
        {
            bPoint loc = GetNextLocation(input);
            byte   H   = HeightMap[loc.Y, loc.X];

            Block[,] bs = GetBoardState(input);
            IEnumerable <Block> output = UnusedBlocks(input);

            output = output.Where(x => x._Height == H);

            #region special block/location combos
            Block B1 = new Block(Color.Orange, 6);
            Block B2 = new Block(Color.Yellow, 5);
            if (loc.X == 3 && loc.Y == 2 && BucketContains(UnusedBlocks(input), B1))
            {
                output = output.Concat(new[] { B1 });
            }
            if (loc.X == 3 && loc.Y == 4 && BucketContains(UnusedBlocks(input), B2))
            {
                output = output.Concat(new[] { B2 });
            }
            #endregion

            //remove invalid colors
            for (int i = 0; i < Heights.Count() - 1; i++)
            {
                Color C1 = bs[i, loc.Y]._Color;
                Color C2 = bs[loc.X, i]._Color;
                output = output.Where(x => x._Color != C1 && x._Color != C2);
            }

            return(output);
        }
예제 #3
0
 public Node(Node Parent, Block AddedBlock)
 {
     this.Parent   = Parent;
     this.Location = Utility.GetNextLocation(Parent);
     this.Block    = AddedBlock;
 }