  We consider a generalization of the classical game of $NIM$ called hypergraph
$NIM$. Given a hypergraph $\cH$ on the ground set $V = \{1, \ldots, n\}$ of $n$
piles of stones, two players alternate in choosing a hyperedge $H \in \cH$ and
strictly decreasing all piles $i\in H$. The player who makes the last move is
the winner. In this paper we give an explicit formula that describes the
Sprague-Grundy function of hypergraph $NIM$ for several classes of hypergraphs.
In particular we characterize all $2$-uniform hypergraphs (that is graphs) and
all matroids for which the formula works. We show that all self-dual matroids
are included in this class.
