public readonly int numMissionariesLeft; //кількість місіонерів на лівому березі public CannibalsMissionariesState(bool boatRight, int cannibalsRight, int missionariesRight, int cannibalsLeft, int missionariesLeft, CannibalsMissionariesState previousState, string newStep, int g, int h) : base(previousState, newStep, g, h) { boatOnRight = boatRight; numCannibalsRight = cannibalsRight; numMissionariesRight = missionariesRight; numCannibalsLeft = cannibalsLeft; numMissionariesLeft = missionariesLeft; }
public override bool Equals(object obj) { if (object.ReferenceEquals(this, obj)) { return(true); } CannibalsMissionariesState otherState = obj as CannibalsMissionariesState; return(otherState != null && boatOnRight == otherState.boatOnRight && numCannibalsRight == otherState.numCannibalsRight && numMissionariesRight == otherState.numMissionariesRight && numCannibalsLeft == otherState.numCannibalsLeft && numMissionariesLeft == otherState.numMissionariesLeft); }