protected ThueRule findRule() {
		ThueRule result = null;
		boolean[] checkedRules = new boolean[rulesList.size()];

		int checkruleCounter = 0;
		for (int i = 0; i < checkedRules.length; i++)
			checkedRules[i] = false;

		if (ruleSelectionPolicy.equals(RuleSelectionPolicy.RULELIST_ASC))
			ruleIndex = -1;
		else if (ruleSelectionPolicy.equals(RuleSelectionPolicy.RULELIST_DESC))
			ruleIndex = rulesList.size();

		while (checkruleCounter < rulesList.size()) {
			checkruleCounter++;
			switch (this.ruleSelectionPolicy) {
			case RANDOM:
				do {
					ruleIndex = rnd.nextInt(rulesList.size());
				} while (checkedRules[ruleIndex]);
				break;
			case RULELIST_ASC:
				ruleIndex++;
				break;
			case RULELIST_DESC:
				ruleIndex--;
				break;
			}
			checkedRules[ruleIndex] = true;
			ThueRule rule = rulesList.get(ruleIndex);
			if (data.indexOf(rule.getMatch()) >= 0) {
				result = rule; // this rule is applicable
				break;
			}
		}

		return result;
	}