public CuboidEnumerator GetNewFromDirection(Direction d) { CuboidEnumerator result = new CuboidEnumerator(this); result.Move(d); return(result); }
public void EnumerateStars() { for (int w = 1; w < Width - 1; w++) { for (int h = 1; h < Height - 1; h++) { for (int d = 1; d < Depth - 1; d++, iterations++) { CuboidEnumerator currentPos = new CuboidEnumerator(w, h, d); if (IsStar(currentPos)) { colorOccurrences[CharToIndex(this[currentPos])]++; //char current = this[currentPos]; //if (stars.ContainsKey(current)) //{ // stars[current]++; //} //else //{ // stars.Add(current, 1); //} } } } } }
public char this[CuboidEnumerator c] { get { return(this[c.WPos, c.HPos, c.DPos]); } set { this[c.WPos, c.HPos, c.DPos] = value; } }
public CuboidEnumerator(CuboidEnumerator c) { if (c != null) { WPos = c.WPos; HPos = c.HPos; DPos = c.DPos; } else { throw new System.ArgumentNullException(); } }
public bool IsStar(CuboidEnumerator fromPos) { char currentColor = this[fromPos]; return(currentColor == this[fromPos.WPos, fromPos.HPos, fromPos.DPos + 1] && currentColor == this[fromPos.WPos, fromPos.HPos, fromPos.DPos - 1] && currentColor == this[fromPos.WPos, fromPos.HPos + 1, fromPos.DPos] && currentColor == this[fromPos.WPos, fromPos.HPos - 1, fromPos.DPos] && currentColor == this[fromPos.WPos + 1, fromPos.HPos, fromPos.DPos] && currentColor == this[fromPos.WPos - 1, fromPos.HPos, fromPos.DPos] ); //return (this[fromPos] == this[fromPos.GetNewFromDirection(Direction.Backward)] && // this[fromPos] == this[fromPos.GetNewFromDirection(Direction.Forward)] && // this[fromPos] == this[fromPos.GetNewFromDirection(Direction.Deeper)] && // this[fromPos] == this[fromPos.GetNewFromDirection(Direction.Shallower)] && // this[fromPos] == this[fromPos.GetNewFromDirection(Direction.Left)] && // this[fromPos] == this[fromPos.GetNewFromDirection(Direction.Right)] // ); }
public CuboidEnumerator GetNewFromDirection(Direction d) { CuboidEnumerator result = new CuboidEnumerator(this); result.Move(d); return result; }
public bool IsStar(CuboidEnumerator fromPos) { char currentColor = this[fromPos]; return (currentColor == this[fromPos.WPos, fromPos.HPos, fromPos.DPos + 1] && currentColor == this[fromPos.WPos, fromPos.HPos, fromPos.DPos - 1] && currentColor == this[fromPos.WPos, fromPos.HPos + 1, fromPos.DPos] && currentColor == this[fromPos.WPos, fromPos.HPos - 1, fromPos.DPos] && currentColor == this[fromPos.WPos + 1, fromPos.HPos, fromPos.DPos] && currentColor == this[fromPos.WPos - 1, fromPos.HPos, fromPos.DPos] ); //return (this[fromPos] == this[fromPos.GetNewFromDirection(Direction.Backward)] && // this[fromPos] == this[fromPos.GetNewFromDirection(Direction.Forward)] && // this[fromPos] == this[fromPos.GetNewFromDirection(Direction.Deeper)] && // this[fromPos] == this[fromPos.GetNewFromDirection(Direction.Shallower)] && // this[fromPos] == this[fromPos.GetNewFromDirection(Direction.Left)] && // this[fromPos] == this[fromPos.GetNewFromDirection(Direction.Right)] // ); }
public char this[CuboidEnumerator c] { get { return this[c.WPos, c.HPos, c.DPos]; } set { this[c.WPos, c.HPos, c.DPos] = value; } }