runtime error in stones

Runtime Error(SIGSEGV).
how to fix it??

check for divide by zero, out of bound memory access in arrays/matrix(most probable cause).

//