Is the state a goal state?

Once a goal state is found, the solver is automatically stopped. A problem can have 0, one or more goals if it makes sense but solver must be used accordingly. Default: no goals

Property definitions

ai $ SearchProblem :: is_goal
	# Is the state a goal state?
	# Once a goal state is found, the solver is automatically stopped.
	# A problem can have 0, one or more goals if it makes sense
	# but solver must be used accordingly.
	# Default: no goals
	fun is_goal(state:S): Bool do return false
lib/ai/search.nit:85,2--90,43

ai $ PuzzleProblem :: is_goal
	# Each tile is at its correct position
	redef fun is_goal(state)
	do
		for i in [0..state.length[ do
			var t = state[i]
			if t != hole and t.goal_idx != i then return false
		end
		return true
	end
lib/ai/examples/puzzle.nit:138,2--146,4