public Coordinate GetInitalCoordinte(InitialPosition pos) { if (pos.Equals(InitialPosition.UpLeft)) { return(new Coordinate(1, 1)); } else if (pos.Equals(InitialPosition.UpRight)) { return(new Coordinate(width - 2, 1)); } else if (pos.Equals(InitialPosition.DownLeft)) { return(new Coordinate(1, height - 2)); } else if (pos.Equals(InitialPosition.DownRight)) { return(new Coordinate(width - 2, height - 2)); } else { throw new ArgumentException($" Invalid initial position {pos.ToString()}"); } }
public static MoveDirection GetMoveDirection(InitialPosition pos) { if (pos.Equals(InitialPosition.UpLeft)) { return(MoveDirection.Down); } else if (pos.Equals(InitialPosition.UpRight)) { return(MoveDirection.Left); } else if (pos.Equals(InitialPosition.DownLeft)) { return(MoveDirection.Right); } else if (pos.Equals(InitialPosition.DownRight)) { return(MoveDirection.Up); } else { // log error return(MoveDirection.None); } }