Add basic minimax algorithm (some bugs)