Sample
Schnappinger/aoi/artofillusion.raytracer.RTDirectionalLight
Human rating uses the original dataset scale.
Scores
| Method | Score | Scale | Dataset rank (0–100) |
|---|---|---|---|
| Posnett | 0 | 0–1; higher is more readable | 57.2Δ 5.5 |
| Scalabrino | 0.522 | 0–1; higher is more readable | 11.0Δ 51.7 |
| Dorn | 0.567 | 0–1; higher is more readable | 64.0Δ 1.3 |
| Mi | 0.703 | 0–1; higher is more readable | 83.8Δ 21.1 |
| LLOC | 14 | Logical lines; fewer is more readable | 66.8Δ 4.1 |
| DeepSeek V4 Pro | 17.67 | 0–20; mean of three runs | 83.0Δ 20.3 |
| GPT-6.1 Sol | 18 | 0–20; mean of three runs | 73.8Δ 11.1 |
| BTTF | 0.551 | 0–1; higher is more readable | 50.5Δ 12.2 |
| Human | 3.95 | 1–4; original rating | 62.7 |
Views
Loading feature diagnosis…
Source regions
Feature contributions
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones. | 1237.09 | −40.824 |
| Source linesThe number of non-empty source lines. | 49 | +19.6 |
| Byte entropyHow varied the bytes in the source text are. Repeated bytes give a lower value; a more even mixture gives a higher value. | 5.015 | −7.522 |
Intercept 8.87 + feature contributions = -19.876 (log-odds).
Score = sigmoid(-19.876) = 0.
| Score | 0.522 |
|---|
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 96.86 | +0.758 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 50 | −0.734 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 39 | +0.612 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 39 | −0.474 |
| Identifier layout (horizontal)How rapidly the visual pattern of identifier characters changes from left to right. It measures spatial frequency, not the meaning of the names. | 96.94 | −0.441 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 48.847 | +0.273 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.076 | +0.207 |
Intercept 0.07 + feature contributions = 0.271 (log-odds).
Score = sigmoid(0.271) = 0.567.
| Score | 0.703 |
|---|
| Score | 14 |
|---|
Run 1
The code is well-structured and demonstrates clear intent. The class has a single, focused responsibility—representing a directional light in a ray tracer. The constructor is concise and initializes the radius with a clear conditional expression. The findRayToLight method is flat, with only one level of nesting, and each action is separated logically: setting the origin, retrieving and adjusting the direction, optionally randomizing, and returning the distance. Variable names are descriptive, and the use of constants like Double.MAX_VALUE and Math.PI is appropriate. However, the soft shadow logic in getSoftShadows is slightly dense, combining a type check with a radius check in one return statement. Overall, the code is readable and maintainable.
Run 2
The code is well-structured and readable. It has a clear class purpose, straightforward constructor logic, and concise method implementations. Nesting is minimal (one conditional inside a method), and intent is easy to discern: compute ray direction for a directional light, optionally jitter for soft shadows. Actions are mostly one per line. The only slight readability cost is the ternary expression for 'radius', which crams two possible outcomes into one line, and the boolean combination in getSoftShadows(), which requires a moment to parse. Overall, naming is clear, the flow is natural, and the length is appropriate for the task.
Run 3
The code is well-structured and highly readable. It has a clear class hierarchy, concise methods, and logical organization. The constructor cleanly handles the soft shadow flag, and findRayToLight is focused with one primary action per line. Nesting is minimal, with only one conditional block. Variable names are descriptive (radius, dir, renderer). The code is concise without sacrificing clarity. The main minor deductions are for the lack of a comment explaining the radius calculation formula and slight ambiguity in getSoftShadows's type check. Overall, it follows good Java practices and reads naturally from top to bottom.
Run 1
Code Structure: The class is logically organized into a field, constructor, and two focused methods. Nesting: A single conditional keeps control flow shallow and easy to follow. Clarity of intent: Class and method names communicate the directional-light purpose, though the meanings of rayNumber == -1, Double.MAX_VALUE, and the radius conversion are not explained. Code length: The implementation is compact without unnecessary repetition; the license header adds length but does not complicate the logic. Action granularity: Statements generally perform one action per line, making ray initialization and adjustment easy to track. Reading flow: Execution proceeds naturally from setting the origin and direction to optional randomization and normalization. Minor readability weaknesses include abbreviated dir, direct access through ray.rt.random, and wildcard imports.
Run 2
Code Structure: A small, focused class cleanly separates initialization, ray setup, and soft-shadow detection. Nesting: Only one shallow conditional keeps control flow simple. Clarity of intent: Descriptive class and method names make the purpose clear, though the rayNumber sentinel (-1), Double.MAX_VALUE return, and radius angle-to-tangent conversion would benefit from brief explanations. Code length: Concise, with no unnecessary implementation code. Action granularity: Statements generally perform one action per line, making mutations easy to follow. Reading flow: Methods proceed naturally from setup to adjustment to return; consistent formatting supports scanning. Wildcard imports and abbreviated names such as dir and coords slightly reduce explicitness.
Run 3
Code Structure: The class is logically organized into a field, constructor, and two focused methods. Nesting: Only one shallow conditional keeps control flow easy to follow. Clarity of intent: Descriptive class and method names establish the purpose, but the rayNumber sentinel -1, Double.MAX_VALUE return, and angular-radius conversion would benefit from brief explanations. Code length: The implementation is concise without unnecessary duplication; the license header does not obscure the small class. Action granularity: Most statements perform one action per line, making ray initialization and direction adjustment easy to track. Reading flow: Operations follow a natural sequence from setup through optional randomization to return. Wildcard imports, the abbreviated variable dir, and limited documentation of numerical conventions are minor readability drawbacks.