3 ms·
> Minimax algorithm: https://en.wikipedia.org/wiki/Minimax https://en.wikipedia.org/wiki/Minimax (I actually generally use negamax, the non-corecursive version,
by zwegner 12y ago
> Minimax algorithm: https://en.wikipedia.org/wiki/Minimax https://en.wikipedia.org/wiki/Minimax (I actually generally use negamax, the non-corecursive version, but you should understand minimax first)
That's mutual recursion, not corecursion. Check the article out, corecursion has a much more... "mathematical" definition, relating to the types of initial data and final data.
By my quick reading, your second example might be considered corecursion (but I think is also just regular recursion). It might not be considered recursion at all, in this particular sense, as it's only one piece of infinite data, not a function that takes an input. I'm not the best algebraist though.
- gamegoblin 12y agoYou're correct about the minimax. The second example is corecursion, I believe. The article specifically mentions > Corecursion can produce both finite and infinite data structures as result, and may employ self-referential data structures. Corecursion is often used in conjunction with lazy evaluation