Exemplo n.º 1
0
 public void moveTo(Position to)
 {
     if (to.equals(pos))
     {
         throw new System.ArgumentException("Cannot move to the same position");
     }
     if (to.X < 0 || to.X >= 8 || to.Y < 0 || to.Y >= 8)
     {
         throw new ArgumentException(to + "is outside the board");
     }
     if (!this.canMoveTo(to))
     {
         throw new ArgumentException("Cannot move " + this.name() + " to " + to);
     }
     this.pos = to;
 }