private Move getBestMove(Set<Move> possibleMoves, GameState state) {
		/**
		 * This method determines the best move to try based on the following logic
		 * (some portions not yet implemented, marked as such (NYI):
		 
		 if the last move is an atari, then
		 	Save the stones which are in atari.
	(NYI)else if there is an empty location among the 8 locations around the last move which matches a pattern then
	(NYI)	Play randomly uniformly in one of these locations.
	(NYI)else if there is a move which captures stones then
			Capture stones.
		else if there is a legal move then
			Play randomly a legal move that doesn't kill your own eyespace
		else
			Return pass.
		end if
		 */
		Player currentPlayer = state.getNextToMove();
		stripBadMoves(possibleMoves, state);
		if (possibleMoves.isEmpty()){
			return Move.getMoveInstance(MoveType.PASS, 0, 0);
		}

		//save stones that are in atari
		Move move = state.getLastMove(currentPlayer.getColor());
		StoneGroup group = state.getStoneGroupAt(move);
		if (group != null && group.getRemainingLiberties()==1){
			Intersection i = group.getLiberties().iterator().next();
			move = Move.getMoveInstance(MoveType.NORMAL, i.x_location, i.y_location);
			if (possibleMoves.contains(move)){
				return move;
			}
		}
		
		//implement pattern matching here at a later time
		
		
		//try to kill enemy groups
		Set<StoneGroup> groups = state.getGroupsInAtari();
		Set<StoneGroup> enemyGroups = new TreeSet<>(new Comparator<StoneGroup>(){
			@Override
			public int compare(StoneGroup o1, StoneGroup o2) {
				Integer o2Size = o2.getStones().size();
				Integer o1Size = o1.getStones().size();
				return o2Size.compareTo(o1Size);
			}
		});
		for (StoneGroup atariGroup : groups){
			if (!atariGroup.getOwner().equals(currentPlayer.getColor())){
				enemyGroups.add(atariGroup);
			}
		}
		int asi = 0;
		for (StoneGroup enemyGroup : enemyGroups){
			Intersection i = enemyGroup.getLiberties().iterator().next();
			Move m = Move.getMoveInstance(MoveType.NORMAL, i.x_location, i.y_location);
			if (possibleMoves.contains(m)){
				return m;
			}
		}
		
		//play randomly
		List<Move> moveList = new ArrayList<>(possibleMoves);
		return moveList.get(random.nextInt(possibleMoves.size()));
	}