ai :: SearchProblem :: actions
While there is a potential large number of distinct states and actions, there should be only a small number of possible action from a specific state (a small, or at least finite, branching factor).
# The available applicable actions for a given state.
# While there is a potential large number of distinct states and actions, there should be only
# a small number of possible action from a specific state (a small, or at least finite, branching factor).
fun actions(state: S): nullable SequenceRead[A] is abstract
lib/ai/search.nit:66,2--69,60
# Get the four available movements, or 3 on a edge, or 2 in a corner.
redef fun actions(state)
do
var h = get_hole(state)
var x = h % width
var y = h / width
var res = new Array[Int]
if x >= 1 then res.add(-1)
if x < width-1 then res.add(1)
if y >= 1 then res.add(-width)
if y < width-1 then res.add(width)
return res
end
lib/ai/examples/puzzle.nit:97,2--109,4