AIMA.Core.Environment.EightPuzzle.EightPuzzleBoard.Equals C# (CSharp) Method

Equals() public method

public Equals ( Object o ) : bool
o Object
return bool
	public override bool Equals(Object o) {

		if (this == o) {
			return true;
		}
		if ((o == null) || (this.getClass() != o.getClass())) {
			return false;
		}
		EightPuzzleBoard aBoard = (EightPuzzleBoard) o;

		for (int i = 0; i < 8; i++) {
			if (this.getPositionOf(i) != aBoard.getPositionOf(i)) {
				return false;
			}
		}
		return true;
	}

Usage Example

Beispiel #1
0
        public bool isGoalState(Object state)
        {
            EightPuzzleBoard board = (EightPuzzleBoard)state;

            return(board.Equals(goal));
        }