예제 #1
0
 public bool Equals(Size other)
 {
     return Length == other.Length && Height == other.Height && Width == other.Width;
 }
예제 #2
0
 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);
 }
예제 #3
0
 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);
 }
예제 #4
0
 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 };
 }
예제 #5
0
 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 };
 }
예제 #6
0
 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;
 }