Combinatorial Game Theory/Game of NIM/gameNIM.c
// A C function to calculate the Nim-Sum at any point 
// of the game. 
A C function to calculate the Nim-Sum at any point
of the game.
A C function to calculate the Nim - Sum at any point of the game .
int calculateNimSum(int piles[], int n) 
{ 
    int i, nimsum = piles[0]; 
    for (i=1; i<n; i++) 
        nimsum = nimsum ^ piles[i]; 
    return(nimsum); 
}
int calculateNimSum ( int piles [ ] , int n ) { int i , nimsum = piles [ 0 ] ; for ( i = 1 ; i < n ; i ++ ) nimsum = nimsum ^ piles [ i ] ; return ( nimsum ) ; }
A C function to calculate the Nim-Sum at any point
of the game.
A C function to calculate the Nim - Sum at any point of the game .