implementation of generic minimax class