# Coding NumberLine Questions

You can code two types of questions that use the NumberLine tool: one in which students locate points and graph intervals and inequalities on a number line graph, referred to as default mode, and another, referred to as points mode, where students indicate point positions on a number line graph. Note that all code is typed in the answer field.

## Parameters for Answer Field

The text for a NumberLine answer field involves:

- all display attributes and their values
- answer key objects (for example, 3.2; (6.45, 6.75])
- (For points mode only) all distractors.

## Best Practices for All Randomizations

So that students have a consistent user experience, the following rules must be observed for randomization to work effectively:

- NumberLine tool attributes (range, tickmarks, minor_tickmarks) must not be randomized.
- If an answer key object or endpoint falls on a labeled tickmark, all randomizations of that object or endpoint must fall on a labeled tickmark.
- If an answer key object or endpoint falls on an unlabeled tickmark, all randomizations of that object or endpoint must fall on an unlabeled tickmark.
- If an answer key object or endpoint falls between two consecutive tickmarks, all randomizations of that object or endpoint must fall between two consecutive tickmarks.

## NumberLine Tool Algorithm

For an optimum user experience for students, the following rules have been implemented.

- Between a labeled and unlabeled tickmark, there must be space for at least two closed circle symbols.
- Between two labeled tickmarks, there must be space for at least four closed circle symbols.
- There must be an odd number of tickmarks.
- Unlabeled (or minor) tickmarks must evenly bisect the intervals in which they are found.

If a specified range display attribute does not follow all of these rules, the NumberLine tool will instead extend the range slightly to attempt to enforce this rule. If the specified range display attribute is found to be completely unworkable, the algorithm will return the default tickmarks based on a range of -5 to 5.