public bool Equals(Size other) { return Length == other.Length && Height == other.Height && Width == other.Width; }
private void ProcessPieceByPlace(Size requredSize, string coloring, Size offset) { PieceIdentity identityToFind = new PieceIdentity { UnorderedSize = requredSize, Coloring = coloring }; int index = storage[identityToFind].Dequeue(); var piece = pieces[index]; while (!(piece.MatchBasePiece(basePiece) && piece.Size.Equals(requredSize))) piece.CommitNextRotation(); answer[index] = pieces[index].ToString(offset); }
public string ToString(Size offset) { return String.Format("{0} {1} {2} {3} {4}", sideToStringMapping[(int)Rotation[(int)Side.Front]], sideToStringMapping[(int)Rotation[(int)Side.Bottom]], offset.Length, offset.Height, offset.Width); }
public void Roll(Axis axis) { this.ApplyTranformation(axis); if (axis == Axis.FrontBack) Size = new Size { Length = Size.Length, Height = Size.Width, Width = Size.Height }; if (axis == Axis.TopBottom) Size = new Size { Length = Size.Width, Height = Size.Height, Width = Size.Length }; if (axis == Axis.LeftRight) Size = new Size { Length = Size.Height, Height = Size.Length, Width = Size.Width }; }
public Piece(Size size, string coloring) { Rotation = new[] { Side.Front, Side.Back, Side.Bottom, Side.Top, Side.Left, Side.Right }; Size = size; Coloring = coloring; Identity = new PieceIdentity { UnorderedSize = Size, Coloring = Coloring }; }
public Size GetUnordered() { var size = new Size { Length = Math.Max(Length, Math.Max(Height, Width)), Width = Math.Min(Length, Math.Min(Height, Width)) }; size.Height = Length + Height + Width - size.Length - size.Width; return size; }