Implemented nega-max